Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

RabbitMQ and node-amqp: Exchange in confirmed mode does not confirm - why?

RabbitMQ and node-amqp: Exchange in confirmed mode does not confirm - why?

Problem

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 :-)

Problem courtesy of: Golo Roden

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.

Solution courtesy of: Golo Roden

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

RabbitMQ and node-amqp: Exchange in confirmed mode does not confirm - why?

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×