rabbitmq-eventemitter-mock
v1.2.0
Published
Mock for rabbitmq-eventemitter
Downloads
41
Readme
rabbitmq-eventemitter-mock
Mock for rabbitmq-eventemitter.
npm install rabbitmq-eventemitter-mock
Usage
The module supports the same interface as rabbitmq-eventemitter
. It has an additional connection
property associated with each queue instance, which represents the remote subscriber or publisher.
var rabbitmq = require('rabbitmq-eventemitter-mock');
var queue = rabbitmq();
queue.pull('event', function(message, callback) {
console.log(message);
callback();
});
queue.connection.push('event', 'hello', function(err) {
if(err) throw err;
});
The provided function to queue.connection.push
is called after all listeners registered with queue.pull
have called the callback.
The module can be used together with mockery.
var mockery = require('mockery');
mockery.registerSubstitute('rabbitmq-eventemitter', 'rabbitmq-eventemitter-mock');
mockery.enable();