Package Exports
- @pager/jackrabbit
- @pager/jackrabbit/lib/queue
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@pager/jackrabbit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Jackrabbit
RabbitMQ in Node.js without hating life.
Simple Example
producer.js:
var jackrabbit = require('jackrabbit');
var rabbit = jackrabbit(process.env.RABBIT_URL);
rabbit
.default()
.publish('Hello World!', { key: 'hello' })
.on('drain', rabbit.close);consumer.js:
var jackrabbit = require('jackrabbit');
var rabbit = jackrabbit(process.env.RABBIT_URL);
rabbit
.default()
.queue({ name: 'hello' })
.consume(onMessage, { noAck: true });
function onMessage(data) {
console.log('received:', data);
}Ack/Nack Consumer Example
var jackrabbit = require('jackrabbit');
var rabbit = jackrabbit(process.env.RABBIT_URL);
rabbit
.default()
.queue({ name: 'important_job' })
.consume(function(data, ack, nack, msg) {
// process data...
// and ACK on success
ack();
// or alternatively NACK on failure
nack();
})Jackrabbit is designed for simplicity and an easy API. If you're an AMQP expert and want more power and flexibility, check out wascally.
More Examples
For now, the best usage help is can be found in examples, which map 1-to-1 with the official RabbitMQ tutorials.
Installation
npm install --save jackrabbitTests
The tests are set up with Docker + Docker-Compose, so you don't need to install rabbitmq (or even node) to run them:
$ docker-compose up