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)

Listen to 'active' event.

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

Type declaration

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

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

      Parameters

      Returns void

closed: (() => void)

Listen to 'closing' event.

This event is triggered when the worker is closed.

Type declaration

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

      This event is triggered when the worker is closed.

      Returns void

closing: ((msg) => void)

Listen to 'closing' event.

This event is triggered when the worker is closing.

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)

Listen to 'completed' event.

This event is triggered when a job has successfully completed.

Type declaration

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

      This event is triggered when a job has successfully completed.

      Parameters

      Returns void

drained: (() => 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.

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)

Listen to 'error' event.

This event is triggered when an error is throw.

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)

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.

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

      Returns void

ioredis:close: (() => void)

Listen to 'ioredis:close' event.

This event is triggered when ioredis is closed.

Type declaration

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

      This event is triggered when ioredis is closed.

      Returns void

paused: (() => void)

Listen to 'paused' event.

This event is triggered when the queue is paused.

Type declaration

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

      This event is triggered when the queue is paused.

      Returns void

progress: ((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.

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

      Returns void

ready: (() => void)

Listen to 'ready' event.

This event is triggered when blockingConnection is ready.

Type declaration

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

      This event is triggered when blockingConnection is ready.

      Returns void

resumed: (() => void)

Listen to 'resumed' event.

This event is triggered when the queue is resumed.

Type declaration

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

      This event is triggered when the queue is resumed.

      Returns void

stalled: ((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.

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