[rabbitmq-discuss] RECONDITION_FAILED - unknown delivery tag
Matthias Radestock
matthias at rabbitmq.com
Mon May 6 10:09:08 BST 2013
On 05/05/13 23:48, macmillan.josh09 at gmail.com wrote:
> My Node.js worker crashes (RECONDITION_FAILED - unknown delivery tag) if
> the following 2 conditions are met:
>
> 1. I start it AFTER the queue have at least 2 messages.
> 2. The q.shift() is in an async code.
>
> http://pastebin.com/uMQJn0Fe
Looking at the amqp.js code, q.shift() acknowledges the last message
that was received. So with your code...
> q.subscribe({ack:true, prefetchCount: 0}, function (message,
> headers, deliveryInfo) {
> console.log(message);
> setTimeout(function() { q.shift(); }, 100);
> });
> });
due to the delayed execution, when two messages arrive in quick
succession then the first to arrive won't be acknowledged at all and the
second will be acknowledged twice. Rabbit is complaining about the latter.
I've never used node-amqp, so I don't know what the correct approach is
for accomplishing what you want to do. You may want to ask the node-amqp
developers.
Matthias
More information about the rabbitmq-discuss
mailing list