Queues

A managed message queue service

Cloudflare Queues enables reliable, asynchronous message delivery between Cloudflare Workers — or to services built anywhere.
Asynchronous Message Processing

Queues help developers offload work from the request path so users don't have to wait, enabling reliable and asynchronous message handling.

Built for Workers Platform

Seamlessly integrated with Cloudflare Workers for easy setup and management within your existing workflow.

Event Subscriptions

Get notified and take action programmatically through Workers by using Queues to subscribe to events from KV, Cloudflare Workers, R2, Workers AI, and Vectorize.

Key Features

Background Pattern
Event subscriptions across the Cloudflare platform

Get notified and take action programmatically through Workers by using queues to subscribe to events from: KV, Cloudflare Workers, R2, Workers AI, Vectorize

Background Pattern
Built-in metrics and observability

Queues expose metrics which allow you to measure the queue backlog, consumer concurrency, and message operations.

Background Pattern
Batching, delays and retries

Control message delivery by grouping messages into batches for efficient processing, delaying delivery to schedule future tasks, and automatically retrying messages that fail to process.

Background Pattern
Dead-letter queues

Automatically isolate and store messages that consistently fail processing after multiple retries, allowing you to debug problematic jobs without halting your entire queue.

Background Pattern
Pull-consumers

Gain granular control over message consumption from anywhere on the public Internet by having your services explicitly pull messages and acknowledge them upon successful processing.

Background Pattern
Queues

Perfect for

You can use Queues to:

View docs

ETL Pipelines

Reliably buffer large volumes of data for your ETL pipelines without overwhelming your databases or data warehouses. Ensure no data is lost during traffic spikes and process information at a manageable, consistent pace.

Asynchronous user-lifecycle tasks

Offload time-consuming user-lifecycle tasks like sending welcome emails or processing profile pictures to a background worker. Keep your application's user interface fast and responsive by handling these jobs asynchronously.

Web crawlers

Build distributed and resilient web crawlers by using Queues to manage the list of URLs to be fetched and processed. Easily scale your crawling infrastructure by adding more consumers and automatically retry failed jobs to ensure comprehensive data collection.

Async as it should be

Code samples that show how to send, process, and scale message workflows with Workers.

Background Pattern
// Producer Worker - Send messages to queue
export default {
  async fetch(request, env) {
    const { searchParams } = new URL(request.url);
    const message = searchParams.get('message');
    
    if (!message) {
      return new Response('Missing message parameter', { status: 400 });
    }

    // Send message to queue
    await env.MY_QUEUE.send({
      message: message,
      timestamp: new Date().toISOString(),
      userId: request.headers.get('X-User-ID')
    });

    return new Response('Message sent to queue', { status: 200 });
  }
};

// Consumer Worker - Process messages from queue
export default {
  async queue(batch, env, ctx) {
    for (const message of batch.messages) {
      try {
        // Process the message
        console.log('Processing message:', message.body);
        
        // Simulate some work
        await new Promise(resolve => setTimeout(resolve, 1000));
        
        // Acknowledge the message
        message.ack();
      } catch (error) {
        console.error('Failed to process message:', error);
        message.retry();
      }
    }
  }
};

Queues Pricing

Reliable message processing. View Other Services pricing details

Standard Operations

Free

Paid

$0.40 / million operations

SiteGPT

We use Cloudflare for everything – storage, cache, queues, and most importantly for training data and deploying the app on the edge, so I can ensure the product is reliable and fast. It's also been the most affordable option, with competitors costing more for a single day's worth of requests than Cloudflare costs in a month. ”

Bhanu Teja Pachipulusu
Bhanu Teja Pachipulusu Founder

Powerful primitives, seamlessly integrated

Built on systems powering 20% of the Internet, Queues run on the same infrastructure Cloudflare uses to build Cloudflare. Enterprise-grade reliability, security, and performance are standard.

Build without boundaries

Join thousands of developers who've eliminated infrastructure complexity and deployed globally with Cloudflare. Start building for free — no credit card required.