Skip to content
Abstractions around RabbitMQ
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo V2 (#129) Feb 16, 2018
docs fix: (#104) improve poison message handling Feb 18, 2018
spec tests: correct wild card type handling integration test approach for … Feb 18, 2018
src fix: remove remaining lodash references in core that got missed Feb 18, 2018
.editorconfig addresses issues #38, #37, #36 and #19 Sep 6, 2016
.gitignore
.npmignore Added .vagrant to npmignore Dec 12, 2015
.travis.yml build: update run scripts for Docker Feb 18, 2018
ACKNOWLEDGEMENTS.md V2 (#129) Feb 16, 2018
CHANGELOG.md chore(release): 2.1.0 Feb 18, 2018
CODE_OF_CONDUCT.md V2 (#129) Feb 16, 2018
CONTRIBUTORS.md V2 (#129) Feb 16, 2018
Dockerfile
HOW_TO_CONTRIBUTE.md build: update run scripts for Docker Feb 18, 2018
LICENSE Handle consumer cancellation more explicitly Jun 4, 2016
MAINTAINERS.md V2 (#129) Feb 16, 2018
README.md docs: update doc structure - split into multiple documents Feb 17, 2018
RESOURCES.md V2 (#129) Feb 16, 2018
package.json chore(release): 2.1.0 Feb 18, 2018

README.md

rabbot

Build Status Coverage Status Version npm npm Downloads Dependencies

This is a very opinionated abstraction over amqplib to help simplify the implementation of several messaging patterns on RabbitMQ.

!Important! - successful use of this library will require a conceptual knowledge of AMQP and an understanding of RabbitMQ.

Features:

  • Attempt to gracefully handle lost connections and channels
  • Automatically re-assert all topology on re-connection
  • Support the majority of RabbitMQ's extensions
  • Handle batching of acknowledgements and rejections
  • Topology & configuration via JSON (thanks to @JohnDMathis!)
  • Built-in support for JSON, binary and text message bodies
  • Support for custom serialization

Assumptions & Defaults:

  • Fault-tolerance/resilience over throughput
  • Prefer "at least once delivery"
  • Default to publish confirmation
  • Default to ack mode on consumers
  • Heterogenous services that include statically typed languages
  • JSON as the default serialization provider for object based message bodies

Documentation You Should Read

Other Documents

Demos

API Example

This contrived example is here to make it easy to see what the API looks like now that documentation is broken up across multiple pages.

const rabbit = require('rabbot');

rabbot.handle('MyMessage', (msg) => {
  console.log('received msg', msg.body);
  msg.ack();
});

rabbot.handle('MyRequest', (req) => {
  req.reply('yes?');
});

rabbot.configure({
  connection: {
    name: 'default',
    user: 'guest',
    pass: 'guest',
    host: 'my-rabbot-server',
    port: 5672,
    vhost: '%2f',
    replyQueue: 'customReplyQueue'
  },
  exchanges: [
    { name: 'ex.1', type: 'fanout', autoDelete: true }
  ],
  queues: [
    { name: 'q.1', autoDelete: true, subscribe: true },
  ],
  bindings: [
    { exchange: 'ex.1', target: 'q.1', keys: [] }
  ]
}).then(
  () => console.log('connected!');
);

rabbot.request('ex.1', { type: 'MyRequest' })
  .then(
    reply => {
      console.log('got response:', reply.body);
      reply.ack();
    }
  );

rabbot.publish('ex.1', { type: 'MyMessage', body: 'hello!' });


setTimeout(() => {
  rabbot.shutdown(true)
},5000);

Roadmap

  • improve support RabbitMQ backpressure mechanisms
  • add support for Rabbit's HTTP API
You can’t perform that action at this time.