These are the events that the consumer emits.

interface Events {
    aborted: [];
    acknowledged_messages: [{
        ackCount: number;
        retryCount: number;
        warnings: string[];
    }];
    acknowledging_messages: [{
        lease_id: string;
    }[], {
        delay_seconds: number;
        lease_id: string;
    }[]];
    empty: [];
    error: [Error, void | Message | Message[]];
    message_processed: [Message];
    message_received: [Message];
    option_updated: [UpdatableOptions, number];
    processing_error: [Error, Message];
    response_processed: [];
    started: [];
    stopped: [];
    timeout_error: [Error, Message];
}

Properties

aborted: []

Fired when requests to Cloudflare were aborted.

acknowledged_messages: [{
    ackCount: number;
    retryCount: number;
    warnings: string[];
}]

Fired when messages have been acknowledged

acknowledging_messages: [{
    lease_id: string;
}[], {
    delay_seconds: number;
    lease_id: string;
}[]]

Fired when messages are acknowledging

empty: []

Fired when the queue is empty (All messages have been consumed).

error: [Error, void | Message | Message[]]

Fired when an error occurs interacting with the queue.

If the error correlates to a message, that message is included in Params

message_processed: [Message]

Fired when a message is successfully processed and removed from the queue.

message_received: [Message]

Fired when a message is received.

option_updated: [UpdatableOptions, number]

Fired when an option is updated

processing_error: [Error, Message]

Fired when an error occurs processing the message.

response_processed: []

Fired after one batch of items (up to batchSize) has been successfully processed.

started: []

Fired when the consumer starts its work..

stopped: []

Fired when the consumer finally stops its work.

timeout_error: [Error, Message]

Fired when handleMessageTimeout is supplied as an option and if handleMessage times out.