The name of the Job
The payload for this job.
The options object for this job.
Optionalid: stringNumber of attempts after the job has failed.
Number of attempts when job is moved to active.
The payload for this job.
OptionaldebounceDebounce identifier.
OptionaldeduplicationDeduplication 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.
OptionalfinishedTimestamp for when the job finished (completed or failed).
OptionalidThe name of the Job
OptionalnextProduced next repetable job Id.
The options object for this job.
OptionalparentObject that contains parentId (id) and parent queueKey.
OptionalparentFully 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.
OptionalprocessedThe worker name that is processing or processed this job.
OptionalprocessedTimestamp for when the job was processed.
The progress a job has performed so far.
ReadonlyqueueIt includes the prefix, the namespace separator :, and queue name.
OptionalrepeatBase 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).
OptionaltokenThe token used for locking this job.
the prefix that is used.
the queue name this job belongs to.
Adds the job to Redis.
OptionalparentOpts: ParentKeyOptsPrepares a job to be serialized for storage in Redis.
Prepares a job to be passed to Sandbox.
Change delay of a delayed job.
Reschedules a delayed job by setting a new delay from the current time. For example, calling changeDelay(5000) will reschedule the job to execute 5000 milliseconds (5 seconds) from now, regardless of the original delay.
milliseconds from now when the job should be processed.
void
Change job priority.
options containing priority and lifo values.
void
Clears job's logs
OptionalkeepLogs: 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"
Optionaltoken: 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.
Optionaltoken: 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
A promise that resolves when the job has been successfully moved to the wait queue. The queue emits a waiting event when the job is successfully moved.
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.
Optionalttl: numberTime in milliseconds to wait for job to finish before timing out.
StaticaddaddJobLog
A minimal queue instance
Job id
String with a row of log data to be logged
OptionalkeepLogs: numberThe optional amount of log entries to preserve
The total number of log entries for this job so far.
StaticcreateCreates 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.
Optionalopts: JobsOptionsthe options bag for this job.
StaticcreateCreates 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.
StaticfromFetches a Job from the queue given the passed job id.
the queue where the job belongs to.
the job id.
StaticfromInstantiates 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.
OptionaljobId: stringan optional job id (overrides the id coming from the JSON object)
StaticoptsStaticoptsOptionalrawOpts: 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.