bullmq - v5.56.2
    Preparing search index...

    Class QueueGetters<JobBase>

    Provides different getters for different aspects of a queue.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    closing: Promise<void>
    keys: KeysMap
    name: string

    The name of the queue.

    opts: QueueBaseOptions = ...

    Options for the queue.

    qualifiedName: string
    toKey: (type: string) => string

    Accessors

    • get redisVersion(): string

      Returns the version of the Redis instance the client is connected to,

      Returns string

    Methods

    • Closes the connection and returns a promise that resolves when the connection is closed.

      Returns Promise<void>

    • Returns the number of jobs waiting to be processed. This includes jobs that are "waiting" or "delayed" or "prioritized" or "waiting-children".

      Returns Promise<number>

    • Emits an event. Normally used by subclasses to emit events.

      Parameters

      • event: string | symbol

        The emitted event.

      • ...args: any[]

      Returns boolean

    • Export the metrics for the queue in the Prometheus format. Automatically exports all the counts returned by getJobCounts().

      Parameters

      • OptionalglobalVariables: Record<string, string>

      Returns Promise<string>

      • Returns a string with the metrics in the Prometheus format.
    • Returns the jobs that are in the "active" status.

      Parameters

      • start: number = 0

        zero based index from where to start returning jobs.

      • end: number = -1

        zero based index where to stop returning jobs.

      Returns Promise<JobBase[]>

    • Returns the number of jobs in active status.

      Returns Promise<number>

    • Returns the jobs that are in the "completed" status.

      Parameters

      • start: number = 0

        zero based index from where to start returning jobs.

      • end: number = -1

        zero based index where to stop returning jobs.

      Returns Promise<JobBase[]>

    • Returns the number of jobs in completed status.

      Returns Promise<number>

    • Returns the number of jobs per priority.

      Parameters

      • priorities: number[]

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

    • Get jobId that starts debounced state.

      Parameters

      • id: string

        debounce identifier

      Returns Promise<string>

      use getDeduplicationJobId method

    • Get jobId from deduplicated state.

      Parameters

      • id: string

        deduplication identifier

      Returns Promise<string>

    • Returns the jobs that are in the "delayed" status.

      Parameters

      • start: number = 0

        zero based index from where to start returning jobs.

      • end: number = -1

        zero based index where to stop returning jobs.

      Returns Promise<JobBase[]>

    • Returns the number of jobs in delayed status.

      Returns Promise<number>

    • Returns the qualified job ids and the raw job data (if available) of the children jobs of the given parent job. It is possible to get either the already processed children, in this case an array of qualified job ids and their result values will be returned, or the pending children, in this case an array of qualified job ids will be returned. A qualified job id is a string representing the job id in a given queue, for example: "bull:myqueue:jobid".

      Parameters

      • parentId: string

        The id of the parent job

      • type: "pending" | "processed"

        "processed" | "pending"

      • start: number
      • end: number

      Returns Promise<
          {
              items: { err?: string; id: string; v?: any }[];
              jobs: JobJsonRaw[];
              total: number;
          },
      >

      an object with the following shape: { items: { id: string, v?: any, err?: string } [], jobs: JobJsonRaw[], total: number}

    • Returns the jobs that are in the "failed" status.

      Parameters

      • start: number = 0

        zero based index from where to start returning jobs.

      • end: number = -1

        zero based index where to stop returning jobs.

      Returns Promise<JobBase[]>

    • Returns the number of jobs in failed status.

      Returns Promise<number>

    • Job counts by type

      Queue#getJobCountByTypes('completed') => completed count Queue#getJobCountByTypes('completed,failed') => completed + failed count Queue#getJobCountByTypes('completed', 'failed') => completed + failed count Queue#getJobCountByTypes('completed', 'waiting', 'failed') => completed + waiting + failed count

      Parameters

      Returns Promise<number>

    • Returns the job counts for each type specified or every list/set in the queue by default.

      Parameters

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

      An object, key (type) and value (count)

    • Returns the logs for a given Job.

      Parameters

      • jobId: string

        the id of the job to get the logs for.

      • start: number = 0

        zero based index from where to start returning jobs.

      • end: number = -1

        zero based index where to stop returning jobs.

      • asc: boolean = true

        if true, the jobs will be returned in ascending order.

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

    • Returns the jobs that are on the given statuses (note that JobType is synonym for job status)

      Parameters

      • Optionaltypes: JobType | JobType[]

        the statuses of the jobs to return.

      • start: number = 0

        zero based index from where to start returning jobs.

      • end: number = -1

        zero based index where to stop returning jobs.

      • asc: boolean = false

        if true, the jobs will be returned in ascending order.

      Returns Promise<JobBase[]>

    • Get current job state.

      Parameters

      • jobId: string

        job identifier.

      Returns Promise<"unknown" | JobState>

      Returns one of these values: 'completed', 'failed', 'delayed', 'active', 'waiting', 'waiting-children', 'unknown'.

    • Get queue metrics related to the queue.

      This method returns the gathered metrics for the queue. The metrics are represented as an array of job counts per unit of time (1 minute).

      Parameters

      • type: "failed" | "completed"
      • start: number = 0

        Start point of the metrics, where 0 is the newest point to be returned.

      • end: number = -1

        End point of the metrics, where -1 is the oldest point to be returned.

      Returns Promise<Metrics>

      • Returns an object with queue metrics.
    • Returns the jobs that are in the "prioritized" status.

      Parameters

      • start: number = 0

        zero based index from where to start returning jobs.

      • end: number = -1

        zero based index where to stop returning jobs.

      Returns Promise<JobBase[]>

    • Returns the number of jobs in prioritized status.

      Returns Promise<number>

    • Get queue events list related to the queue. Note: GCP does not support SETNAME, so this call will not work

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

      • Returns an array with queue events info.

      do not use this method, it will be removed in the future.

    • Parameters

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

      Returns Promise<string[]>

    • Returns the time to live for a rate limited key in milliseconds.

      Parameters

      • OptionalmaxJobs: number

        max jobs to be considered in rate limit state. If not passed it will return the remaining ttl without considering if max jobs is excedeed.

      Returns Promise<number>

      -2 if the key does not exist. -1 if the key exists but has no associated expire.

    • Returns the jobs that are in the "waiting" status.

      Parameters

      • start: number = 0

        zero based index from where to start returning jobs.

      • end: number = -1

        zero based index where to stop returning jobs.

      Returns Promise<JobBase[]>

    • Returns the jobs that are in the "waiting-children" status. I.E. parent jobs that have at least one child that has not completed yet.

      Parameters

      • start: number = 0

        zero based index from where to start returning jobs.

      • end: number = -1

        zero based index where to stop returning jobs.

      Returns Promise<JobBase[]>

    • Returns the number of jobs in waiting-children status.

      Returns Promise<number>

    • Returns the number of jobs in waiting or paused statuses.

      Returns Promise<number>

    • Get the worker list related to the queue. i.e. all the known workers that are available to process jobs for this queue. Note: GCP does not support SETNAME, so this call will not work

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

      • Returns an array with workers info.
    • Returns the current count of workers for the queue.

      getWorkersCount(): Promise

      Returns Promise<number>

    • Wraps the code with telemetry and provides a span for configuration.

      Type Parameters

      • T

      Parameters

      • spanKind: SpanKind

        kind of the span: Producer, Consumer, Internal

      • operation: string

        operation name (such as add, process, etc)

      • destination: string

        destination name (normally the queue name)

      • callback: (span?: Span, dstPropagationMetadata?: string) => T | Promise<T>

        code to wrap with telemetry

      • OptionalsrcPropagationMetadata: string

      Returns Promise<T | Promise<T>>