Register / Login
EJB and other Java EE Technologies
MessageNotWriteableException - Need to write to JMS Message
posted 10 years ago
I get read-only JMSMessage in onMessage(TextMessage msg) method of Message Driven bean.
I process that message. However, if an Exception is thrown, I am required to append error info to the same textMessage(same textMessage that came to me as argument of onMessage method).
However this textMessage is read only. I cannot write to it using
textMsg.setStringProperty("error", "Error description");
I want to keep the original header info and message from msg that came in onMessage().
I used code like following with no luck:
TextMessage m = queueSession.createTextMessage();
m = msg; // msg is from onMessage() argument
m.setStringProperty("error", "Error description");
How can I set error condition to a message (could be a new message all together, if not the same message that comes from onMessage()) using API?
I need a message that is writeable and would typically like to copy all info from msg to the new writeable textmessage.
Problem with jms Message Selector
How to Read a Queue Message from MDB
JMS request/ Response Model using MDB.
JMS on JBOSS- Asynchronous Queue Receiver