co-mongomq
co wrapper for mongomq package.
Quickstart
const MongoMQ = ; const queue = ; queuestart; // monitoring processqueue; // emitting process queue;
Usage
Please refer to the documentation of MongoMQ.
Differences to MongoMQ
require('co-mongomq')
directly returns theMongoMQ
property (no need to use.MongoMQ
).new MongoMQ()
options do not supportautoStart
. Start manually..emit()
requires ayield
and returns as soon as the message was added to the database (or failed)..addListener()
(aka.on()
) takes a generator as handler which is run in a co context so you can useyield
..addListener()
(aka.on()
) does not have the third argument namednext
. It will be called implicitly unless the generator returns withfalse
(and onlyfalse
- not something falsey)..broadcast()
requires ayield
but does always return immediately since MongoMQ does not support a callback here. It's still asynchronous for forward compatibility.
Installation
$ npm install co-mongomq
Requirements
Node 0.11+, run with --harmony
flag.
License
MIT