Options
All
  • Public
  • Public/Protected
  • All
Menu

Class QueueGetters<DataType, ResultType, NameType>

description

Provides different getters for different aspects of a queue.

Type parameters

  • DataType

  • ResultType

  • NameType: string

Hierarchy

Index

Constructors

  • Type parameters

    • DataType

    • ResultType

    • NameType: string

    Parameters

    • name: string

      The name of the queue.

    • opts: QueueBaseOptions = {}

      Options for the queue.

    • Connection: typeof RedisConnection = RedisConnection

      An optional "Connection" class used to instantiate a Connection. This is useful for testing with mockups and/or extending the Connection class and passing an alternate implementation.

    Returns QueueGetters<DataType, ResultType, NameType>

Properties

closing: Promise<void>
keys: KeysMap
name: string
opts: QueueBaseOptions = {}
toKey: (type: string) => string

Type declaration

    • (type: string): string
    • Parameters

      • type: string

      Returns string

Accessors

  • Returns a promise that resolves to a redis client. Normally used only by subclasses.

    Returns Promise<RedisClient>

  • get redisVersion(): string
  • Returns the version of the Redis instance the client is connected to,

    Returns string

Methods

  • close(): Promise<void>
  • count(): Promise<number>
  • Returns the number of jobs waiting to be processed. This includes jobs that are "waiting" or "delayed".

    Returns Promise<number>

  • disconnect(): Promise<void>
  • emit(event: string | symbol, ...args: any[]): boolean
  • Emits an event. Normally used by subclasses to emit events.

    Parameters

    • event: string | symbol

      The emitted event.

    • Rest ...args: any[]

    Returns boolean

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

      zeroo based index where to stop returning jobs.

    Returns Promise<Job<DataType, ResultType, NameType>[]>

  • getActiveCount(): Promise<number>
  • getCompleted(start?: number, end?: number): Promise<Job<DataType, ResultType, NameType>[]>
  • 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

      zeroo based index where to stop returning jobs.

    Returns Promise<Job<DataType, ResultType, NameType>[]>

  • getCompletedCount(): Promise<number>
  • getDelayed(start?: number, end?: number): Promise<Job<DataType, ResultType, NameType>[]>
  • 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

      zeroo based index where to stop returning jobs.

    Returns Promise<Job<DataType, ResultType, NameType>[]>

  • getDelayedCount(): Promise<number>
  • getFailed(start?: number, end?: number): Promise<Job<DataType, ResultType, NameType>[]>
  • 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

      zeroo based index where to stop returning jobs.

    Returns Promise<Job<DataType, ResultType, NameType>[]>

  • getFailedCount(): Promise<number>
  • getJob(jobId: string): Promise<Job<DataType, ResultType, NameType>>
  • getJobCountByTypes(...types: JobType[]): 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>

  • getJobCounts(...types: JobType[]): Promise<{}>
  • Returns the job counts for each type specified or every list/set in the queue by default.

    Parameters

    Returns Promise<{}>

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

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

      zeroo 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] }>

  • getJobs(types?: JobType | JobType[], start?: number, end?: number, asc?: boolean): Promise<Job<DataType, ResultType, NameType>[]>
  • Returns the jobs that are on the given statuses (note that JobType is synonym for job status)

    Parameters

    • Optional types: JobType | JobType[]

      the statuses of the jobs to return.

    • start: number = 0

      zero based index from where to start returning jobs.

    • end: number = -1

      zeroo based index where to stop returning jobs.

    • asc: boolean = false

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

    Returns Promise<Job<DataType, ResultType, NameType>[]>

  • getMetrics(type: "completed" | "failed", start?: number, end?: number): Promise<Metrics>
  • 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: "completed" | "failed"
    • 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.
  • getQueueEvents(): Promise<{}[]>
  • Get queue events list related to the queue.

    Returns Promise<{}[]>

    • Returns an array with queue events info.
  • getQueueSchedulers(): Promise<{}[]>
  • Get queue schedulers list related to the queue.

    Returns Promise<{}[]>

    • Returns an array with queue schedulers info.
  • getRanges(types: JobType[], start?: number, end?: number, asc?: boolean): Promise<string[]>
  • getWaiting(start?: number, end?: number): Promise<Job<DataType, ResultType, NameType>[]>
  • 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

      zeroo based index where to stop returning jobs.

    Returns Promise<Job<DataType, ResultType, NameType>[]>

  • getWaitingChildren(start?: number, end?: number): Promise<Job<DataType, ResultType, NameType>[]>
  • 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

      zeroo based index where to stop returning jobs.

    Returns Promise<Job<DataType, ResultType, NameType>[]>

  • getWaitingChildrenCount(): Promise<number>
  • getWaitingCount(): Promise<number>
  • getWorkers(): Promise<{}[]>
  • Get the worker list related to the queue. i.e. all the known workers that are available to process jobs for this queue.

    Returns Promise<{}[]>

    • Returns an array with workers info.

Generated using TypeDoc