문제

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”

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top