• 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

Why not use RequiresNew/Supports for MDB?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the things mentioned in HFE is that MessageDrivenBeans should use only Required or NotSupported as Tx attributes.

But since the container calls the MDB's onMessage method, we can assume that the onMessage call is called without any tx context.

It will be like this when Required is used

                           onMessage
                            (Tx A)
Container    --->    Container
(no tx)                        (No tx)


Wont it be the same when when the RequiresNew is used too?

Also we assume that when the container calls NotSupports, it is calling without any tx context. If that is the case, why cant Supports be a valid attribute (because Supports and NotSupported will look the same)?

So why cant we use it them?
[ November 21, 2004: Message edited by: Justin ]
 
Rancher
Posts: 3645
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy,

The reason is because client can not pass his transaction to MDB and he can not receive back MDB's exception.

Here what EJB 2.0 specification says:


Only the NotSupported and Required transaction attributes may be used for message-driven beans.

The use of the other transaction attributes is not meaningful for message-driven beans because there can be no pre-existing transaction context (RequiresNew, Supports) and no client to handle
exceptions (Mandatory, Never).



regards,
MZ
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic