RabbitMQ / AMQP raw channel error - NOT_FOUND

I am trying to post messages to RabbitMQ, with a Ruby script (using Bunny ) and consume them from node.js server (using node-amqp ).

The first message arrives successfully, but then the error is logged inside node.js, and the connection is closed, and further messages are not accepted:

mu:charlie-node tom$ node charlie.js 
22 Jul 09:11:04 - Running in development environment.
22 Jul 09:11:04 - Connected to AMQP.
22 Jul 09:11:04 - {"build_id":1234}
Unhandled channel error: NOT_FOUND - unknown delivery tag 1

If I post two messages in the exchange and then start the node.js server, I see that they both arrive before the error is registered, which tells me that RabbitMQ closes the exchange or the queue when it is empty, However, since I have installed if autoDelete is false, then it should not be.

Any suggestions?

My node.js script looks something like this:

var amqpConnection = amqp.createConnection({ host: config.rabbitmq.host });

amqpConnection.addListener('ready', function() {
  sys.log("Connected to AMQP.");

  var exchange = amqpConnection.exchange('job_exchange', {
    type : 'topic',
    passive : false,
    durable : true, 
    autoDelete : false
  })

  exchange.addListener('open', function() {

    var queue = amqpConnection.queue('arthr_queue', {
      passive : false,
      autoDelete : false,
      durable : true,
      exclusive : false
    });

    queue.bind(exchange, '#');

    queue.subscribe(function(message) {
      sys.log(message.data.toString());
    });
  });
});

And my Ruby script looks like this:

require 'rubygems'
require 'bunny'
require 'json'

b = Bunny.new(:logging => true)

b.start

job_exchange = b.exchange('job_exchange', 
  :type => :topic, 
  :durable => true, 
  :auto_delete => false, 
  :passive => false
)

message = {
  :build_id => 1234
}

job_exchange.publish(message.to_json, :key => 'arthr.rebuild')

b.stop
+3
1

, node -amqp. , options.ack false.

amqp 0.8 , , noAck.

RabbitMQ 1.8.1. , .

(http://github.com/spahl/node-amqp), . , "amq.topic" .

+1

Source: https://habr.com/ru/post/1755930/


All Articles