Attach a Consumer Worker to a Queue

queues & cron

// what it does

Registers a deployed Worker as the consumer that pulls and processes message batches from the queue. Alternatively you declare the consumer in that Worker's own wrangler config under [[queues.consumers]], and it's wired up automatically on wrangler deploy. Reach for the CLI form when the consumer is deployed separately from the queue.

// shell

$ wrangler queues consumer add <queue-name> <script-name>
$ wrangler queues consumer remove <queue-name> <script-name>

// gotcha

A queue supports a single consumer Worker — remove the existing one before attaching a different Worker. Consumer tuning (batch size, retries, dead-letter queue) can be passed as flags on consumer add or declared in [[queues.consumers]] config.