• 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

Exception handling for message-driven EJBs - best practices?

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I've got a MDB and I hear that if the MDB throws an exception in the onMessage() method, the JMS provider (WebSphere MQ 5.3) will go ahead and put the message back on the queue (and after a few retries, I think it goes to an error queue).

That's the behavior I want. If the above is true, then what's the best practice for throwing the exception? I can't change the throws clause on the method without getting compiler errors, unless it's a Runtime exception. So should I just throw a runtime exception? Or am I missing something?
 
Ranch Hand
Posts: 354
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if at all you have to, throw an EJBException from onMessage().
reply
    Bookmark Topic Watch Topic
  • New Topic