Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Distributed transactions in EJB

 
Joginder Raperia
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Sorry I put the subject wrong earleir ..
I am a little bit confused about the distributed transactions.I am not clear about the following things.
1. If I have a method in EJB for which I have defined the transaction-attribute as 'Required' and I am using different resources in that method
a)Sending message to some JMS destination (Queue)
b) updates to database
In this case if the driver I am using is not XA compliant ,what will happen.Will any exception be thrown or what?
2. Is it possible that the JMS Message sender and the receiving MDB (MessageDrivenBean) participate in the same trabsaction if we use XA driver?
Thanks in advance.
Joginder
 
Goan Balchao
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I don't know the answer to the first part of your question. I would guess, that if the driver is not XA compliant, the behaviour is not fully determined by the psec -- I seem to remeber reading that somewhere (I am not sure though)
As to the second part,
"2. Is it possible that the JMS Message sender and the receiving MDB (MessageDrivenBean) participate in the same trabsaction if we use XA driver?"
No it is not possible for the JMS sender and the MDB to participate in the same transaction because, by it's nature MDB's are asynchronous. They cannot be in the same Tx, becuase from the spec " transaction context does not flow with a JMS message" .
The only scenarion would be : You could have the message receipt and the invocation of the MDB to be part of the same Tx, if you use CMT with "Required" Tx attribute. If you use BMT, the message receipt is not a part of the Tx.
Hope that helps. And please update the solution to your XA question, if you get it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic