A simple messaging processor for AMQP
npm install peleg --save
var peleg = require('peleg'),
Promise = require('bluebird');
peleg.connect().then(function() {
peleg.queue("notification:send").publish({message: "Hello World!"});
peleg.queue("notification:send").process(function(data) {
console.log("Received", data.message);
return Promise.resolve();
})
});
-
Support two connections: Publish connection, and process connection.
-
Peleg RPC:
peleg.call('calculator.add', 1, 2).then(function(sum) { console.log(sum); });
peleg.service('calculator.add').process(function(data) { return data[0] + data[1]});