I am using an Oracle XA driver. Now, a transaction is placing a message in queue ( An MDB listens to this queue and process the message). The parent transaction is continuing its work. At some point, an exception is thrown in the parent transaction and the whole transaction rolls back. Now, what will happen to the message put in the queue. Will it be removed?
"Aryan MK", Mark's request that you change your display name to adhere to JavaRanch standards was not a suggestion. Valid display names are mandatory for participation on the Ranch. Please change your display name as instructed prior to your next post.
Be aware that accounts with invalid display names are removed.
Sorry, but that was my name. Any way, I have changed it now. Thanks for pointing it out. ( I had changed it from AMK, after Marks suggestion)
Joined: Sep 20, 2005
As long as you can create the Queue as a resource within your container and the messages are controlled through your container's JMS server, you can make the Queue part of your transaction. When the queue is part of a transaction, the message is not "delivered" until the original transaction commits. However, once the transaction is committed and the message is delivered, the onMessage of the MDB picks up the message and becomes part of a new transaction. MDB's support only two types of transactions: Required and NotSupported. MDBs cannot participate in a client's transaction. They can create new transaction(s) and make further calls part of the transaction. If a MDB is not happy with a message it received (poison message), it can put it back into the queue. Does it help