[rabbitmq-discuss] consumer cancel notify support in pika

Peter Friend pfriend at gehrytech.com
Wed Oct 31 22:01:29 GMT 2012


The cancel callback is being called when I use async methods, so it appears this is just an issue with BlockingConnection. Thanks!


From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Gavin M. Roy
Sent: Wednesday, October 31, 2012 11:13 AM
To: Discussions about RabbitMQ
Subject: Re: [rabbitmq-discuss] consumer cancel notify support in pika

On Wed, Oct 31, 2012 at 11:52 AM, Peter Friend <pfriend at gehrytech.com<mailto:pfriend at gehrytech.com>> wrote:
1) Which version are you using?

0.9.5 didn't pay as close attention to the protocol as 0.9.6 does. I'd recommend 0.9.6 at this point, especially for RPC calls from RabbitMQ.

The 0.9.6 version has method signature changes that make it incompatible with most of the docs out there and I had trouble getting it to work.

Hmm which methods changed that you're having problems with?  Also docs should be up to date at https://pika.readthedocs.org/<https://pika.readthedocs.org/en/0.9.6/index.html> -- let me know if you're having any problems with them.
3) Did you register for a callback? Channel.add_on_cancel_callback(your_callback_method)
I have tried when using BlockingConnection but not the asynchronous one yet. My understanding from the docs was that an exception would be thrown in consume(). Is that not correct?

The problem with BlockingConnection in 0.9.5 is it doesn't pay attention to what RabbitMQ is telling it to do, unless you explicitly tell it to do so. It's likely a bug related to that causing your issue.

Here is an async consumer example that uses 0.9.6 and handles Basic.Cancel being invoked by RabbitMQ:


In the blocking connection, you should see a pika.exceptions.ConsumerCancelled exception raised.

Hope this helps,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20121031/c365cdc6/attachment.htm>

More information about the rabbitmq-discuss mailing list