[rabbitmq-discuss] Consumers and exceptions
steve at rabbitmq.com
Tue Feb 21 17:41:07 GMT 2012
I can't see Consumer Exceptions discussed in that thread, but in any case: if a
Consumer callback throws an Exception, it is caught (on the Consumer callback
thread) and passed to the connection's ExceptionHandler
This setting is not exposed on the newConnection() call but is accessible on
one of the low-level, public AMQConnection() constructors. It is a final
By default this is set to the DefaultExceptionHandler, which implements methods:
handleUnexpectedConnectionDriverException -- and is a no-op
each of which kills the connection.
The basic idea is that Consumer callbacks and Listeners should NOT throw
exceptions except in the direst of circumstances.
The connection.close() ought to drive the ShutdownListeners for the connection
and for any open channels on that connection, but there was a bug in this area
(which is fixed and will be in the next release).
It is entirely possible that Consumers will continue to be called (there may be
consumer callbacks queued up), and the last call should be handleCancel().
But the connection and all its channels will need to be recreated to continue.
Does this help?
Steve Powell (a happy bunny)
----------some more definitions from the SPD----------
vermin (v.) Treating the dachshund for roundworm.
chinchilla (n.) Cooling device for the lower jaw.
socialcast (n.) Someone to whom everyone is speaking but nobody likes.
On 19 Feb 2012, at 18:01, Jon Hill wrote:
> I've just been reading this post:
> It tells me that if an Exception is thrown from a Consumer the
> expected behaviour is to close the connection (my shutdown listener
> doesn't kick in when this occurs either).
> So, should I return immediately once the consumption has finished and
> handle the application layer processing of the messages in a separate
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
More information about the rabbitmq-discuss