Question

I have a standalone MQ provider on network which has a queue. I also have multiple Java EE servers with MDBs who consume messages from that queue. So, I'm forced to make the connection factory with XATransaction.

So, my question is:

In the MDB's, Should i use CMT (JTA) as it hides all complexity of distributed transactions?

I have old MDB which creates a user transaction explicitly, how can i make my explicitly declared transaction to join with jms extended transaction?

Was it helpful?

Solution

You are not forced to use an XA transaction just because you access a remote queue.

You have to use an XA transaction, if your MDB does another operation on multiple transactional resources, and you want to commit all units of work or nothing (this applies both to local and remote resources).


As for your 1st question: You should use CMT, because it's easier, and BMT always acts as a transaction barrier: The global transaction is never propagated into a EJB using BMT.

As for your 2nd question: I am not aware of an option to do this. I suggest converting it into a CMT MDB.

Related: Why do EJB beans with bean-managed transactions act as a “transacation barrier”

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top