• Post Reply Bookmark Topic Watch Topic
  • New Topic

question about MDB and JMS

Michael Maier
Posts: 12
  • Mark post as helpful
  • send pies
  • 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,

Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • 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.

my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!