Simplified rabbitmq events.
npm install rabbitmq-eventemitter
The returned instance exposes a
pull method for receiving and a
push method for sending events.
var rabbitmq = ;var queue = ;queue;queue;
Call the provided
push to acknowledge the message and remove it from the queue. If the
callback is called with an error object as first argument the message is inserted back into the queue.
It's also possible to delay message delivery using the
namespace option allows you to control how messages are distributed between consumers. Only one consumer within the same namespace will receive a published message, even though there are others consumers listening on the same event name, this works well for worker queues, where you would have multiple processes receiving messages to be executed. Using different namespaces will on the other hand result in every consumer listening on the same event name to receive the message, which is usefull for a publish-subscribe setup.
var workerQueue_1 = ;var workerQueue_2 = ;var publishQueue = ; // namespace not needed when publishing// Only one of the handlers is calledworkerQueue_1;workerQueue_2;publishQueue;
var pubsubQueue_1 = ;var pubsubQueue_2 = ;var publishQueue = ; // namespace not needed when publishing// Both handlers called.pubsubQueue_1;pubsubQueue_2;publishQueue;
If no namespace is provided, it defaults to a random string.