Interface QueueEventsListener

interface QueueEventsListener {
    active: ((args, id) => void);
    added: ((args, id) => void);
    cleaned: ((args, id) => void);
    completed: ((args, id) => void);
    debounced: ((args, id) => void);
    deduplicated: ((args, id) => void);
    delayed: ((args, id) => void);
    drained: ((id) => void);
    duplicated: ((args, id) => void);
    error: ((args) => void);
    failed: ((args, id) => void);
    ioredis:close: (() => void);
    paused: ((args, id) => void);
    progress: ((args, id) => void);
    removed: ((args, id) => void);
    resumed: ((args, id) => void);
    retries-exhausted: ((args, id) => void);
    stalled: ((args, id) => void);
    waiting: ((args, id) => void);
    waiting-children: ((args, id) => void);
}

Hierarchy (view full)

Properties

active: ((args, id) => void)

Listen to 'active' event.

This event is triggered when a job enters the 'active' state, meaning it is being processed.

Type declaration

    • (args, id): void
    • Listen to 'active' event.

      This event is triggered when a job enters the 'active' state, meaning it is being processed.

      Parameters

      • args: {
            jobId: string;
            prev?: string;
        }

        An object containing details about the job that became active.

        • jobId: string

          The unique identifier of the job that entered the active state.

        • Optional prev?: string

          The previous state of the job before it became active (e.g., 'waiting'), if applicable.

      • id: string

        The identifier of the event.

      Returns void

Param: args

An object containing details about the job that became active.

Param: args.jobId

The unique identifier of the job that entered the active state.

Param: args.prev

The previous state of the job before it became active (e.g., 'waiting'), if applicable.

Param: id

The identifier of the event.

added: ((args, id) => void)

Listen to 'added' event.

This event is triggered when a job is created and added to the queue.

Type declaration

    • (args, id): void
    • Listen to 'added' event.

      This event is triggered when a job is created and added to the queue.

      Parameters

      • args: {
            jobId: string;
            name: string;
        }

        An object containing details about the newly added job.

        • jobId: string

          The unique identifier of the job that was added.

        • name: string

          The name of the job, typically indicating its type or purpose.

      • id: string

        The identifier of the event.

      Returns void

Param: args

An object containing details about the newly added job.

Param: args.jobId

The unique identifier of the job that was added.

Param: args.name

The name of the job, typically indicating its type or purpose.

Param: id

The identifier of the event.

cleaned: ((args, id) => void)

Listen to 'cleaned' event.

This event is triggered when jobs are cleaned (e.g., removed) from the queue, typically via a cleanup method.

Type declaration

    • (args, id): void
    • Listen to 'cleaned' event.

      This event is triggered when jobs are cleaned (e.g., removed) from the queue, typically via a cleanup method.

      Parameters

      • args: {
            count: string;
        }

        An object containing the count of cleaned jobs.

        • count: string

          The number of jobs that were cleaned, represented as a string due to Redis serialization.

      • id: string

        The identifier of the event.

      Returns void

Param: args

An object containing the count of cleaned jobs.

Param: args.count

The number of jobs that were cleaned, represented as a string due to Redis serialization.

Param: id

The identifier of the event.

completed: ((args, id) => void)

Listen to 'completed' event.

This event is triggered when a job has successfully completed its execution.

Type declaration

    • (args, id): void
    • Listen to 'completed' event.

      This event is triggered when a job has successfully completed its execution.

      Parameters

      • args: {
            jobId: string;
            prev?: string;
            returnvalue: string;
        }

        An object containing details about the completed job.

        • jobId: string

          The unique identifier of the job that completed.

        • Optional prev?: string

          The previous state of the job before completion (e.g., 'active'), if applicable.

        • returnvalue: string

          The return value of the job, serialized as a string.

      • id: string

        The identifier of the event.

      Returns void

Param: args

An object containing details about the completed job.

Param: args.jobId

The unique identifier of the job that completed.

Param: args.returnvalue

The return value of the job, serialized as a string.

Param: args.prev

The previous state of the job before completion (e.g., 'active'), if applicable.

Param: id

The identifier of the event.

debounced: ((args, id) => void)

Listen to 'debounced' event.

Type declaration

    • (args, id): void
    • Listen to 'debounced' event.

      Parameters

      • args: {
            debounceId: string;
            jobId: string;
        }

        An object containing details about the debounced job.

        • debounceId: string

          The identifier used to debounce the job, preventing duplicate processing.

        • jobId: string

          The unique identifier of the job that was debounced.

      • id: string

        The identifier of the event.

      Returns void

      Deprecated

      Use the 'deduplicated' event instead.

      This event is triggered when a job is debounced because a job with the same debounceId still exists.

Deprecated

Use the 'deduplicated' event instead.

This event is triggered when a job is debounced because a job with the same debounceId still exists.

Param: args

An object containing details about the debounced job.

Param: args.jobId

The unique identifier of the job that was debounced.

Param: args.debounceId

The identifier used to debounce the job, preventing duplicate processing.

Param: id

The identifier of the event.

deduplicated: ((args, id) => void)

Listen to 'deduplicated' event.

This event is triggered when a job is not added to the queue because a job with the same deduplicationId already exists.

Type declaration

    • (args, id): void
    • Listen to 'deduplicated' event.

      This event is triggered when a job is not added to the queue because a job with the same deduplicationId already exists.

      Parameters

      • args: {
            deduplicatedJobId: string;
            deduplicationId: string;
            jobId: string;
        }

        An object containing details about the deduplicated job.

        • deduplicatedJobId: string

          The unique identifier of the existing job that caused the deduplication.

        • deduplicationId: string

          The deduplication identifier that caused the job to be deduplicated.

        • jobId: string

          The unique identifier of the job that was attempted to be added.

      • id: string

        The identifier of the event.

      Returns void

Param: args

An object containing details about the deduplicated job.

Param: args.jobId

The unique identifier of the job that was attempted to be added.

Param: args.deduplicationId

The deduplication identifier that caused the job to be deduplicated.

Param: args.deduplicatedJobId

The unique identifier of the existing job that caused the deduplication.

Param: id

The identifier of the event.

delayed: ((args, id) => void)

Listen to 'delayed' event.

This event is triggered when a job is scheduled with a delay before it becomes active.

Type declaration

    • (args, id): void
    • Listen to 'delayed' event.

      This event is triggered when a job is scheduled with a delay before it becomes active.

      Parameters

      • args: {
            delay: number;
            jobId: string;
        }

        An object containing details about the delayed job.

        • delay: number

          The delay duration in milliseconds before the job becomes active.

        • jobId: string

          The unique identifier of the job that was delayed.

      • id: string

        The identifier of the event.

      Returns void

Param: args

An object containing details about the delayed job.

Param: args.jobId

The unique identifier of the job that was delayed.

Param: args.delay

The delay duration in milliseconds before the job becomes active.

Param: id

The identifier of the event.

drained: ((id) => void)

Listen to 'drained' event.

This event is triggered when the queue has drained its waiting list, meaning there are no jobs in the 'waiting' state. 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

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

      This event is triggered when the queue has drained its waiting list, meaning there are no jobs in the 'waiting' state. 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.

      Parameters

      • id: string

        The identifier of the event.

      Returns void

Param: id

The identifier of the event.

duplicated: ((args, id) => void)

Listen to 'duplicated' event.

This event is triggered when a job is not created because a job with the same identifier already exists.

Type declaration

    • (args, id): void
    • Listen to 'duplicated' event.

      This event is triggered when a job is not created because a job with the same identifier already exists.

      Parameters

      • args: {
            jobId: string;
        }

        An object containing the job identifier.

        • jobId: string

          The unique identifier of the job that was attempted to be added.

      • id: string

        The identifier of the event.

      Returns void

Param: args

An object containing the job identifier.

Param: args.jobId

The unique identifier of the job that was attempted to be added.

Param: id

The identifier of the event.

error: ((args) => void)

Listen to 'error' event.

This event is triggered when an error in the Redis backend is thrown.

Type declaration

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

      This event is triggered when an error in the Redis backend is thrown.

      Parameters

      • args: Error

      Returns void

failed: ((args, id) => void)

Listen to 'failed' event.

This event is triggered when a job fails by throwing an exception during execution.

Type declaration

    • (args, id): void
    • Listen to 'failed' event.

      This event is triggered when a job fails by throwing an exception during execution.

      Parameters

      • args: {
            failedReason: string;
            jobId: string;
            prev?: string;
        }

        An object containing details about the failed job.

        • failedReason: string

          The reason or message describing why the job failed.

        • jobId: string

          The unique identifier of the job that failed.

        • Optional prev?: string

          The previous state of the job before failure (e.g., 'active'), if applicable.

      • id: string

        The identifier of the event.

      Returns void

Param: args

An object containing details about the failed job.

Param: args.jobId

The unique identifier of the job that failed.

Param: args.failedReason

The reason or message describing why the job failed.

Param: args.prev

The previous state of the job before failure (e.g., 'active'), if applicable.

Param: id

The identifier of the event.

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: ((args, id) => void)

Listen to 'paused' event.

This event is triggered when the queue is paused, halting the processing of new jobs.

Type declaration

    • (args, id): void
    • Listen to 'paused' event.

      This event is triggered when the queue is paused, halting the processing of new jobs.

      Parameters

      • args: {}

        An empty object (no additional data provided).

        • id: string

          The identifier of the event.

        Returns void

    Param: args

    An empty object (no additional data provided).

    Param: id

    The identifier of the event.

    progress: ((args, id) => void)

    Listen to 'progress' event.

    This event is triggered when a job updates its progress via the Job#updateProgress() method, allowing progress or custom data to be communicated externally.

    Type declaration

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

        This event is triggered when a job updates its progress via the Job#updateProgress() method, allowing progress or custom data to be communicated externally.

        Parameters

        • args: {
              data: JobProgress;
              jobId: string;
          }

          An object containing the job identifier and progress data.

          • data: JobProgress

            The progress data, which can be a number (e.g., percentage) or an object with custom data.

          • jobId: string

            The unique identifier of the job reporting progress.

        • id: string

          The identifier of the event.

        Returns void

    Param: args

    An object containing the job identifier and progress data.

    Param: args.jobId

    The unique identifier of the job reporting progress.

    Param: args.data

    The progress data, which can be a number (e.g., percentage) or an object with custom data.

    Param: id

    The identifier of the event.

    removed: ((args, id) => void)

    Listen to 'removed' event.

    This event is triggered when a job is manually removed from the queue.

    Type declaration

      • (args, id): void
      • Listen to 'removed' event.

        This event is triggered when a job is manually removed from the queue.

        Parameters

        • args: {
              jobId: string;
              prev: string;
          }

          An object containing details about the removed job.

          • jobId: string

            The unique identifier of the job that was removed.

          • prev: string

            The previous state of the job before removal (e.g., 'active' or 'waiting').

        • id: string

          The identifier of the event.

        Returns void

    Param: args

    An object containing details about the removed job.

    Param: args.jobId

    The unique identifier of the job that was removed.

    Param: args.prev

    The previous state of the job before removal (e.g., 'active' or 'waiting').

    Param: id

    The identifier of the event.

    resumed: ((args, id) => void)

    Listen to 'resumed' event.

    This event is triggered when the queue is resumed, allowing job processing to continue.

    Type declaration

      • (args, id): void
      • Listen to 'resumed' event.

        This event is triggered when the queue is resumed, allowing job processing to continue.

        Parameters

        • args: {}

          An empty object (no additional data provided).

          • id: string

            The identifier of the event.

          Returns void

      Param: args

      An empty object (no additional data provided).

      Param: id

      The identifier of the event.

      retries-exhausted: ((args, id) => void)

      Listen to 'retries-exhausted' event.

      This event is triggered when a job has exhausted its maximum retry attempts after repeated failures.

      Type declaration

        • (args, id): void
        • Listen to 'retries-exhausted' event.

          This event is triggered when a job has exhausted its maximum retry attempts after repeated failures.

          Parameters

          • args: {
                attemptsMade: string;
                jobId: string;
            }

            An object containing details about the job that exhausted retries.

            • attemptsMade: string

              The number of retry attempts made, represented as a string (due to Redis serialization).

            • jobId: string

              The unique identifier of the job that exhausted its retries.

          • id: string

            The identifier of the event.

          Returns void

      Param: args

      An object containing details about the job that exhausted retries.

      Param: args.jobId

      The unique identifier of the job that exhausted its retries.

      Param: args.attemptsMade

      The number of retry attempts made, represented as a string (due to Redis serialization).

      Param: id

      The identifier of the event.

      stalled: ((args, id) => void)

      Listen to 'stalled' event.

      This event is triggered when a job moves from 'active' back to 'waiting' or 'failed' because the processor could not renew its lock, indicating a potential processing issue.

      Type declaration

        • (args, id): void
        • Listen to 'stalled' event.

          This event is triggered when a job moves from 'active' back to 'waiting' or 'failed' because the processor could not renew its lock, indicating a potential processing issue.

          Parameters

          • args: {
                jobId: string;
            }

            An object containing the job identifier.

            • jobId: string

              The unique identifier of the job that stalled.

          • id: string

            The identifier of the event.

          Returns void

      Param: args

      An object containing the job identifier.

      Param: args.jobId

      The unique identifier of the job that stalled.

      Param: id

      The identifier of the event.

      waiting: ((args, id) => void)

      Listen to 'waiting' event.

      This event is triggered when a job enters the 'waiting' state, indicating it is queued and awaiting processing.

      Type declaration

        • (args, id): void
        • Listen to 'waiting' event.

          This event is triggered when a job enters the 'waiting' state, indicating it is queued and awaiting processing.

          Parameters

          • args: {
                jobId: string;
                prev?: string;
            }

            An object containing details about the job in the waiting state.

            • jobId: string

              The unique identifier of the job that is waiting.

            • Optional prev?: string

              The previous state of the job before entering 'waiting' (e.g., 'stalled'), if applicable.

          • id: string

            The identifier of the event.

          Returns void

      Param: args

      An object containing details about the job in the waiting state.

      Param: args.jobId

      The unique identifier of the job that is waiting.

      Param: args.prev

      The previous state of the job before entering 'waiting' (e.g., 'stalled'), if applicable.

      Param: id

      The identifier of the event.

      waiting-children: ((args, id) => void)

      Listen to 'waiting-children' event.

      This event is triggered when a job enters the 'waiting-children' state, indicating it is waiting for its child jobs to complete.

      Type declaration

        • (args, id): void
        • Listen to 'waiting-children' event.

          This event is triggered when a job enters the 'waiting-children' state, indicating it is waiting for its child jobs to complete.

          Parameters

          • args: {
                jobId: string;
            }

            An object containing the job identifier.

            • jobId: string

              The unique identifier of the job waiting for its children.

          • id: string

            The identifier of the event.

          Returns void

      Param: args

      An object containing the job identifier.

      Param: args.jobId

      The unique identifier of the job waiting for its children.

      Param: id

      The identifier of the event.

      Generated using TypeDoc