disque-eventemitter
EventEmitter to simplify disque GETJOB
Features
- EventEmitter pattern for GETJOB
- job event emitted for each job
- Supports pause/resume of emitter
Installation
$ npm install disque-eventemitter --save
Usage
'use strict'; var DisqueEventEmitter = ; console;var de = host:'127.0.0.1' port: 7711 'test' concurrency: 2; de; de;
Documentation
new DisqueEventEmitter(disqueConfig, queueName, options)
Sets up the instance of disque to connect to and the queue to use
Arguments
disqueConfig
- Config hash that is passed straight through to disque. Example: {'host':'127.0.0.1', 'port': 7711}queueName
- Name of queue to get jobs fromoptions
- Optionsconcurrency
- Number of jobs to emit in parallel. Defaults to 1jobCount
- Number of jobs to get at once. Defaults to 1. If you get more than one job at a time all will be emitted and may exceed concurrency limit.withCounters
- Get jobs with counters showing nacks and additional deliveries
ack(job, callback)
Removes job from queue. If you don't ack a job it will keep reappearing in emitted events.
nack(job, callback)
Immediately returns job back to queue. Job will be re-emitted.
pause()
Pauses emitting jobs. Jobs may still be emitted from the previous scan operation.
resume()
Resumes a paused emitter.
job event
.on('job', function(job, done){})
When the job event is raised the callback receives two arguments: the job, and a completion callback. You must call the completion callback when done to prevent stalling the EventEmitter
People
The author is Chris Kinsman from PushSpring