[rabbitmq-discuss] RECONDITION_FAILED - unknown delivery tag

josh orengolan at gmail.com
Sat May 18 01:51:33 BST 2013


Thanks Matthias and Calvin, I solved it thanks to you guys.

I made 2 changes:
instead of queue.shift() I use message.acknowledge(false)
I changed  prefetchCount: 0 to 100.

Now it's working as expected. I have made another change, instead of
connection.publish I use exchange.publish but this is not related to the
issue I have. I just feels it's better to use the exchange.
Here is the working code, for anyone else using node-amqp:

var amqp = require('amqp');

var connection = null;
var exchange = null;

connection = amqp.createConnection({ host: 'foo.com' });

connection.on('ready', function () {
  exchange = connection.exchange('main', {type: 'topic', durable: 'true',
autodelete: 'false'}, function (exchange) {
    console.log('Exchange ' + exchange.name + ' is open');
    listen();
  });
});

function listen() {
  connection.queue('queue-a', { durable: true, autoDelete: false},
function(q) {
    q.bind('main', 'queue-a');
    q.subscribe({ack:true, prefetchCount: 100}, function (payload, headers,
deliveryInfo, message) {
      console.log(payload);
      setTimeout(function() { 
        exchange.publish('routing.key.for.some.queue', payload, {
deliveryMode: 2 });
        message.acknowledge(false);
      }, 100);
    });
  });
};




--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/RECONDITION-FAILED-unknown-delivery-tag-tp26442p26811.html
Sent from the RabbitMQ mailing list archive at Nabble.com.


More information about the rabbitmq-discuss mailing list