easy-amqp
Implements a wrapper around the node.js amqp module to provide more fluent and easy to use RabbitMQ support
Usage
Install via NPM
$ npm install easy-amqp
Overview
In amqp the example given to subscribe to a queue on the default topic exchange is:
var amqp = ;var connection = amqp; // Wait for connection to become established.connection;
With easy-amq, the same code can be written as:
;
Connection
To create a connection use the createConnection method on the module similar to amqp
var easyamqp = ; // Connections using an amqp URI are supportedeasyamqp; // Connections using options and implOptions like the amqp driver are supportedeasyamqp
Exchange
Create one or more exchanges on the connection object
conn // options from the amqp driver are supported // You must call publish or subscribe after this for the exchange(s) to be created
Queue
Create one or more queues on the connection object
conn ; // options from the amqp driver are supported // You must call subscribe after this for the queue(s) to be created
Binding
Calling bind will create a binding from the last referenced queue or exchange
conn ; // Create binding from my-queue to my-exchange // You must call subscribe after this for the bindings to be created
Subscribe
Calling this method will subscribe to the last referenced queue
conn ;
Publish
Calling this method will publish a message to the last referenced exchange
conn
Tests
To run the tests use
$ make test