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

question about MDB and JMS

 
Greenhorn
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 13.6.3.2 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.

(13.6.3.2 is only about REQUIRED CMT)

b) Also in 13.6.3.2 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,

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

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.

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