Question

I am writing a Node.js application that relies on RabbitMQ. I'm using node-amqp as the library of choice to connect to RabbitMQ.

Once I have established a connection to RabbitMQ, first thing I am going to do is to create an exchange:

var options = { autoDelete: false, confirm: true, durable: true, type: 'direct' };
connection.exchange('myExchange', options, function (myExchange) {
  // ...
});

This works perfectly. As you can see, I am creating the exchange using confirm: true, hence I expect the exchange to be in confirm mode afterwards.

Now a problem appears once I try to publish a message:

var options = {};
myExchange.publish('', { data: 'foobar' }, options, function () {
  // ...
});

The problem is that the callback of the publish function is never called - although the message was successfully published (as I can see within RabbitMQ's web management tool).

Did I understand confirm mode in a wrong way? Is this a bug with node-amqp?

Any help would be appreciated :-)

Was it helpful?

Solution

Question answered in the appropriate GitHub issue: node-amqp on npm is an old version ... current workaround is to use the master branch from GitHub directly.

This means, use https://github.com/postwait/node-amqp/tarball/master when installing using npm.


Update November 2013

As I was using RabbitMQ again these days (about one year after my original question), I thought it might be a good idea to give an update on the status quo of node-amqp.

Unfortunately the state of node-amqp is exactly the same as a year ago: The published version from npm is hardly usable. Some of the bugs I encountered a year ago are still there (including the one from my question), so the given workaround is still valid: Get the latest master from GitHub.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top