[rabbitmq-discuss] What happens to messages delivered just before canceling consume?
Matthew Sackman
matthew at rabbitmq.com
Fri May 18 11:41:25 BST 2012
On Fri, May 18, 2012 at 11:31:00AM +0100, Emile Joubert wrote:
> >> Another option is to turn off prefetching (prefetch = 0).
> >
> > Um, doesn't that just mean you get a deluge of messages instead?
>
> Apologies, yes please ignore my incorrect advice. Using prefetch = 0
> will turn of prefetch limiting and not help at all. The simplest
> solution here is to use prefetch = 1 and cancel the subscription before
> acknowledging the final message.
However, unless you are on a network with 0 latency, a prefetch of 1
will guarantee your client sits around idle for at least some of the
time. If you follow the maths through on my recent blog post,
http://www.rabbitmq.com/blog/2012/05/11/some-queuing-theory-throughput-latency-and-bandwidth/
then you should be able to calculate a sensible prefetch figure (without
resorting to more exotic solutions like CoDel).
Then, after cancelling the consumer, keep hold of the cancelled consumer
tag (ctag) and if you see any deliveries appearing with that ctag, just
nack+requeue them immediately. There should not be more of them than
your prefetch setting.
Matthew
More information about the rabbitmq-discuss
mailing list