Interface WorkerListener<DataType, ResultType, NameType>

interface WorkerListener<DataType, ResultType, NameType> {
    active: ((job, prev) => void);
    closed: (() => void);
    closing: ((msg) => void);
    completed: ((job, result, prev) => void);
    drained: (() => void);
    error: ((failedReason) => void);
    failed: ((job, error, prev) => void);
    ioredis:close: (() => void);
    paused: (() => void);
    progress: ((job, progress) => void);
    ready: (() => void);
    resumed: (() => void);
    stalled: ((jobId, prev) => void);
}

Type Parameters

  • DataType = any
  • ResultType = any
  • NameType extends string = string

Hierarchy (view full)

Properties

active: ((job, prev) => void)

Type declaration

    • (job, prev): void
    • Listen to 'active' event.

      This event is triggered when a job enters the 'active' state.

      Parameters

      • job: Job<DataType, ResultType, NameType>
      • prev: string

      Returns void

closed: (() => void)

Type declaration

    • (): void
    • Listen to 'closing' event.

      This event is triggered when the worker is closed.

      Returns void

closing: ((msg) => void)

Type declaration

    • (msg): void
    • Listen to 'closing' event.

      This event is triggered when the worker is closing.

      Parameters

      • msg: string

      Returns void

completed: ((job, result, prev) => void)

Type declaration

    • (job, result, prev): void
    • Listen to 'completed' event.

      This event is triggered when a job has successfully completed.

      Parameters

      • job: Job<DataType, ResultType, NameType>
      • result: ResultType
      • prev: string

      Returns void

drained: (() => void)

Type declaration

    • (): void
    • Listen to 'drained' event.

      This event is triggered when the queue has drained the waiting list. Note that there could still be delayed jobs waiting their timers to expire and this event will still be triggered as long as the waiting list has emptied.

      Returns void

error: ((failedReason) => void)

Type declaration

    • (failedReason): void
    • Listen to 'error' event.

      This event is triggered when an error is throw.

      Parameters

      • failedReason: Error

      Returns void

failed: ((job, error, prev) => void)

Type declaration

    • (job, error, prev): void
    • Listen to 'failed' event.

      This event is triggered when a job has thrown an exception. Note: job parameter could be received as undefined when an stalled job reaches the stalled limit and it is deleted by the removeOnFail option.

      Parameters

      • job: Job<DataType, ResultType, NameType>
      • error: Error
      • prev: string

      Returns void

ioredis:close: (() => void)

Type declaration

    • (): void
    • Listen to 'ioredis:close' event.

      This event is triggered when ioredis is closed.

      Returns void

paused: (() => void)

Type declaration

    • (): void
    • Listen to 'paused' event.

      This event is triggered when the queue is paused.

      Returns void

progress: ((job, progress) => void)

Type declaration

    • (job, progress): void
    • Listen to 'progress' event.

      This event is triggered when a job updates it progress, i.e. the Job##updateProgress() method is called. This is useful to notify progress or any other data from within a processor to the rest of the world.

      Parameters

      • job: Job<DataType, ResultType, NameType>
      • progress: number | object

      Returns void

ready: (() => void)

Type declaration

    • (): void
    • Listen to 'ready' event.

      This event is triggered when blockingConnection is ready.

      Returns void

resumed: (() => void)

Type declaration

    • (): void
    • Listen to 'resumed' event.

      This event is triggered when the queue is resumed.

      Returns void

stalled: ((jobId, prev) => void)

Type declaration

    • (jobId, prev): void
    • Listen to 'stalled' event.

      This event is triggered when a job has stalled and has been moved back to the wait list.

      Parameters

      • jobId: string
      • prev: string

      Returns void

Generated using TypeDoc