antenna-amqp
This module provides an AMQP 0-9-1 adapter for
Antenna. AMQP 0-9-1 is implemented by
popular messages brokers such as RabbitMQ.
Install
$ npm install antenna-amqp
Usage
Connect to Message Bus
var amqp = require('antenna-amqp');
var bus = new amqp.Bus();
bus.connect({ host: 'localhost', port: 5672 }, function() {
console.log('connected!');
});
Dispatch Messages to Application
var antenna = require('antenna');
var app = antenna();
bus.on('message', app);
bus.subscribe('events/on', function(err) {
if (err) { throw err; }
console.log('subscribed to topic!');
});
Publish Messages
bus.publish('events/on', { time: Date.now() }, function(err) {
if (err) { throw err; }
console.log('published message!');
});
Tests
$ npm install
$ make test
Credits
License
The MIT License
Copyright (c) 2014 Jared Hanson <http://jaredhanson.net/>