The name of the Job
The payload for this job.
The options object for this job.
Optional
id: stringNumber of attempts after the job has failed.
Number of attempts when job is moved to active.
The payload for this job.
Optional
debounceDebounce identifier.
Optional
deduplicationDeduplication identifier.
Deferred failure. Stores a failed message and marks this job to be failed directly as soon as the job is picked up by a worker, and using this string as the failed reason.
An amount of milliseconds to wait until this job can be processed.
Reason for failing.
Optional
finishedTimestamp for when the job finished (completed or failed).
Optional
idThe name of the Job
Optional
nextProduced next repetable job Id.
The options object for this job.
Optional
parentObject that contains parentId (id) and parent queueKey.
Optional
parentFully qualified key (including the queue prefix) pointing to the parent of this job.
Ranges from 0 (highest priority) to 2 097 152 (lowest priority). Note that using priorities has a slight impact on performance, so do not use it if not required.
Optional
processedThe worker name that is processing or processed this job.
Optional
processedTimestamp for when the job was processed.
The progress a job has performed so far.
Readonly
queueIt includes the prefix, the namespace separator :, and queue name.
Optional
repeatBase repeat job key.
The value returned by the processor when processing this job.
Stacktrace for the error (for failed jobs).
Number of times where job has stalled.
Timestamp when the job was created (unless overridden with job options).
Optional
tokenThe token used for locking this job.
the prefix that is used.
the queue name this job belongs to.
Adds the job to Redis.
Optional
parentOpts: ParentKeyOptsPrepares a job to be serialized for storage in Redis.
Prepares a job to be passed to Sandbox.
Change delay of a delayed job.
milliseconds to be added to current time.
void
Change job priority.
options containing priority and lifo values.
void
Clears job's logs
Optional
keepLogs: numberthe amount of log entries to preserve
Extend the lock for this job.
unique token for the lock
lock duration in milliseconds
Get this jobs children result values if any.
Object mapping children job keys with their values.
Get children job keys if this job is a parent and has children.
dependencies separated by processed, unprocessed, ignored and failed.
Get children job counts if this job is a parent and has children.
dependencies count separated by processed, unprocessed, ignored and failed.
Retrieves the failures of child jobs that were explicitly ignored while using ignoreDependencyOnFailure option. This method is useful for inspecting which child jobs were intentionally ignored when an error occured.
Object mapping children job keys with their failure values.
Get current state.
Returns one of these values: 'completed', 'failed', 'delayed', 'active', 'waiting', 'waiting-children', 'unknown'.
true of the job is active.
true if the job has completed.
true if the job is delayed.
true if the job has failed.
true if the job is waiting.
true if the job is waiting for children.
Logs one row of log data.
string with log data to be logged.
The total number of log entries for this job so far.
Moves a job to the completed queue. Returned job to be used with Queue.prototype.nextJobFromJobData.
The jobs success message.
Worker token used to acquire completed job.
True when wanting to fetch the next job.
Returns the jobData of the next job in the waiting queue or void.
Moves the job to the delay set.
timestamp when the job should be moved back to "wait"
Optional
token: stringtoken to check job is locked by current worker
Moves a job to the failed queue.
the jobs error message.
token to check job is locked by current worker
true when wanting to fetch the next job
Returns the jobData of the next job in the waiting queue or void.
Moves a job to the wait or prioritized state.
Optional
token: stringWorker token used to acquire completed job.
Returns pttl.
Moves the job to the waiting-children set.
Token to check job is locked by current worker
The options bag for moving a job to waiting-children.
true if the job was moved
Promotes a delayed job so that it starts to be processed as soon as possible.
Completely remove the job from the queue. Note, this call will throw an exception if the job is being processed when the call is performed.
Options to remove a job
Removes child dependency from parent when child is not yet finished
True if the relationship existed and if it was removed.
Attempts to retry the job. Only a job that has failed or completed can be retried.
completed / failed
If resolved and return code is 1, then the queue emits a waiting event otherwise the operation was not a success and throw the corresponding error. If the promise rejects, it indicates that the script failed to execute
Updates a job's data
the data that will replace the current jobs data.
Updates a job's progress
number or object to be saved as progress.
Returns a promise the resolves when the job has completed (containing the return value of the job), or rejects when the job has failed (containing the failedReason).
Instance of QueueEvents.
Optional
ttl: numberTime in milliseconds to wait for job to finish before timing out.
Static
addaddJobLog
A minimal queue instance
Job id
String with a row of log data to be logged
Optional
keepLogs: numberThe optional amount of log entries to preserve
The total number of log entries for this job so far.
Static
createCreates a new job and adds it to the queue.
the queue where to add the job.
the name of the job.
the payload of the job.
Optional
opts: JobsOptionsthe options bag for this job.
Static
createCreates a bulk of jobs and adds them atomically to the given queue.
the queue were to add the jobs.
an array of jobs to be added to the queue.
Static
fromFetches a Job from the queue given the passed job id.
the queue where the job belongs to.
the job id.
Static
fromInstantiates a Job from a JobJsonRaw object (coming from a deserialized JSON object)
the queue where the job belongs to.
the plain object containing the job.
Optional
jobId: stringan optional job id (overrides the id coming from the JSON object)
Static
optsStatic
optsOptional
rawOpts: string
Job
This class represents a Job in the queue. Normally job are implicitly created when you add a job to the queue with methods such as Queue.addJob( ... )
A Job instance is also passed to the Worker's process function.