简体   繁体   中英

JMS Stand alone MQ provider and distributed transaction

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?

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”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM