module:jobs
- Description:
Job queue processor
When launched with
jobs-workersparameter equal or greater than 0, the server spawns a number of workers which subscribe to configured job queues or the default queue and listen for messages.A job message is an object that defines what method from which module to run with the options as the first argument and a callback as the second.
Multiple job queues can be defined and processed at the same time.
By default
localandworkerqueues are always created and ready to be used, jobs sent to local always run inside the local process but jobs sent to worker queue will be run in a worker.A job can be in the following formats:
"module.method"{ job: { "module.method": {}, .... } }any task in string format "module.method" will be converted into { "module.method: {} } automatically
Methods
(static) submitJob(jobspec, optionsopt, {int{})
- Description:
Submit a job for execution, it will be saved in a queue and will be picked up later and executed. The queue and the way how it will be executed depends on the configured queue. See
isJobfor the format of the job objects.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jobspec |
object | an object with jobs to run |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
object |
<optional> |
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{int{} |
[options.endTime] - job must not start after this date |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options.delay |
int |
<optional> |
is only supported by SQS currently, it delays the job execution for the specified amount of ms |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options.dedup_ttl |
int |
<optional> |
if set it defines number of ms to keep track of duplicate messages, it tries to preserver only-once behaviour. To make
some queue to automatically use dedup mode it can be set in the queue options: |