All Projects → pagerinc → jackrabbit

pagerinc / jackrabbit

Licence: other
Simple AMQP / RabbitMQ job queues for node based on amqplib

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to jackrabbit

Trymodule
➰ It's never been easier to try nodejs modules!
Stars: ✭ 1,115 (+3882.14%)
Mutual labels:  nodejs-modules
Json Node Normalizer
'json-node-normalizer' - NodeJS module that normalize json data types from json schema specifications.
Stars: ✭ 105 (+275%)
Mutual labels:  nodejs-modules
Openwrt Node Packages
OpenWrt Project Node.js packages. v10.x LTS and v12.x LTS and v14.x LTS
Stars: ✭ 176 (+528.57%)
Mutual labels:  nodejs-modules
Awesome Npm Packages
🚀 A collection of awesome npm packages for Noders.
Stars: ✭ 69 (+146.43%)
Mutual labels:  nodejs-modules
Node Lei Stream
Read/Write stream line by line 按行读写流
Stars: ✭ 94 (+235.71%)
Mutual labels:  nodejs-modules
Pm2 Slack
A PM2 module to emit events to Slack
Stars: ✭ 124 (+342.86%)
Mutual labels:  nodejs-modules
Nodemailer Examples
Nodemailer examples
Stars: ✭ 45 (+60.71%)
Mutual labels:  nodejs-modules
the-white-rabbit
The White Rabbit is an asynchronous RabbitMQ (AMQP) client based on Kotlin coroutines
Stars: ✭ 90 (+221.43%)
Mutual labels:  rabbitmq-client
Meetup Api
meetup-api is an Meetup.com API library written in JavaScript for Node.js V8 and Node.js ChakraCore
Stars: ✭ 104 (+271.43%)
Mutual labels:  nodejs-modules
Svg2vectordrawable
Node.js module and command-line tools for convert SVG to Android vector drawable.
Stars: ✭ 171 (+510.71%)
Mutual labels:  nodejs-modules
Listr2
NodeJS Task List derived from the best! Create beautiful CLI interfaces via easy and logical to implement task lists that feel alive and interactive.
Stars: ✭ 73 (+160.71%)
Mutual labels:  nodejs-modules
Leoric
👑 JavaScript ORM for MySQL, PostgreSQL, and SQLite.
Stars: ✭ 94 (+235.71%)
Mutual labels:  nodejs-modules
N26
💳 Un-official node.js module for interact with your N26 (previously Number26) account
Stars: ✭ 128 (+357.14%)
Mutual labels:  nodejs-modules
Node Ebml
EBML parser
Stars: ✭ 66 (+135.71%)
Mutual labels:  nodejs-modules
Kute.js
KUTE.js is a JavaScript animation engine for modern browsers.
Stars: ✭ 2,270 (+8007.14%)
Mutual labels:  nodejs-modules
Electron Progressbar
electron-progressbar provides an easy-to-use and highly customizable API to show and control progress bars on Electron applications.
Stars: ✭ 58 (+107.14%)
Mutual labels:  nodejs-modules
Tuya Mqtt
Nodejs-Script to combine tuyaapi and openhab via mqtt
Stars: ✭ 105 (+275%)
Mutual labels:  nodejs-modules
fs2-rabbit
🐰 RabbitMQ stream-based client built on top of Fs2
Stars: ✭ 143 (+410.71%)
Mutual labels:  rabbitmq-client
Building Testable Apis With Nodejs
Repositório oficial do livro: Construindo APIs testáveis com Node.js
Stars: ✭ 227 (+710.71%)
Mutual labels:  nodejs-modules
Inspirational Quotes
💡 A simple NPM Package which returns random Inspirational Quotes. Get your daily quote and stay motivated! ✌️ 🌸
Stars: ✭ 150 (+435.71%)
Mutual labels:  nodejs-modules

Jackrabbit

This is a fork of hunterloftis/jackrabbit.

CircleCI

Jackrabbit is a very opinionated abstraction built on top of amqplib focused on usability and implementing several messaging patterns on RabbitMQ.

Simple Example

// producer.js
'use strict';

const jackrabbit = require('@pager/jackrabbit');
const rabbit = jackrabbit(process.env.RABBIT_URL);

rabbit
  .default()
  .publish('Hello World!', { key: 'hello' })
  .on('drain', rabbit.close);
// consumer.js
'use strict';

const jackrabbit = require('@pager/jackrabbit');
const rabbit = jackrabbit(process.env.RABBIT_URL);

rabbit
  .default()
  .queue({ name: 'hello' })
  .consume(onMessage, { noAck: true });

function onMessage(data) {
  console.log('received:', data);
}

Ack/Nack Consumer Example

'use strict';

const jackrabbit = require('@pager/jackrabbit');
const rabbit = jackrabbit(process.env.RABBIT_URL);

rabbit
  .default()
  .queue({ name: 'important_job' })
  .consume(function(data, ack, nack, msg) {
    // process data...
    // and ACK on success
    ack();
    // or alternatively NACK on failure
    nack();
  })

More Examples

For now, the best usage help is can be found in examples, which map 1-to-1 with the official RabbitMQ tutorials.

Installation

npm install --save @pager/jackrabbit

Tests

The tests are set up with Docker + Docker-Compose, so you don't need to install rabbitmq (or even node) to run them:

$ docker-compose up

Reconnection

Jackrabbit is a wrapper for ampqlib, ampqlib does NOT support reconnection.

This project will try to recover a lost connection gracefully, if it fails to do so, we will throw an error event and then exit the current process with code 1.

Our approach to reconnection is recording all the exchanges and queues created through jackrabbit. Once a connection is lost, we will try to create a new one, update the existing exchange and queue references, initialize a new channel for each queue, and bind each queue's consumers to their new channel. This should be transparent to any users of this lib.

You can configure some basic parameters of the reconnection process with some env vars:

Name Default Description
RABBIT_RECONNECTION_TIMEOUT 2000 ms between each reconnection attempt. The first attempt will always be immediate.
RABBIT_RECONNECTION_RETRIES 20 Amount of retries before erroring out and killing the node process.
RABBIT_RECONNECTION_EXACT_TIMEOUT false To prevent total outages on HA services, we're adding a random overhead of 0-10% to the reconnection timeout by default. You can disable this behaviour by setting this option to true.
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].