[rabbitmq-discuss] Issue related to message consumption

Tony Garnock-Jones tonyg at lshift.net
Fri Jul 17 14:03:40 BST 2009


Anand Ved wrote:
> However, during consumption, I face an exception (say NullPointer) which
> although I am catching it, traveses up to the Connection triggering it
> to be closed.

It's very strange that it keeps on travelling up even though it's being
caught!

> Please suggest if there is a better way of managing this.

Is it possible for you to switch to using QueueingConsumer instead?

>From the javadoc comment for interface Consumer:

" * Note: all methods of this interface are invoked inside the {@link
 * Connection}'s thread. This means they a) should be non-blocking and
 * generally do little work, b) must not call {@link Channel} or
 * {@link Connection} methods, or a deadlock will ensue. One way of
 * ensuring this is to use/subclass {@link QueueingConsumer}."

We recommend using QueueingConsumer if possible, to avoid issues like
that you've run in to.

Regards,
  Tony
-- 
 [][][] Tony Garnock-Jones     | Mob: +44 (0)7905 974 211
   [][] LShift Ltd             | Tel: +44 (0)20 7729 7060
 []  [] http://www.lshift.net/ | Email: tonyg at lshift.net




More information about the rabbitmq-discuss mailing list