You Cloudflare account id
The ID of the queue you want to receive messages from.
OptionalalwaysBy default, the consumer will treat an empty object or array from either of the
handlers as a acknowledgement of no messages and will not delete those messages as
a result. Set this to true to always acknowledge all messages no matter the returned
value.
OptionalbatchThe number of messages to request from Cloudflare when polling (default 10).
OptionalhandleTime 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.
OptionalpollingThe duration (in milliseconds) to wait before repolling the queue. (Note: As Cloudflare uses short polling, you probably shouldn't set this too low)
OptionalretryThe amount of time to delay a message for before retrying (in seconds)
OptionalretryIf the Consumer should trigger the message(s) to be retired on
OptionalshouldIf the consumer should delete messages after they have been processed.
OptionalvisibilityThe duration (in milliseconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.
OptionalhandleAn 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.
OptionalhandleAn 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, this is preferred to reduce API
rate limits.
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.
OptionalpostOptionalpre
The options for the consumer.