The most important method of the Queue class isDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/taskforcesh/bullmq/llms.txt
Use this file to discover all available pages before exploring further.
add, which allows you to add jobs to the queue in different ways.
Basic Usage
Adding a job is straightforward:Method Signature
Name of the job to be added to the queue
Arbitrary data to append to the job. This will be available in the worker’s processor function.
Job options that affect how the job is processed. See below for available options.
Job Options
Timing Options
An amount of milliseconds to wait until this job can be processed. The job will be in the “delayed” state until the delay expires.
Timestamp when the job was created
Priority
Ranges from 0 (highest priority) to 2,097,152 (lowest priority). Note that using priorities has a slight impact on performance, so only use it if required.
Retry Options
The total number of attempts to try the job until it completes
Backoff setting for automatic retries if the job fails. Can be a number (milliseconds) or an object with type and delay.
Auto-Removal Options
If true, removes the job when it successfully completes. When given a number, it specifies the maximum amount of jobs to keep. You can also provide an object specifying max age and/or count to keep.
If true, removes the job when it fails after all attempts. When given a number, it specifies the maximum amount of jobs to keep. You can also provide an object specifying max age and/or count to keep.
Job Identification
Override the job ID. By default, the job ID is a unique integer, but you can use this setting to override it. If you use this option, it is up to you to ensure the jobId is unique. If you attempt to add a job with an ID that already exists, it will not be added (a ‘duplicated’ event will be emitted instead).
Processing Options
If true, adds the job to the right of the queue instead of the left, making it a LIFO (Last In First Out) queue.
Logging Options
Maximum amount of log entries that will be preserved for this job
Limits the amount of stack trace lines that will be recorded in the stacktrace when the job fails
Size Limits
Limits the size in bytes of the job’s data payload (as a JSON serialized string)
Parent-Child Jobs
Parent options for creating parent-child job relationships. Allows you to create flows where child jobs must complete before the parent job can proceed.
Repeatable Jobs
Repeat this job based on a cron schedule or interval.
