[rabbitmq-discuss] 3.3.0: How to achieve channel.flow(0) with basic.qos?

Simon MacMullen simon at rabbitmq.com
Mon May 12 14:36:50 BST 2014


On 07/05/2014 17:58, mrogan wrote:
> Support for channel.flow(bit active) was removed in RabbitMq 3.3.0 (
> changelog <https://www.rabbitmq.com/release-notes/README-3.3.0.txt>  ). I
> was using it to suspend flow on a channel when initially consuming a queue
> with basic.consume. The reason is that I need to determine if I am the
> exclusive consumer of that queue and perform business logic before starting
> to receive already pending messages.
>
> I read that "basic.qos is superior in all cases" but I don't see how to
> completely suspend the flow by setting the prefetch-count. If I set the
> prefetch-count to zero then then it is effectively unlimited. This is not
> the same as channel.flow(0)!

This is true.

> I can work around this by buffering messages until I can perform my business
> logic after the (successful) basic.consume. But this would seem to be
> reimplementing the channel.flow that has disappeared!

You can set the basic.qos to 1 before consuming; that way you only have 
to buffer one message.

If that doesn't appeal you could also have your clients agree on the 
name of a queue to use as a mutex; exclusively declaring that queue 
could be taken as proving that the exclusive consume operation will 
succeed, and you could perform the business logic between declaring and 
consuming.

Cheers, Simon


More information about the rabbitmq-discuss mailing list