This content has been marked as final.
Show 1 reply
-
1. Re: Changing Message Properties
pra Apr 17, 2002 3:04 AM (in response to puneet)Do you mean when it is in the queue? No.
But you can pop if from the queue, change properties and stuff it in again, here is som code from org.jboss.ejb.plugins.jms.DLQHandler that helps doing that:
protected Message makeWritable(Message msg) throws JMSException
{
Hashtable tmp = new Hashtable();
// Save properties
for(Enumeration en = msg.getPropertyNames();en.hasMoreElements();)
{
String key = (String) en.nextElement();
tmp.put(key,msg.getStringProperty(key));
}
// Make them writable
msg.clearProperties();
Enumeration keys = tmp.keys();
while(keys.hasMoreElements())
{
String key = (String) keys.nextElement();
msg.setStringProperty(key,(String)tmp.get(key));
}
return msg;
}
//Peter