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.
Optionalopts: CommonOptionsOptionalopts: JobsOptionsReturns Queue name in base64 encoded format
Tells 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 Queue name with keyPrefix (default: 'bull')
Closes the underlying redis client. Use this to perform a graceful shutdown.
close can be called from anywhere, with one caveat:
if called from within a job handler the queue won't close until after the job has been processed
Returns a promise that returns the number of jobs in the queue, waiting or paused. Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time.
Optionallistener: (...args: any[]) => voidEmpties a queue deleting all the input lists and associated jobs.
Returns a promise that will return an array with the active jobs between start and end.
Returns a promise that resolves with the quantity of active jobs.
Returns a promise that will return an array with the completed jobs between start and end.
Returns a promise that resolves with the quantity of completed jobs.
Returns a promise that will return an array with the delayed jobs between start and end.
Returns a promise that resolves with the quantity of delayed jobs.
Returns a promise that will return an array with the failed jobs between start and end.
Returns a promise that resolves with the quantity of failed jobs.
Returns a promise that will return the job instance associated with the jobId parameter. If the specified job cannot be located, the promise callback parameter will be set to null.
Returns a promise that resolves with the job counts for the given queue of the given types.
Returns a promise that resolves with the job counts for the given queue.
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 a promise that resolves with the quantity of paused jobs.
Returns a promise that resolves to the quantity of repeatable jobs.
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.
Returns a promise that will return an array with the waiting jobs between start and end.
Returns a promise that resolves with the quantity of waiting jobs.
Returns Redis clients array which belongs to current Queue
???
Optionalopts: JobsOptionsOptionalskipCheckExists: booleanOptionallistener: (...args: any[]) => voidListens to queue events
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
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.
Emitted every time the queue has processed all the waiting jobs (even if there can be some delayed jobs not yet processed)
Returns Redis clients array which belongs to current Queue from string with all redis clients
String with all redis clients
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.
OptionaldoNotWaitActive: booleanDefines 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
Removes a given repeatable job by key.
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.
Set clientName to Redis.client
Deprecated
Use Queue class instead https://docs.bullmq.io/guide/queues