gleipnir
Convenience wrapper for amqp.node.
Installation
npm install --save gleipnir
Features
- Attempts to reconnect a certain number of times before giving up (configurable)
- Logs initialization events to help find issues
- Automatically asserts given queues, exchanges and bindings before triggering callback
Usage
var gleipnir = ; // Connect to AMQPvar url = 'amqp://user:pass@somehost:1337/';var client = ;
Asserting queues, exchanges and bindings
One of the most useful features of gleipnir is automatic asserting and binding. Just specify an object of the queues, exchanges and bindings and gleipnir will make sure they exist, or call back with an error.
var gleipnir = ; var options = url: 'amqp://user:pass@somehost:1337/' assert: queues: // If only a name is given, default options are used for it 'topic-q' // To specify options: name: 'some-queue' options: durable: true // Here's how to bind an anonymous queue to an exchange: binding: exchange: 'some-ex' options: autoDelete: true exchanges: // If only a name is given, `fanout` will be used as type, 'some-ex' // To specify options: name: 'some-other-ex' type: 'topic' options: durable: false bindings: queue: 'some-queue' exchange: 'some-ex' queue: 'topic-q' exchange: 'some-other-ex' pattern: 'food' ; var client = ;
Other modules
- gleipnir-publish - publishes messages
- gleipnir-assert - used internally for the assertion bits
License
MIT-licensed. See LICENSE
.