To answer this question you may read chapter "13.6.1 Bean-Managed Transaction
Demarcation" of the specification "Enterprise JavaBeans 3.1, Final Release,
November 5, 2009".

Message driven beans with bean-managed transaction demarcation are not
called with an active transaction. The MDB may use the
/javax.transaction.UserTransaction/ to begin, commit or rollback
transactions. And here the section with the bean and container
responsibilities:

/If a message-driven bean instance starts a transaction in a message
listener method or interceptor method, it must commit the transaction before
the message listener method (or all its interceptor methods) returns. The
container must detect the case in which a transaction was started, but not
completed, in a message listener method or interceptor method for the
message listener method, and handle it as follows:
- Log this as an application error to alert the System Administrator.
- Roll back the started transaction.
- Discard the instance of the message-driven bean./

And this is exactly what I do. So there is not active JTA transaction when
the method /onMessage()/ is entered. I start a transaction, commit the
transaction and in case of an exception I rollback the transaction before
the method is left.

Regards Thomas



--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Message-not-redirected-to-DLQ-when-exception-thrown-by-MDB-tp4709187p4709287.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to