Cloudflare Queues

What is it?

Cloudflare Queues is a message queue built into the Workers platform that lets you send and receive messages with guaranteed delivery. It connects Workers to other Workers (or external services) asynchronously — meaning the sender doesn't have to wait for the receiver to finish processing. Queues is the glue that enables event-driven, decoupled architectures on Cloudflare's developer platform.

What problem does it solve?

Most real-world applications can't do everything synchronously inside a single request-response cycle. Queues solves several fundamental problems:

  • Tight coupling: Without a queue, if Service A needs to trigger work in Service B, A must call B directly and wait. If B is slow or down, A fails too. A queue decouples them — A writes a message and moves on.
  • Spiky workloads: A sudden burst of traffic (a product launch, a viral post) can overwhelm downstream services or external APIs. Queues act as a buffer, absorbing spikes and letting consumers process at their own pace.
  • No retries or durability: If you fire off an HTTP request to a webhook and it fails, the data is lost unless you've built your own retry logic. Queues guarantees delivery with built-in retries and dead letter queues for messages that repeatedly fail.
  • Missing piece on the platform: Before Queues, Cloudflare's developer platform had compute (Workers), storage (R2, KV, D1), and coordination (Durable Objects) — but no native way to handle asynchronous, event-driven patterns. Queues fills that gap.

How does it work?

Queues has four core concepts:

  1. Queue: A named buffer that stores messages until they're consumed. You can create multiple queues for different use cases (logging, email sends, order processing, etc.).
  2. Producer: A Worker (or any service) that writes messages to a queue. You bind a queue to a Worker and call send() or sendBatch() to publish messages.
  3. Consumer: A Worker that processes messages from the queue. Consumers receive messages in batches (configurable size and timeout) for efficient processing.
  4. Messages: Any JSON-serializable object or plain string. Messages are not deleted until the consumer successfully acknowledges them.

Key features:

  • Batching: Messages are delivered in batches (up to 100 by default), reducing the number of Worker invocations and improving throughput.
  • Retries: If a consumer fails, the entire batch (or individual messages) can be retried automatically.
  • Dead letter queues: Messages that fail repeatedly are routed to a separate queue for inspection instead of being lost.
  • Pull consumers: In addition to push-based Worker consumers, you can pull messages over HTTP from any external service.

Example use cases: processing e-commerce orders in the background, buffering log events before writing to R2, sending emails after user sign-up, syncing data to external APIs.

Why it matters strategically

Queues completes a critical capability gap in Cloudflare's developer platform. Any serious cloud provider needs a message queue — AWS has SQS/SNS, Google has Pub/Sub, Azure has Service Bus. Without Queues, developers building on Cloudflare had to reach outside the platform for async patterns, which weakened the "build everything on Cloudflare" pitch. With Queues, the developer platform covers compute, storage, databases, coordination, and messaging — making it a credible full-stack alternative to traditional cloud providers.

Learn more