My limited knowledge of MDB internals and XA is getting me confused.
The basic question that I have is "for what purpose do I need an XA connection factory for an MDB?"
Initially, my answer was as follow: If I deploy my MDB with container managed transaction and transaction required, and if the implementation of my onMessage method is accessing an external resource that I want to synchronize through XA with the reading of the message by the MDB, then I need the MDB to use an XA connection factory (so all the resources involved in the transaction are XA "enabled").
I did some testing with JBoss and it seems that even if my MDB is not using an XA transaction, everything is working ok:
- I have a MDB listening to a WebSphere MQ queue and not using an XA connection factory.
- My onMessage operation is sending a message to a JBoss queue in a transacted session using the JmsXA connection factory.
- If I generate an abort in my onMessage method (mdbContext.setRollbackOnly ()), then the rollback is done on the JBoss queue and on the MDB queue.
So, either I do not need an XA connection factory for my MDB (and then is there any cases where I will need one), either the fact that it is working on JBoss is for some kind of other reason and I am not doing true XA between the MDB queue and the JBoss one and in some cases (according to where/when the abort is occurring), my transaction integrity between the 2 queues might not be respected.
Anyone with a good answer/explanation?
Thomas