Thanks for reply! Not sure what you mean by create a new message. Rollback/retries are handled by transactions. Creating a new message from the client can't be right...? Can you please explain further?
My messages are ObjectMessages. My second attempt was to set a exception string on the payload object. But changing any values on the payload object doesn't have any effect either, the payload is back with the original values on retries and DLQ, and the payload is read-only so I can't set a new one. Trying something like this doesn't work, received on DLQ listener payload.getLastError() returns the original string "No error". class MyPayload { String lastError = "No error"; } public void onMessage(Message msg) { ObjectMessage objMessage = (ObjectMessage) message; MyPayload payLoad = objMessage.getObject(); try { doBusiness(); } catch (Exception ex) { payLoad.setLastError(ex.toString); // Will be rolled back by trans and retried, eventually to DLQ } } James.Strachan wrote: > > You typically don't edit messages; just create a new message and set > whatever contents you want. FWIW in the JMS specifications, properties > are meant to be primitive types, not complex objects - so using an > ObjectMessage and setting the payload is typically more JMS compliant > > 2008/9/8 Demian Mrakovich <[EMAIL PROTECTED]>: >> >> On ActiveMQ 4.1.1 >> >> I'm trying to add an exception to a failed message so that I can get the >> exception that caused it when it is received on my DLQ listener. >> >> I cannot add a string property since the message is read-only when it is >> received by the client. So I tried having the _producer_ create a List >> instance on the message with setObjectProperty so that the client can >> fill >> it with an exception or a string message. >> >> The problem is, while I _can_ get the previous exception message in >> onMessage when it is retried, this List object is null when the message >> is >> received by my DLQ listener. >> >> So my question is: are the message properties copied into a new message >> for >> sending to DLQ and is ActiveMQ "forgetting" to copy the object properties >> on >> it? It doesn't seem to be the same object since the List is now null. >> >> And, has anyone implemented any other solution to getting the exception >> message on the DLQ? >> >> Hope someone can help. >> >> >> -- >> View this message in context: >> http://www.nabble.com/Question%3A-Object-properties-on-DLQ-%28adding-exception-to-message-for-DLQ%29-tp19369459p19369459.html >> Sent from the ActiveMQ - User mailing list archive at Nabble.com. >> >> > > > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://open.iona.com > > -- View this message in context: http://www.nabble.com/Question%3A-Object-properties-on-DLQ-%28adding-exception-to-message-for-DLQ%29-tp19369459p19371467.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.