• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

BMT

 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic