Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Queue3<T>

deprecated

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

Type parameters

  • T = any

Hierarchy

  • EventEmitter
    • Queue3

Index

Constructors

  • new Queue3<T>(name: string, opts?: CommonOptions): Queue3<T>
  • 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

  • add(jobName: string, data: any, opts?: JobsOptions): Promise<Job<any, any, string>>
  • base64Name(): string
  • clean(grace: number, limit: number, type?: "completed" | "failed" | "active" | "delayed" | "paused" | "wait"): Promise<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: "completed" | "failed" | "active" | "delayed" | "paused" | "wait" = 'completed'

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

    Returns Promise<string[]>

  • clientName(): string
  • close(): Promise<any>
  • 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>

  • count(): Promise<number>
  • 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>

  • detachListener(event: string | symbol, listener?: (...args: any[]) => void): Queue3<T>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Queue3<T>

  • empty(): Promise<void>
  • Empties a queue deleting all the input lists and associated jobs.

    Returns Promise<void>

  • getActive(start?: number, end?: number): Promise<Job<any, any, string>[]>
  • 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>[]>

  • getActiveCount(): Promise<number>
  • Returns a promise that resolves with the quantity of active jobs.

    Returns Promise<number>

  • getCompleted(start?: number, end?: number): Promise<Job<any, any, string>[]>
  • 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>[]>

  • getCompletedCount(): Promise<number>
  • Returns a promise that resolves with the quantity of completed jobs.

    Returns Promise<number>

  • getDelayed(start?: number, end?: number): Promise<Job<any, any, string>[]>
  • 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>[]>

  • getDelayedCount(): Promise<number>
  • Returns a promise that resolves with the quantity of delayed jobs.

    Returns Promise<number>

  • getFailed(start?: number, end?: number): Promise<Job<any, any, string>[]>
  • 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>[]>

  • getFailedCount(): Promise<number>
  • Returns a promise that resolves with the quantity of failed jobs.

    Returns Promise<number>

  • getJob(jobId: string): Promise<Job<any, any, string>>
  • 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>>

  • getJobCountByTypes(...types: JobType[]): Promise<number>
  • Returns a promise that resolves with the job counts for the given queue of the given types.

    Parameters

    Returns Promise<number>

  • getJobCounts(...types: JobType[]): Promise<{}>
  • Returns a promise that resolves with the job counts for the given queue.

    Parameters

    Returns Promise<{}>

  • getJobLogs(jobId: string, start?: number, end?: number): Promise<{ count: number; logs: string[] }>
  • 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[] }>

  • getJobs(types: JobType | JobType[], start?: number, end?: number, asc?: boolean): Promise<Job<any, any, 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>[]>

  • getNextJob(): Promise<Job<any, any, string>>
  • getPausedCount(): Promise<number>
  • Returns a promise that resolves with the quantity of paused jobs.

    Returns Promise<number>

  • getRepeatableCount(): Promise<number>
  • Returns a promise that resolves to the quantity of repeatable jobs.

    Returns Promise<number>

  • getRepeatableJobs(start?: number, end?: number, asc?: boolean): Promise<JobInformation3[]>
  • 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[]>

  • getWaiting(start?: number, end?: number): Promise<Job<any, any, string>[]>
  • 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>[]>

  • getWaitingCount(): Promise<number>
  • Returns a promise that resolves with the quantity of waiting jobs.

    Returns Promise<number>

  • getWorkers(): Promise<{}[]>
  • Returns Redis clients array which belongs to current Queue

    Returns Promise<{}[]>

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

  • isWorkerPaused(): boolean
  • nextRepeatableJob(name: string, data: any, opts?: JobsOptions, skipCheckExists?: boolean): Promise<Job<any, any, string>>
  • off(event: string | symbol, listener?: (...args: any[]) => void): Queue3<T>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Queue3<T>

  • once(event: string | symbol, listener: (...args: any[]) => void): Queue3<T>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Queue3<T>

  • parseClientList(list: string): {}[]
  • Returns Redis clients array which belongs to current Queue from string with all redis clients

    Parameters

    • list: string

      String with all redis clients

    Returns {}[]

  • pause(): Promise<void>
  • 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>

  • pauseWorker(doNotWaitActive?: boolean): Promise<void>
  • process(processor: string | Processor<T, any, string>): 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>

  • removeAllListeners(event: string | symbol): Queue3<T>
  • removeListener(event: string | symbol, listener: (...args: any[]) => void): Queue3<T>
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Queue3<T>

  • removeRepeatable(name: string, opts: RepeatOptions): Promise<boolean>
  • 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>

  • removeRepeatableByKey(repeatJobKey: string): Promise<void>
  • Removes a given repeatable job by key.

    Parameters

    • repeatJobKey: string

    Returns Promise<void>

  • resume(): 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>

  • resumeWorker(): Promise<void>
  • retryJob(job: Job<any, any, string>): Promise<void>
  • setWorkerName(): Promise<any>

Generated using TypeDoc