[rabbitmq-discuss] consumer cancel notify support in pika

Peter Friend pfriend at gehrytech.com
Wed Oct 31 21:03:18 GMT 2012


Here are the issues I've had so far with 0.9.6:

1. exchange_declare() type arg is now exchange_type
2. Ran into problems with RPC type calls. In 0.9.5 the docs for channel has:
               queue_declare(self, callback=None, ticket=0, queue='', passive=False, durable=False, exclusive=False, auto_delete=False, nowait=False, arguments={})
   and in 0.9.6:
               queue_declare(self, callback, queue, passive=False, durable=False, exclusive=False, auto_delete=False, nowait=False, arguments=None)

   The callback and queue args are required now so a line that used to be:
               result = channel.queue_declare(exclusive=True, auto_delete=True) should presumably now be:
               result = channel.queue_declare(callback=None, queue='', exclusive=True, auto_delete=True)
   However that results in this error:
               TypeError: queue_declare() got an unexpected keyword argument 'callback'

   This appears to be due to my use of BlockingConnection, so the code actually has to be:
               result = channel.queue_declare(queue='', exclusive=True, auto_delete=True)

   This is confusing if you are reading the docs for channel, and is a behavior change from 0.9.5.

Checking out the async consumer example now, thanks.

Peter





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.

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/cc6e1c7e/attachment.htm>


More information about the rabbitmq-discuss mailing list