This is the Queue constructor. It creates a new Queue that is persisted in Redis. Every time the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session.
Optional
opts: CommonOptionsThe name of the queue
Optional
opts: JobsOptionsTells the queue remove all jobs created outside of a grace period in milliseconds. You can clean the jobs with the following states: completed, wait (typo for waiting), active, delayed, and failed.
Grace period in milliseconds.
Maximum amount of jobs to clean per call. If not provided will clean all matching jobs.
Status of the job to clean. Values are completed, wait, active, paused, delayed, and failed. Defaults to completed.
Returns a promise that resolves with the job counts for the given queue of the given types.
Rest
...types: JobType[]Returns a promise that resolves with the job counts for the given queue.
Rest
...types: JobType[]Returns a object with the logs according to the start and end arguments. The returned count value is the total amount of logs, useful for implementing pagination.
Returns JobInformation of repeatable jobs (ordered descending). Provide a start and/or an end index to limit the number of results. Start defaults to 0, end to -1 and asc to false.
???
Optional
opts: JobsOptionsOptional
skipCheckExists: booleanListens to queue events
Rest
...args: any[]An error occurred
A Job is waiting to be processed as soon as a worker is idling.
A job has started. You can use jobPromise.cancel()
to abort it
A job has been marked as stalled. This is useful for debugging job workers that crash or pause the event loop.
A job's progress was updated
A job successfully completed with a result
A job failed with err
as the reason
The queue has been paused
The queue has been resumed
A job successfully removed.
Old jobs have been cleaned from the queue.
jobs
is an array of jobs that were removed, and type
is the type of those jobs.
Queue#clean() for details
Emitted every time the queue has processed all the waiting jobs (even if there can be some delayed jobs not yet processed)
Returns a promise that resolves when the queue is paused.
A paused queue will not process new jobs until resumed, but current jobs being processed will continue until they are finalized. The pause can be either global or local. If global, all workers in all queue instances for a given queue will be paused. If local, just this worker will stop processing new jobs after the current lock expires. This can be useful to stop a worker from taking new jobs prior to shutting down.
Pausing a queue that is already paused does nothing.
Defines a processing function for the jobs placed into a given Queue.
The callback is called every time a job is placed in the queue. It is passed an instance of the job as first argument.
If the callback signature contains the second optional done argument, the callback will be passed a done callback to be called after the job has been completed. The done callback can be called with an Error instance, to signal that the job did not complete successfully, or with a result as second argument (e.g.: done(null, result);) when the job is successful. Errors will be passed as a second argument to the "failed" event; results, as a second argument to the "completed" event.
If, however, the callback signature does not contain the done argument, a promise must be returned to signal job completion. If the promise is rejected, the error will be passed as a second argument to the "failed" event. If it is resolved, its value will be the "completed" event's second argument.
Removes a given repeatable job. The RepeatOptions and JobId needs to be the same as the ones used for the job when it was added.
name: The name of the to be removed job
Returns a promise that resolves when the queue is resumed after being paused.
The resume can be either local or global. If global, all workers in all queue instances for a given queue will be resumed. If local, only this worker will be resumed. Note that resuming a queue globally will not resume workers that have been paused locally; for those, resume(true) must be called directly on their instances.
Resuming a queue that is not paused does nothing.
Generated using TypeDoc
Deprecated
Use Queue class instead https://docs.bullmq.io/guide/queues