Skip to main content

Overview

JobOptions (also known as JobsOptions) provides configuration for individual jobs added to a queue.

Interface

Properties

jobId

jobId
string
Override the job ID (must be unique)

delay

delay
number
default:"0"
Delay in milliseconds before the job can be processed

priority

priority
number
default:"0"
Priority from 0 (highest) to 2,097,152 (lowest)

attempts

attempts
number
default:"1"
Total number of attempts to try the job until it completes

backoff

backoff
number | BackoffOptions
Backoff setting for automatic retries if the job fails

lifo

lifo
boolean
default:"false"
If true, adds the job to the left of the queue (LIFO) instead of the right (FIFO)

removeOnComplete

removeOnComplete
boolean | number | KeepJobs
If true, removes the job when it successfully completes

removeOnFail

removeOnFail
boolean | number | KeepJobs
If true, removes the job when it fails after all attempts

keepLogs

keepLogs
number
Maximum number of log entries to preserve

stackTraceLimit

stackTraceLimit
number
Limits the number of stack trace lines recorded

sizeLimit

sizeLimit
number
Limits the size in bytes of the job’s data payload (JSON serialized)

timestamp

timestamp
number
default:"Date.now()"
Timestamp when the job was created

repeat

repeat
RepeatOptions
Repeat configuration for creating recurring jobs

parent

parent
ParentOptions
Parent job configuration for creating job dependencies

Examples

Simple Job

Job with Retries

Delayed Job

High Priority Job

Job with Auto-Cleanup

BackoffOptions

KeepJobs

ParentOptions