What is an honest MessageListener to do?

According to the Javadoc for the JMS MessageConsumer interface

It is a client programming error for a MessageListener to throw an exception.

Now, what if you’re processing a JMS message asynchronously using a MessageListener and something goes wrong?  What is an honest MessageListener to do?

Looking at the Spring documentation, it looks like there are answers for this kind of thing… It just hasn’t sunk in for me what they are yet.

Advertisements

,

  1. #1 by Jonathan Branam on June 30, 2008 - 7:44 am

    Not sure if this is just an example of the Spring guys not following the “rule” in their example… But the exceptions they through are both RuntimeExceptions – unchecked and indicating a fatal error. They even catch the JMSException and throw a RuntimeException instead. There seems to be a purpose for that, if only because onMessage doesn’t declare that it throws any exceptions.

    I was thinking maybe there’s an error reporting facility tied to the Message class, but I didn’t see anything in the javadoc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s