Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BMT

 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BMT
someMethod {
startTransaction();
do something..
send some jms message;
endTransaction();
}

CMT
someMethod {
do something..
send some jms message;
}

1) If the BMT transaction fails in some method & transaction rolls back, would the message consumtion too rool back?
2) Is the same true for CMT?
 
Uchana Jackson
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refer to page 183 of Mastering EJB 3.0.

JMS MDB's do not run in the same transaction as the producer who sends the message. If you think about it, the producer must commit the transaction first in order for it to show up on the message queue or topic.

The answer applies to both BMT and CMT (if the client's JMS message creation throws an exception and rolls back, then the onMessage method will not even fire for the MDB listening b/c the message will not even be available).
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In both cases the message the message will be roll backed from queue/topic as the jMS message is sent in transaction scope.

Hi Seam, The MDB can act as the receiving client for the JMS messages set in the above transaction and must not be run into the same transaction as sender transaction. It is no way related to the sender transaction in CMT or BMT.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic