When using RabbitMQ, you're probably going to use the amqp-node library. It's good even though it really only has the bare minumum of functions you need for Rabbit connectivity.
The biggest gotcha of the all though is that this library, at least for some functions, uses a different callback pattern than standard node libraries, I'm suspecting it comes from the underlying Erlang implementation of RabbitMQ.
// standard node pattern
aLibrary.getStuff(function(err, result) {
if (err) {
console.log("Error!", err);
}
// do stuff here
}
// rabbit callback pattern
exchange.publish(function(hasError, err) {
// do stuff here
}
So if you are expecting the first parameter of the callback to be the error - you're going to have a bad time (it's going to be true if everything goes well).