Kind: global class
Param | Type | Description |
---|---|---|
uri | string |
MongoDB connection string |
options | Object |
connection options |
Returns a new Worker
Kind: instance method of Connection
Param | Type | Description |
---|---|---|
queues | Array.<string> | string |
list of queue names, a single queue name, or '*' for a universal worker |
options | Object |
an object with worker options |
Kind: global class
- Job
- new Job(collection, data)
- ~Attempts :
Object
Param | Type | Description |
---|---|---|
collection | string |
The collection to save the job to |
data | Object |
The Job data |
Job retry specification
Kind: inner typedef of Job
Properties
Name | Type | Description |
---|---|---|
strategy | string |
Name of Worker~strategyCallback to use on retry |
count | number |
total number of attempts so far |
delay | number |
a delay constant for use in determining a delay. In default linear strategy, this will be the delay between attempts |
Kind: global class
- Worker
- new Worker(queues, options)
- instance
- inner
- ~Options :
Object
- ~Callback :
function
- ~Strategies :
Object
- ~StrategyCallback ⇒
Number
- ~Options :
Param | Type | Description |
---|---|---|
queues | Array.<string> |
an array of queue names that this worker will listen for |
options | Options |
Options Options object |
Sets handlers to be invoked for each queue that the worker is listening to
Kind: instance method of Worker
Param | Type | Description |
---|---|---|
callbacks | Object |
map of Callback objects. Keys are the name of the queue, values are the handlers for those queues |
Starts the worker. If no queues have been specified yet, this will loop
Kind: instance method of Worker
Stops the worker
Kind: instance method of Worker
Adds a queue for the worker to listen on
Kind: instance method of Worker
Param | Type | Description |
---|---|---|
queue | string |
the name of the queue to add |
Options for a new worker
Kind: inner typedef of Worker
Properties
Name | Type | Description |
---|---|---|
interval | Number |
the polling interval for the worker. Note: The worker will process jobs, one at a time, as fast as possible while queues have waiting jobs |
strategies | Strategies |
Strategies for retrying jobs |
callbacks | Worker~Callbacks |
Map of Callback for processing jobs |
minPriority | Number |
The lowest job priority the worker will process |
Job handler functions should take this form
Kind: inner typedef of Worker
Param | Type | Description |
---|---|---|
params | Job.params |
Job.params object for the job to be processed |
callback | function |
NodeJS style callback to be invoked when job processing is finished |
A map of StrategyCallbacks
Kind: inner typedef of Worker
Kind: inner typedef of Worker
Returns: Number
- delay time
Param | Type | Description |
---|---|---|
attempts | Attempts |
Attempts object |