[rabbitmq-discuss] How to do blocking asynchronously with Pika? I want 1 message at a time and stop receiving until I'm ready again.

Matthias Radestock matthias at rabbitmq.com
Thu Feb 21 00:12:08 GMT 2013


Scott,

On 20/02/13 23:27, Scott Chapman wrote:
> After further exploring it appears that you do this:
> Using the BlockingConnection:
> Receive Message
> Run Handler to process message which can immediately ACK the message.
> When Handler returns, next message is received from RabbitMQ.
>
> Simpler!

The above won't stop rabbit from sending one or more messages to the 
client (depending on the basic.qos prefetch setting). While the app 
won't get to the see these messages until the Handler returns, the 
messages will still take up buffer space at the client or in the 
network, and they will be unavailable to other consumers on the same queue.

If that is not what you want then follow Michael's suggestion of 
cancelling the subscription. Or simply delay the ack until the app is 
ready to process the next message.

Regards,

Matthias.


More information about the rabbitmq-discuss mailing list