• Stars
    star
    292
  • Rank 141,612 (Top 3 %)
  • Language
    JavaScript
  • Created about 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple AMQP / RabbitMQ job queues for node based on amqplib

Jackrabbit

Build Status NPM version

RabbitMQ in Node.js without hating life.

Simple Example

producer.js:

var jackrabbit = require('jackrabbit');
var rabbit = jackrabbit(process.env.RABBIT_URL);

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

consumer.js:

var jackrabbit = require('jackrabbit');
var rabbit = jackrabbit(process.env.RABBIT_URL);

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

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

Set arguments in queue

 
 rabbit
  .default()
  .queue({ name: 'hello', durable: true, arguments: {'x-expires':420000}  })
   

other arguments:

  • x-max-length
  • x-max-length-bytes
  • x-overflow
  • x-dead-letter-exchange
  • x-dead-letter-routing-key
  • x-max-priority
  • x-queue-mode
  • x-queue-master-locator
  • x-message-ttl

Ack/Nack Consumer Example

var jackrabbit = require('jackrabbit');
var 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
    // NOTE: this will requeue automatically
    nack();

    // or, if you want to nack without requeue:
    nack({
      requeue: false
    });
  })

Jackrabbit is designed for simplicity and an easy API. If you're an AMQP expert and want more power and flexibility, check out Rabbot.

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 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 run jackrabbit npm test

If using Docker-Machine on OSX:

$ docker-machine start
$ eval "$(docker-machine env default)"
$ docker-compose run jackrabbit npm test

Release

Releases should be tagged according to Semantic Versioning

Process:

  • Add release notes to releases.md
  • Commit add push the release notes git commit releases.md && git push origin master
  • Release it ./node_modules/release-it/bin/release-it.js

More Repositories

1

pbr

a Physically Based Renderer (PBR) in Go
Go
1,136
star
2

newton

A playful, particle-based physics engine designed from the ground up for JavaScript.
JavaScript
917
star
3

throng

A simple worker-manager for clustered Node.js apps
JavaScript
856
star
4

playfuljs-demos

680
star
5

awaiting

The async/await utility for browsers and Node.js.
JavaScript
674
star
6

playfuljs

www.playfuljs.com
CSS
520
star
7

stoppable

Node's `server.close` the way you expected it to work.
JavaScript
403
star
8

cryo

JSON on steroids.
JavaScript
157
star
9

oneweekend

Ray Tracing book series implemented in Golang, chapter-by-chapter
Go
153
star
10

notes

Notes about things.
147
star
11

knockout.namespaces

Namespaces plugin for KnockoutJS
JavaScript
57
star
12

pathtracer

A simple, naive path tracer in JavaScript
JavaScript
50
star
13

summarize

Node.js module to extract and summarize html content
JavaScript
41
star
14

pbr2

Go
38
star
15

component-test

An experiment to see what a simple node app would look like with "Components" from the @visionmedia blog
JavaScript
29
star
16

nodevember-14

JavaScript
28
star
17

heroku-node-errcodes

Examples of intentionally triggering various Heroku H* errors with Node.js
JavaScript
21
star
18

heroku-destroy-temp

Heroku CLI plugin to destroy temporary apps.
JavaScript
13
star
19

ludumstar

JavaScript
12
star
20

backbone.viewmodel

ViewModels with UI Bindings for Backbone (ala KnockoutJS, Flex, .NET, MVVM pattern)
JavaScript
7
star
21

dotfiles

personal dotfiles (steam deck dev machine)
Shell
7
star
22

itemize

A lazy, fluent web crawler for Node.js with a modern async/await API.
JavaScript
6
star
23

heroku-cli-node

A Heroku CLI plugin for Node.js app development
JavaScript
5
star
24

tetrinet

JavaScript
5
star
25

node-boilerplate

Structure for your node.js project
JavaScript
4
star
26

lanes

Simple, generic, sticky routing for clustered Node.js apps
JavaScript
4
star
27

server-jsx

Render react views on your node.js server
JavaScript
4
star
28

blit

2D Sprites that render to WebGL
JavaScript
4
star
29

cltjs-node

Node.js in 30 minutes
JavaScript
3
star
30

nko-quickstart

"Hello, world" with deployment instructions.
JavaScript
3
star
31

mongoose-file

Attach a file to a mongoose Schema
JavaScript
3
star
32

docker-plugin

JavaScript
3
star
33

babylonterrain

Testing babylonjs with terrain generation
JavaScript
3
star
34

music-city-game

Workshop for Music City Code 2019
JavaScript
3
star
35

storj

An attempt at the interesting Storj challenge
Go
2
star
36

blitzkrieg

Middleware to provide an authorized domain for blitz.io load testing in Node.js.
JavaScript
2
star
37

space-snake

Ludum Dare 38: A Small World
JavaScript
2
star
38

node-production

Running Node all the way from development to production on Heroku.
JavaScript
2
star
39

okay.js

A knockout knockoff
JavaScript
2
star
40

get-large-json

Test for getting large in-memory json objects
JavaScript
2
star
41

hunterloftis.com

Personal homepage
JavaScript
2
star
42

heroku-buildpack-sfdx

Shell
1
star
43

heroku-buildpack-empty

Quick example of a no-op buildpack
Shell
1
star
44

simplenode

A simple boilerplate for single-page node projects deployable on Ubuntu VPS.
JavaScript
1
star
45

heroku-node-template

Easily template new node projects with best practices for Heroku.
JavaScript
1
star
46

ld39

JavaScript
1
star
47

backpacksncats

Our blog
CSS
1
star
48

Quarry

JavaScript
1
star
49

node-dev-env

Dockerfile
1
star
50

arduino_wiimotionplus

Reading wii motionplus data with the arduino
C++
1
star
51

handoff

JavaScript
1
star
52

socket.io-chat-distributed

Socket.io chat scaled across multiple nodes, backed by redis
HTML
1
star
53

df-micro-web

JavaScript
1
star
54

deno-pointers

Testing out Deno with a little state
TypeScript
1
star
55

game-workshop

JavaScript
1
star
56

dogfight

JavaScript
1
star
57

mongoose-timestamps

A simple mongoose plugin for storing last created and last modified information
1
star
58

loopbusy

Node.js middleware to send 503s and keep your server alive when it's too busy to queue more requests.
JavaScript
1
star
59

processing_wiimotionplus

Renders position data sent over serial by the WMP Arduino code
Java
1
star