Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

BMT

 
Ranch Hand
Posts: 393
  • 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?
 
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).
 
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic