activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <>
Subject [jira] Commented: (AMQ-2761) Uncaught exception in subscriber ends subscription
Date Mon, 09 Aug 2010 19:53:51 GMT


Timothy Bish commented on AMQ-2761:

Your client should be catching all exceptions in the onMessage method.

>From the JMS 1.1 spec...

4.5.2 Asynchronous Delivery

A client can register an object that implements the JMS MessageListener interface with a MessageConsumer.
As messages arrive for the consumer, the provider delivers them by calling the listener's
onMessage method.

It is possible for a listener to throw a RuntimeException; however, this is considered a client
programming error. Well-behaved listeners should catch such exceptions and attempt to divert
messages causing them to some form of application-specific 'unprocessable message' destination.

The result of a listener throwing a RuntimeException depends on the session's acknowledgment

    * AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE - the message will be immediately redelivered.
The number of times a JMS provider will redeliver the same message before giving up is provider-dependent.
The JMSRedelivered message header field will be set for a message redelivered under these
    * CLIENT_ACKNOWLEDGE - the next message for the listener is delivered. If a client wishes
to have the previous unacknowledged message redelivered, it must manually recover the session.
    * Transacted Session - the next message for the listener is delivered. The client can
either commit or roll back the session (in other words, a RuntimeException does not automatically
rollback the session).

JMS providers should flag clients with message listeners that are throwing RuntimeExceptions
as possibly malfunctioning.

> Uncaught exception in subscriber ends subscription
> --------------------------------------------------
>                 Key: AMQ-2761
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.3.0, 5.3.2
>            Reporter: ffffff ffffff
>             Fix For: 5.4.1
>         Attachments:
> We are seeing an issue with ActiveMQ Topic subscription when there is an uncaught exception.
> It appears to be related to an old report (but who knows) :

> Basically, what happens is our Consumer (onMessage) was throwing an NPE. After that happens,
the consumer no longer receives any more messages.
> Following it through in the debugger - when the exception is thrown, what we see is the
the "ActiveMQ Session Task" thread completes... 
> After that, it never seems to execute again. Seems some state in the PooledTaskRunner
gets borked? Investigating further - but at first glance it appears it thinks the connection
is shutting down...

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message