[rabbitmq-discuss] dotnet client - Increasing prefetch with BasicQoS during HandleBasicDeliver doesn't trigger retrieval of next message

Simon MacMullen simon at rabbitmq.com
Mon May 12 10:08:23 BST 2014


On 11/05/2014 04:55, Jon Stelly wrote:
> I have a sort of odd scenario.  I want to process 1 message at a time so
> I call basic qos with a prefetch of 1 and call BasicConsume(), but
> sometimes my processing will end in a long blocking task.  When that
> happens, I would like to increase the qos prefetch to 2 to trigger the
> next message to be received and processed.  The issue is that I don't
> want to ack the first message until after the long blocking process
> completes successfully.
>
> If I call BasicQoS before acking the first message, the 2nd message
> isn't received until after the long running task completes and the ack
> is sent.  Can anyone explain what's going on and possibly suggest an
> alternative?

You are running 3.3.x? The new semantics for consumer prefetch mean that 
setting basicQos after consuming will only define a prefetch for *new* 
consumers. You could work around this by setting global=true.

See http://www.rabbitmq.com/consumer-prefetch.html for more information.

I am starting to wonder if the global=false qos should set the prefetch 
for all consumers on the channel; you wouldn't be able to have one 
channel with multiple consumers with different prefetch, but this is an 
area that seems to be unintuitive...

Cheers, Simon


More information about the rabbitmq-discuss mailing list