/peleg

Peleg - A simple messaging processor for AMQP

Primary LanguageJavaScriptMIT LicenseMIT

Peleg

A simple messaging processor for AMQP

npm package build status dependency status

Installation

npm install peleg --save

How to use

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();
   })
});

Samples

Basic sample

Multiple queue bindings

Advanced sample

Roadmap

  • 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]});