1
votes

I am using MDBs deployed on WAS 61. I have a queue (X) and a backout queue (Y). When the MDB listening on X fails to process the message, and EJB exception is thrown, the transaction rolls back and I put the original message on the backout queue. backout queue (Y) has its own MDB which picks up the message and sends to support team in email. So far so good.

Now support team would be helped a lot if in addition to the message in the email, they can also see the exception that was thrown by the EJB. Because looking at just the message ,it is not possible to figure out what went wrong. Is there way to add the exception to the original message before putting it in backout queue?

1

1 Answers

1
votes

ObjectMessage :

An ObjectMessage object is used to send a message that contains a serializable object in the Java programming language ("Java object"). It inherits from the Message interface and adds a body containing a single reference to an object. Only Serializable Java objects can be used.

You can create a class implementing Serializable interface & can have proper attributes to hold the exception details. Then by setting this object in ObjectMssage you can put it in queue.

objectMessage.setObject(object);  //-- Setting serializable object

At receiver end, this object can be obtained from the message & exception details can be retrieved form it accordingly.