[jboss-user] [JBoss Messaging] - MDB BMT Redelivery

jesse_sweetland do-not-reply at jboss.com
Fri Feb 16 14:03:37 EST 2007

Based on http://www.jboss.com/index.html?module=bb&op=viewtopic&t=53631 it seems that the JMS specification and the EJB specification conflict on how redelivery is handled for MDBs with BMT.  Specifically, the EJB specification states that the message acknowledgement is managed by the container (happens outside of the transaction onMessage() method) and can be prevented by throwing a RuntimeException from onMessage().  The JMS specification states that throwing an unchecked exception from onMessage() is not expected and produces undetermined results.  Based on my experience with JBoss, it seems that the latter behavior is what is implemented; when I throw a RuntimeException from onMessage the exception is logged but the message is still acknowledged.  I've tried in JBoss 4.0.3SP1 and 4.0.5GA.

I've also read that using BMT with an MDB and expecting redelivery is an anti-pattern, and in most cases I can see that.  However, I have a need to log (and commit) events to a database as they occur with the possibility of redelivering the message should processing fail at some point.  CMT will not work, since rolling back the distributed JTA transaction will undo the logging.  BMT works well, but I cannot force redelivery.

In the post I linked to there was mention of a possible patch to allow RuntimeExceptions thrown from onMessage() to cause redelivery of messages.  Has this patch been applied?  If so, is it included with any current version of JBoss AS, or would I need to update the JBoss messaging libraries myself?  What sort of configuration changes would I need to make to enable it?

If the patch hasn't been applied, can anyone suggest a workaround?  Some ideas that I have brewing are perhaps using raw JDBC calls (perhaps through a custom Log4J appender) or trying to log in another thread.  I'm not certain that either will work as expected, though.

Any ideas are very much appreciated.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017816#4017816

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017816

More information about the jboss-user mailing list