[rabbitmq-discuss] suspending and resuming a QueueingConsumer

Jim Irrer irrer at umich.edu
Wed Jan 13 19:06:57 GMT 2010


Hi -

I have several consumers reading from the same queue.  I would like
to be able to interrupt their pending read to suspend and resume any
one of them.   I've played around with:

Channel.basicCancel(consumerTag) : don't know how to resume
Channel.abort()    produces com.rabbitmq.client.ShutdownSignalException
Channel.close()   produces com.rabbitmq.client.ShutdownSignalException

The close() and abort() methods seem to act about the same.  I can resume
reading from the queue by creating a new channel and a new QueueingConsumer.
I could not figure out how to resume after a basicCancel.

Is using close() and then re-constructing the channel and QueueingConsumer
the right way to go?  Will resources be properly taken care of by garbage
collection?

BTW - I use the consumerTag returned by Channel.basicConsume(queueName,
consumer)
for the argument to Channel.basicCancel, eg: *
amq.ctag-1m/H7+SDcZpbzTMgsUyhNg==* .
When called, it prints:

Consumer null method handleCancelOk for channel AMQChannel(amqp://
guest at 172.20.125.34:5672/,1) threw an exception:
java.lang.NullPointerException
    at com.rabbitmq.client.impl.ChannelN$2.transformReply(ChannelN.java:728)
    at com.rabbitmq.client.impl.ChannelN$2.transformReply(ChannelN.java:721)
    at
com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.handleCommand(AMQChannel.java:327)
    at
com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:162)
    at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:110)
    at
com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:456)

Thanks for any hints,

- Jim

Jim Irrer     irrer at umich.edu       (734) 647-4409
University of Michigan Hospital Radiation Oncology
519 W. William St.             Ann Arbor, MI 48103
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100113/bc92bfc8/attachment.htm 


More information about the rabbitmq-discuss mailing list