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

MDB's & transaction attributes

 
manish ahuja
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I was going through Message Driven Beans(MDB) . I read that we can only have 2 transaction attribute types on the onMessage method of the MDB.
they are required & notsupported.
Could someone ellaborate on why only these 2 and not the other transaction attrib's
What i read is Because transaction context never flows over JMS messages, a
message-driven bean can never perform work in the scope of the client's transaction.
The transaction attributes of the onMessage method are hence restricted to Required
and NotSupported.

Now in this scenario what if the calling client has a transaction context & the onMessage method has a required transaction attribute
Could someone ellaborate a bit why requiredNew/mandatory will not work for onMessage keeping in mind both the contexts (calling method has a transactioncontext & the other phenomena is the calling method does not have a transaction context)
Rgrds
Manish
 
Nikhil Pendharkar
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Message driven Beans we can only define transaction scope for onMessage() method .
If the message receipt of a message-driven bean is to be part of the
transaction, then the MDB must use the
"Required" transactional attribute otherwise it should use "NotSupported" because MDB can either be required to be a part or transaction not so for this type of situation above attributes are used .
Also MDB is not going to propogate the transaction further so it won't need "RequiresNew" or "Mandatory".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic