0

I'm using a send.js using amqplib:

var rabbitMQ = require('amqplib');

rabbitMQ.connect('amqp://localhost').then(function(connection) {
  connection.createConfirmChannel().then(function(channel){
    channel.assertQueue('testQ').then(function(queue){

      channel.sendToQueue('testQ', new Buffer('foobar'), {}, function(err, ok){
        console.log(err?'nacked':'acked');
        connection.close();
      });

    }, console.warn);
  }, console.warn);
}, console.warn);

and a receive.js using amqp:

var amqp = require('amqp');
var connection = amqp.createConnection({ host: 'localhost' });

// Wait for connection to become established.
connection.on('ready', function () {
  connection.queue('testQ', function (q) {
    q.bind('#');
    q.subscribe(console.log);
  });
});

connection.on('error', console.log);

The problem is, the default options for queues don't match. I get a 406 precondition failed error while either trying to read with amqp after sending with amqplib or while sending with amqplib after having subscribed with amqp. I'd be happy aligning on either configuration, as long as it works.

Renaud
  • 4,569
  • 7
  • 41
  • 72

1 Answers1

2

Using amqplib on both ends solved the issue.

Renaud
  • 4,569
  • 7
  • 41
  • 72