Tuesday, January 25, 2005

MDB

I found in the JMS forums that people usually don’t know the difference between MDB management modes. The following summary should clarify things:

With container-managed transactions, the MDB container sets the boundaries of the transactions. Typically, the container begins a transaction and receives a message within it (On the implementation level it is a little bit more complicated than that and I might Blog more details if I am asked). It is the responsibility of the container to enlist other Bean operations (invoked within the onMessage code) whit the running transaction. The container then commits the transaction just after the onMessage method exits or rolls it back when setRollbackOnly is set or when an exception is thrown.

With bean-managed transactions, the code in the MDB explicitly marks the boundaries of the transaction. It is the responsibility of the programmer to get a transaction, to enlist resources and to decide of its outcome. It is not possible to associate the received message with a transaction as messages are delivered to the MDB within a standard session (not an XA Session as it is the case for CMT).

Note that this is also true for the Arjuna MDS (Message Driven Service) container. I’ll tell you more about MDS later.


0 Comments:

Post a Comment

<< Home