You Cloudflare account id
The ID of the queue you want to receive messages from.
Optional
alwaysBy 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.
Optional
batchThe number of messages to request from Cloudflare when polling (default 10
).
Optional
handleTime 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.
Optional
pollingThe duration (in milliseconds) to wait before repolling the queue. (Note: As Cloudflare uses short polling, you probably shouldn't set this too low)
Optional
retryThe amount of time to delay a message for before retrying (in seconds)
Optional
retryIf the Consumer should trigger the message(s) to be retired on
Optional
shouldIf the consumer should delete messages after they have been processed.
Optional
visibilityThe duration (in milliseconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.
Optional
handleAn 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.
Optional
handleAn 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.
Optional
postOptional
pre
The options for the consumer.