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

One thought on “What is an honest MessageListener to do?

  1. 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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.