Interface ConsumerOptions

Hierarchy

  • ConsumerOptions

Properties

queueUrl: string

The SQS queue URL.

attributeNames?: string[]

List of queue attributes to retrieve (i.e. ['All', 'ApproximateFirstReceiveTimestamp', 'ApproximateReceiveCount']). @default-value []

authenticationErrorTimeout?: number

The duration (in milliseconds) to wait before retrying after an authentication error. @default-value 10000

batchSize?: number

The number of messages to request from SQS when polling (default 1).

This cannot be higher than the AWS limit of 10. @default-value 1

handleMessageTimeout?: number

Time in ms to wait for handleMessage to process a message before timing out.

Emits timeout_error on timeout. By default, if handleMessage times out, the unprocessed message returns to the end of the queue.

heartbeatInterval?: number

The interval (in seconds) between requests to extend the message visibility timeout.

On each heartbeat the visibility is extended by adding visibilityTimeout to the number of seconds since the start of the handler function.

This value must less than visibilityTimeout.

maxInflightMessages?: number

Maximum amount of inflight async messages tasks

@default-value 1

messageAttributeNames?: string[]

List of message attributes to retrieve (i.e. ['name', 'address']). @default-value []

pollingWaitTimeMs?: number

The duration (in milliseconds) to wait before repolling the queue. @default-value 0

region?: string

The AWS region. @default-value process.env.AWS_REGION || eu-west-1

shouldDeleteMessages?: boolean

Default to true, if you don't want the package to delete messages from sqs set this to false. @default-value true

sqs?: SQSClient

An optional SQS Client object to use if you need to configure the client manually.

terminateVisibilityTimeout?: number

The duration (in seconds), sets the message visibility timeout seconds after a processing_error.

terminationGracePeriodSeconds?: number

Duration to wait for async messages tasks to finish @default-value 0

visibilityTimeout?: number

The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.

waitTimeSeconds?: number

The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning. @default-value 20

Methods

  • An async function (or function that returns a Promise) to be called whenever a message is received.

    In the case that you need to acknowledge the message, return an object containing the MessageId that you'd like to acknowledge.

    Parameters

    • message: Message

    Returns Promise<void | Message>

  • An async function (or function that returns a Promise) to be called whenever a batch of messages is received. Similar to handleMessage but will receive the list of messages, not each message individually.

    If both are set, handleMessageBatch overrides handleMessage.

    In the case that you need to ack only some of the messages, return an array with the successful messages only.

    Parameters

    • messages: Message[]

    Returns Promise<void | Message[]>

  • An async function (or function that returns a Promise) to be called right after the SQS Client sends a receive message command.

    This function is usefull if SQS Client module exports have been modified, for example to add middlewares.

    Returns Promise<void>

  • An async function (or function that returns a Promise) to be called right before the SQS Client sends a receive message command.

    This function is usefull if SQS Client module exports have been modified, for example to add middlewares.

    Returns Promise<void>