• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

question about MDB and JMS

Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers,

I have a MDB implementing MessageListener and TransactionAttribute.NOT_SUPPORTED. The onMessage() simply throws an EJBException:

I use jboss 4.2.2. When I execute the code the server tries to redeliver the message multiple times. Now I've the following questions:

a) Why does the server redeliver the message? From of the ejb3-spec I understand, that this will happen only to MDB's with TransactionAttribute.Required set:

... If the
onMessage method does not successfully complete or the transaction is rolled back, message redelivery semantics apply.

( is only about REQUIRED CMT)

b) Also in it reads:

A transaction must be started before the dequeuing of the JMS message and, hence, before the invocation of the message-driven bean�s onMessage method. The resource manager associated with the arriving message is enlisted with the transaction as well as all the resource managers accessed by the onMessage method within the transaction...

Does JMS starts a transaction and if so, is this transaction suspended before calling onMessage?

I'm very confused, please help me getting clearer ...

Thank you all,

Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I think you are using queue for your testing. The JMS does not start the transaction, the container is responsible for this in case of CMT and bean in case of BMT.

I think the main cause of the redelivery of message is do to the Exception you are throwing in the MBD. Because of this exception your message delivery never completed and in some cases your MBD instance will be discarded and the container is trying to redeliver the message.

Please check the Exception chapter in the EJB 3 specifications.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic