• This repository has been archived on 06/Nov/2019
  • Stars
    star
    185
  • Rank 208,271 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 7 years ago

Reviews

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

Repository Details

MongoDB-backed job queue for Node.js

monq

Monq is a MongoDB-backed job queue for Node.js.

NPM Build Status

API Reference

Usage

Connect to MongoDB by specifying a URI or providing host, port and database options:

var monq = require('monq');
var client = monq('mongodb://localhost:27017/monq_example');

Enqueue jobs by supplying a job name and a set of parameters. Below, the job reverse is being placed into the example queue:

var queue = client.queue('example');

queue.enqueue('reverse', { text: 'foobar' }, function (err, job) {
    console.log('enqueued:', job.data);
});

Create workers to process the jobs from one or more queues. The functions responsible for performing a job must be registered with each worker:

var worker = client.worker(['example']);

worker.register({
    reverse: function (params, callback) {
        try {
            var reversed = params.text.split('').reverse().join('');
            callback(null, reversed);
        } catch (err) {
            callback(err);
        }
    }
});

worker.start();

Events

Workers will emit various events while processing jobs:

worker.on('dequeued', function (data) { … });
worker.on('failed', function (data) { … });
worker.on('complete', function (data) { … });
worker.on('error', function (err) { … });

Install

npm install monq

Tests

npm test

You can optionally specify the MongoDB URI to be used for tests:

MONGODB_URI=mongodb://localhost:27017/monq_tests npm test

Updating API documentation

npm run jsdoc2md

More Repositories

1

dandelion

Incremental Git repository deployment.
Ruby
737
star
2

backbone.io

Backbone.js sync via Socket.IO
540
star
3

data.io

Bidirectional data syncing via Socket.IO
JavaScript
387
star
4

mubsub

Pub/sub for Node.js and MongoDB
JavaScript
310
star
5

backbone.viewkit

Backbone view management and transitions
JavaScript
214
star
6

queued

Simple HTTP-based queue server
Go
132
star
7

syphon

Immutable architecture for React/Flux applications
JavaScript
76
star
8

mongoose-acl

Mongoose ACL
JavaScript
61
star
9

jot

A mobile web app for your plain text notes
Clojure
34
star
10

bms

Battery management system for 4-series li-ion packs
C
34
star
11

cell-monitor

Battery cell monitor and balancer
C++
29
star
12

tree.js

JavaScript library for creating and manipulating hierarchical tree structures.
JavaScript
24
star
13

redblack.js

Red-black tree for Node.js and the browser
JavaScript
19
star
14

avr-twi

Nonblocking TWI/I2C master driver for Atmel AVR
C
18
star
15

cmcm

Cooperative multitasking for ARM Cortex-M microcontrollers
C
11
star
16

nettle

On-the-fly processing framework for Node.js and MongoDB
JavaScript
10
star
17

manacle.js

Lightweight ACL for Node.js and the browser
JavaScript
9
star
18

ina219

INA219 current/power monitor driver for Rust
Rust
5
star
19

pagoda

Reusable function stacks for Node.js and the browser
JavaScript
5
star
20

mongoose-denormalize

Bidirectional denormalization for your Mongoose models
JavaScript
5
star
21

emt

Express/Mongoose Toolkit
JavaScript
4
star
22

pack-monitor

Battery pack monitor
C++
4
star
23

blobstore

Content addressable blob store
Rust
4
star
24

cnc-tools

CNC tools for working with Gcode and Grbl
Python
3
star
25

require-hbt

An AMD loader plugin for Handlebars templates
JavaScript
3
star
26

broadcastd

Simple HTTP-based pubsub server
Go
3
star
27

modbus.cr

Modbus client library for Crystal
Crystal
2
star
28

gpio-socket

GPIO control via WebSocket
Clojure
2
star
29

stm32l0

Minimal development environment for STM32L0 using libopencm3
C
2
star
30

normal

Normalize nested data according to a relationship schema
Clojure
2
star
31

celeriac

State management for ClojureScript applications
Clojure
2
star
32

scthing

SuperCollider control interface for embedded devices
Rust
2
star
33

weedb

A wee database for Node.js built with LevelDB
JavaScript
2
star
34

routemachine

Stateful client-side router
JavaScript
2
star
35

node-queued

Queued client for Node.js
JavaScript
2
star
36

daffy

A minimal Scheme interpreter written in Python.
Python
2
star
37

splitd

Splits newline-separated HTTP response body into multiple HTTP requests
Go
2
star
38

peerpipe

An auto-discoverable, encrypted network pipe for P2P data transfer
Rust
1
star
39

raisin

A Python library for storing, retrieving and indexing JSON objects in MySQL.
Python
1
star
40

queued-ruby

Queued client for Ruby
Ruby
1
star
41

kite

Another lightweight Python web framework.
Python
1
star
42

terrain

Opinionated toolkit for building CRUD APIs with Rails
Ruby
1
star
43

earle

A URL pattern parser for Django.
Python
1
star
44

pytest-trace

Save OpenTelemetry spans generated during testing
Python
1
star
45

cello

An append-only B+ tree with multiversion concurrency control.
Scala
1
star
46

decibel

Networked audio player services
JavaScript
1
star
47

emacs.d

My Emacs config
Emacs Lisp
1
star
48

rfm69-gateway

RFM69 Linux gateway
C
1
star
49

webaudio

Experiments with the Web Audio API
JavaScript
1
star
50

pgque

PostgreSQL job queue extension using advisory locks
PLpgSQL
1
star