Class Queue3<T>

Deprecated

Use Queue class instead https://docs.bullmq.io/guide/queues

Type Parameters

  • T = any

Hierarchy

  • EventEmitter
    • Queue3

Constructors

  • 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.

    Type Parameters

    • T = any

    Parameters

    • name: string
    • Optional opts: CommonOptions

    Returns Queue3<T>

Properties

name: string

The name of the queue

queueEvents: QueueEvents

Methods

  • Returns Queue name in base64 encoded format

    Returns string

  • 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.

    Parameters

    • grace: number

      Grace period in milliseconds.

    • limit: number

      Maximum amount of jobs to clean per call. If not provided will clean all matching jobs.

    • type: "wait" | "completed" | "failed" | "active" | "delayed" | "paused" = 'completed'

      Status of the job to clean. Values are completed, wait, active, paused, delayed, and failed. Defaults to completed.

    Returns Promise<string[]>

  • Returns Queue name with keyPrefix (default: 'bull')

    Returns string

  • 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 Promise<any>

  • 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.

    Returns Promise<number>

  • Parameters

    • event: string | symbol
    • Optional listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Queue3<T>

  • Empties a queue deleting all the input lists and associated jobs.

    Returns Promise<void>

  • Returns a promise that will return an array with the active jobs between start and end.

    Parameters

    • start: number = 0
    • end: number = -1

    Returns Promise<Job<any, any, string>[]>

  • Returns a promise that resolves with the quantity of active jobs.

    Returns Promise<number>

  • Returns a promise that will return an array with the completed jobs between start and end.

    Parameters

    • start: number = 0
    • end: number = -1

    Returns Promise<Job<any, any, string>[]>

  • Returns a promise that resolves with the quantity of completed jobs.

    Returns Promise<number>

  • Returns a promise that will return an array with the delayed jobs between start and end.

    Parameters

    • start: number = 0
    • end: number = -1

    Returns Promise<Job<any, any, string>[]>

  • Returns a promise that resolves with the quantity of delayed jobs.

    Returns Promise<number>

  • Returns a promise that will return an array with the failed jobs between start and end.

    Parameters

    • start: number = 0
    • end: number = -1

    Returns Promise<Job<any, any, string>[]>

  • Returns a promise that resolves with the quantity of failed jobs.

    Returns Promise<number>

  • 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.

    Parameters

    • jobId: string

    Returns Promise<Job<any, any, string>>

  • Returns a promise that resolves with the job counts for the given queue of the given types.

    Parameters

    Returns Promise<number>

  • Returns a promise that resolves with the job counts for the given queue.

    Parameters

    Returns Promise<{
        [index: string]: number;
    }>

  • 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.

    Parameters

    • jobId: string
    • start: number = 0
    • end: number = -1

    Returns Promise<{
        count: number;
        logs: string[];
    }>

  • Returns a promise that will return an array of job instances of the given types. Optional parameters for range and ordering are provided.

    Parameters

    • types: JobType | JobType[]
    • start: number = 0
    • end: number = -1
    • asc: boolean = false

    Returns Promise<Job<any, any, string>[]>

  • Returns a promise that resolves with the quantity of paused jobs.

    Returns Promise<number>

  • Returns a promise that resolves to the quantity of repeatable jobs.

    Returns Promise<number>

  • 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.

    Parameters

    • start: number = 0
    • end: number = -1
    • asc: boolean = false

    Returns Promise<JobInformation3[]>

  • Returns a promise that will return an array with the waiting jobs between start and end.

    Parameters

    • start: number = 0
    • end: number = -1

    Returns Promise<Job<any, any, string>[]>

  • Returns a promise that resolves with the quantity of waiting jobs.

    Returns Promise<number>

  • Returns Redis clients array which belongs to current Queue

    Returns Promise<{
        [key: string]: string;
    }[]>

  • Returns a promise that resolves when Redis is connected and the queue is ready to accept jobs. This replaces the ready event emitted on Queue in previous versions.

    Returns Promise<Queue3<T>>

  • ???

    Parameters

    • name: string
    • data: any
    • Optional opts: JobsOptions
    • Optional skipCheckExists: boolean

    Returns Promise<Job<any, any, string>>

  • Parameters

    • event: string | symbol
    • Optional listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Queue3<T>

  • Parameters

    • event: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Queue3<T>

  • Returns Redis clients array which belongs to current Queue from string with all redis clients

    Parameters

    • list: string

      String with all redis clients

    Returns {
        [key: string]: string;
    }[]

  • 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.

    Returns Promise<void>

  • Parameters

    • Optional doNotWaitActive: boolean

    Returns Promise<void>

  • 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.

    Parameters

    • processor: string | Processor<T, any, string>

    Returns Promise<void>

  • Parameters

    • event: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Queue3<T>

  • 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

    Parameters

    Returns Promise<boolean>

  • Removes a given repeatable job by key.

    Parameters

    • repeatJobKey: string

    Returns Promise<void>

  • 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.

    Returns Promise<void>

  • Set clientName to Redis.client

    Returns Promise<any>

Generated using TypeDoc