In BullMQ, a job is a unit of work that can be processed by a worker. When creating a new job in BullMQ, there are several options you can specify to configure its behavior:
delay: This option allows you to delay the execution of the job by a certain amount of milliseconds.
attempts: This option lets you specify the number of attempts to perform if the job fails.
backoff: This option can be used to control the backoff strategies on retries.
lifo: If set to
true, the job will be placed last in the queue (last in, first out).
timeout: This represents the max amount of time in milliseconds a job can be active. If exceeded, the job fails.
true, removes the job when successfully completed.
true, removes the job when it fails after all attempts.
stackTraceLimit: Limits the amount of stack trace lines stored in case of failure.
Here's an example on how to use these options when adding a job:
This will add a job named 'my-job' with some data, and configure it with the provided options.