[rabbitmq-discuss] consumer cancel notify support in pika

Gavin M. Roy gmr at meetme.com
Wed Oct 31 18:12:59 GMT 2012


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

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:

https://pika.readthedocs.org/en/latest/examples/asynchronous_consumer_example.html

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

Hope this helps,

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


More information about the rabbitmq-discuss mailing list