Skip to content
25K
Console

QueueWorkerSubscriber

The QueueWorkerSubscriber component is internally used by the Queue component to add a consumer to Cloudflare Queues.

You’ll find this component returned by Queue.subscribe().


Constructor

new QueueWorkerSubscriber(name, args, opts?)

Parameters

QueueWorkerSubscriberArgs

batch?

Type Object

Default 10

The maximum number of messages to include in a batch.

batch.size?

Type Input<number>

Default 10

The maximum number of events that will be processed together in a single invocation of the consumer function.

Value must be between 1 and 100.

batch.window?

Type Input<${number} minute | ${number} minutes | ${number} second | ${number} seconds>

Default “5 seconds”

The maximum amount of time to wait for collecting events before sending the batch to the consumer function, even if the batch size hasn’t been reached.

Value must be between 0 seconds and 60 seconds.

dlq?

Type Object

The dead letter queue to send messages that fail processing.

When dlq is configured, dlq.queue is required.

dlq.queue

Type Input<string>

The name of the dead letter queue.

dlq.retry?

Type Input<number>

Default 3

The number of times the main queue will retry the message before sending it to the dead-letter queue.

dlq.retryDelay?

Type Input<${number} second | ${number} seconds>

Default 0 seconds

The number of seconds to delay before making the message available for another attempt.

maxConcurrency?

Type Input<number>

Default null

Maximum number of concurrent consumers that may consume from this Queue.

queue

Type Input<Object>

The queue to use.

queue.id

Type Input<string>

The ID of the queue.

subscriber

Type Input<string | WorkerArgs>

The subscriber worker.

transform?

Type Object

Transform how this component creates its underlying resources.

transform.consumer?

Type QueueConsumerArgs | (args: QueueConsumerArgs, opts: ComponentResourceOptions, name: string) => void

Transform the Consumer resource.

transform.worker?

Type WorkerArgs | (args: WorkerArgs, opts: ComponentResourceOptions, name: string) => void

Transform the Worker resource.

Properties

nodes

Type Object

The underlying resources this component creates.

nodes.consumer

Type QueueConsumer

The Cloudflare Queue Consumer.

nodes.worker

Type Output<Worker>

The Worker that’ll process messages from the queue.