connect-amqp
v0.0.1
Published
Wrapper around amqplib to easily call RPC trhough RabbitMQ
Downloads
3
Readme
amqp-connect
amqplib wrapper to easily connect to RPC services through RabbitMQ server.
Example
var connectAMQP = require('./connect-amqp');
exports.handler = function (event, context) {
var doTheJob = function(connection) {
var err, res;
connection.send(event.queueName, event.data)
.then(function(result) {
res = result;
})
.catch(function(error) {
err = error;
})
.ensure(function() {
//Always close the connection!
connection.close();
context.done(err, res);
});
};
connectAMQP(event.amqpURI)
.then(doTheJob)
.catch(function(e) {
context.fail(e);
});
};
Testing & developing
To run the test, first install all the dependencies with:
npm install
After, you can run
npm run test
To run all the tests. You can also run:
npm run watch
In order to run the test continuosly.
Travis build
Any commit to master will result on delpoying the new version to NPM Registry.