• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Message.acknowledge()

 
Bartender
Posts: 2038
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On Frits' notes, p.37, for container managed transaction,

it is not allowed to use Message.acknowledge() either within a transaction or within an unspecified transaction context.



Question 1: 'either within a transaction or within an unspecified transaction context' means regardless the bean is executing a transaction or not, the bean should never invoke Message.acknowledge() method in onMessage(), lifecycle callback interceptors, timer callback interceptors, business method interceptors or inside business methods?

Question 2: MDB should not invoke Message.acknowledge() because the EJB container will acknowledge the receipt of the message to the messaging provider. In the other words, the container will acknowledge the message on behalf of the MDB. Is this the reason why Message.acknowledge() is not allowed in MDB?

 
Creator of Enthuware JWS+ V6
Posts: 3386
311
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Question 1: 'either within a transaction or within an unspecified transaction context' means regardless the bean is executing a transaction or not, the bean should never invoke Message.acknowledge() method in onMessage(), lifecycle callback interceptors, timer callback interceptors, business method interceptors or inside business methods?


Be careful: an unspecified transaction context is not the same as no transaction context (check ejb specs 13.6.5 Handling of Methods that Run with "an unspecified transaction context"). But generally spoken: don't use this method when you have a MDB.

Question 2: MDB should not invoke Message.acknowledge() because the EJB container will acknowledge the receipt of the message to the messaging provider. In the other words, the container will acknowledge the message on behalf of the MDB. Is this the reason why Message.acknowledge() is not allowed in MDB?


Exactly.
 
Does this tiny ad smell okay to you?
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic