All Projects → dial-once → node-bunnymq

dial-once / node-bunnymq

Licence: MIT license
BunnyMQ is an amqp.node wrapper to ease common AMQP usages (RPC, pub/sub, channel/connection handling etc.).

Programming Languages

javascript
184084 projects - #8 most used programming language
Makefile
30231 projects
Smarty
1635 projects

Projects that are alternatives of or similar to node-bunnymq

Yii2 Rabbitmq
RabbitMQ Extension for Yii2
Stars: ✭ 52 (+160%)
Mutual labels:  amqp, consumer
amqpextra
Golang AMQP on steroids. Reliable connection. Publisher. Consumer.
Stars: ✭ 59 (+195%)
Mutual labels:  amqp, consumer
rejected
rejected is a consumer framework for RabbitMQ
Stars: ✭ 56 (+180%)
Mutual labels:  amqp, consumer
Rabbitmqbundle
RabbitMQ Bundle for the Symfony2 web framework
Stars: ✭ 1,125 (+5525%)
Mutual labels:  amqp, consumer
Aioamqp
AMQP implementation using asyncio
Stars: ✭ 244 (+1120%)
Mutual labels:  amqp
Tsung
Tsung is a high-performance benchmark framework for various protocols including HTTP, XMPP, LDAP, etc.
Stars: ✭ 2,185 (+10825%)
Mutual labels:  amqp
Qpid Proton
Mirror of Apache Qpid Proton
Stars: ✭ 164 (+720%)
Mutual labels:  amqp
Enqueue Dev
Message Queue, Job Queue, Broadcasting, WebSockets packages for PHP, Symfony, Laravel, Magento. DEVELOPMENT REPOSITORY - provided by Forma-Pro
Stars: ✭ 1,977 (+9785%)
Mutual labels:  amqp
amqpprox
An AMQP 0.9.1 proxy server, designed for use in front of an AMQP 0.9.1 compliant message queue broker such as RabbitMQ.
Stars: ✭ 51 (+155%)
Mutual labels:  amqp
the-white-rabbit
The White Rabbit is an asynchronous RabbitMQ (AMQP) client based on Kotlin coroutines
Stars: ✭ 90 (+350%)
Mutual labels:  amqp
Azure Event Hubs
☁️ Cloud-scale telemetry ingestion from any stream of data with Azure Event Hubs
Stars: ✭ 233 (+1065%)
Mutual labels:  amqp
Librabbitmq
Python bindings to librabbitmq-c
Stars: ✭ 181 (+805%)
Mutual labels:  amqp
Py Amqp
amqplib fork
Stars: ✭ 252 (+1160%)
Mutual labels:  amqp
Rabtap
RabbitMQ wire tap and swiss army knife
Stars: ✭ 171 (+755%)
Mutual labels:  amqp
fs2-rabbit
🐰 RabbitMQ stream-based client built on top of Fs2
Stars: ✭ 143 (+615%)
Mutual labels:  amqp
Cony
Simple AMQP wrapper around github.com/streadway/amqp
Stars: ✭ 158 (+690%)
Mutual labels:  amqp
Enqueue Bundle
[READ-ONLY] Message queue bundle for Symfony. RabbitMQ, Amazon SQS, Redis, Service bus, Async events, RPC over MQ and a lot more
Stars: ✭ 233 (+1065%)
Mutual labels:  amqp
dispatcher
Dispatcher is an asynchronous task queue/job queue based on distributed message passing.
Stars: ✭ 60 (+200%)
Mutual labels:  amqp
Akka Rabbitmq
RabbitMq client in Scala and Akka actors
Stars: ✭ 228 (+1040%)
Mutual labels:  amqp
Gosiris
An actor framework for Go
Stars: ✭ 222 (+1010%)
Mutual labels:  amqp

node-bunnymq

Circle CI npm npm Sonar Sonar Sonar Sonar Sonar Sonar

npm

Features

  • Subscriber (consumer)
  • Publisher (producer)
  • RPC (get answers from subscriber automatically)
  • Auto connect/reconnect/queue messages
  • Handle errors / requeing when message callback fails
  • Messages types caring using AMQP headers for content type (send as objects and receive as objects)

Installation

bunnymq requires nodejs 6 or harmony flags! because it uses es6 features outside strict mode.

npm install bunnymq

Basic usage

Publisher

Producer (publisher), can send messages to a named queue.

const bunnymq = require('bunnymq')({ host: 'amqp://localhost' });
bunnymq.publish('queue:name', 'Hello World!');

Subscriber

Consumer (subscriber), can handle messages from a named queue.

const bunnymq = require('bunnymq')({ host: 'amqp://localhost' });

bunnymq.subscribe('queue:name', function (msg) {
  //msg is the exact item sent by a producer as payload
  //if it is an object, it is already parsed as object
});

RPC Support

You can create RPC requests easily by adding the rpc: true option to the produce call:

bunnymq.subscribe('queue:name', function() {
  return 'hello world!'; //you can also return a promise if you want to do async stuff
});

bunnymq.publish('queue:name', { message: 'content' }, { rpc: true, timeout: 1000 })
.then(function(consumerResponse) {
  console.log(consumerResponse); // prints hello world!
});

The optional timeout option results in a rejection when no answer has been received after the given amount of milliseconds. When '0' is given, there will be no timeout for this call. This value will overwrite the default timeout set in the config in rpcTimeout.

Routing keys

You can send publish commands with routing keys (thanks to @nekrasoft)

bunnymq.publish('queue:name', { message: 'content' }, { routingKey: 'my-routing-key' });

Config

You can specify a config object, properties and default values are:

  const bunnymq = require('bunnymq')({
    host: 'amqp://localhost',
    //number of fetched messages at once on the channel
    prefetch: 5,
    //requeue put back message into the broker if consumer crashes/trigger exception
    requeue: true,
    //time between two reconnect (ms)
    timeout: 1000,
    //default timeout for RPC calls. If set to '0' there will be none.
    rpcTimeout: 1000,
    consumerSuffix: '',
    //generate a hostname so we can track this connection on the broker (rabbitmq management plugin)
    hostname: process.env.HOSTNAME || process.env.USER || uuid.v4(),
    //the transport to use to debug. if provided, bunnymq will show some logs
    transport: utils.emptyLogger
  });

You can override any or no of the property above.

Note: if you enable the debug mode using the AMQP_DEBUG=true env var, but you do not attach any transport logger, the module will fallback to console.

Env vars

Deprecated as of 2.1.0, don't use env vars to configure the module, see Config section.

Documentation & resources

To generate documentation, just run npm run docs, it will create a docs folder.

You can also find more about RabbitMq in the links below:

Tests

Requirements:

  • docker
  • npm
  • make

Run make deps once and then make test to launch the test suite.

License

The MIT License MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].