# Cloudflare Queues [[Cloudflare]] Queues is a managed message-queue service that integrates natively with [[Cloudflare Workers]] producers and consumers. Producers `send()` messages; consumers receive batches via a `queue()` handler, with automatic retries, dead-letter queues, and consumer concurrency control. It's the asynchronous-work primitive missing from the Workers platform. Where a Worker's request-handler runs in tens of milliseconds, a Queue consumer can take longer, retry on failure, and process messages in batches — without the producer blocking. ## Why It Matters Most non-trivial apps need asynchronous work: send the email later, generate the thumbnail later, call the third-party API later. Queues turns "later" into a binding: producer Worker calls `queue.send(payload)`, Cloudflare buffers and dispatches to the consumer Worker. No SQS, no RabbitMQ, no Redis stream to operate. ## Core Primitives - **Producer binding**: `env.MY_QUEUE.send(message)` or `sendBatch([...])` - **Consumer handler**: `async queue(batch, env) { ... }` — runs as a Worker - **Batch size + timeout**: configurable per consumer - **Retries**: per-message retry count, with exponential backoff - **Dead-letter queue**: failed messages get routed to a DLQ for inspection - **Pull-based consumers**: poll via HTTP from outside Cloudflare ## Common Use Cases - **Webhook processing** — accept fast, process slow - **Email/notification dispatch** in the background - **Image/video processing** — enqueue, transform, write back to [[Cloudflare R2]] - **Fan-out** — one event → N downstream tasks - **Decoupling** producers from consumers in event-driven systems ## References - Queues home: https://developers.cloudflare.com/queues/ - Pricing: https://developers.cloudflare.com/queues/platform/pricing/ ## Related - [[Cloudflare]] - [[Cloudflare Workers]] - [[Cloudflare Pipelines]] - [[Cloudflare R2]] - [[Cloudflare Durable Objects]] - [[Wrangler]]