Complete knowledge domain for Cloudflare Queues — a flexible message queue for asynchronous processing and background tasks on Cloudflare Workers. Use when: creating message queues, async processing, background jobs, batch processing, handling retries, configuring dead letter queues, implementing consumer concurrency, or encountering "queue timeout", "batch retry", "message lost", "throughput exceeded", "consumer not scaling" errors. Keywords: cloudflare queues, queues workers, message queue, queue bindings, async processing, background jobs, queue consumer, queue producer, batch processing, dead letter queue, dlq, message retry, queue ack, consumer concurrency, queue backlog, wrangler queues
Complete knowledge domain for Cloudflare Queues - flexible message queue for asynchronous processing and background tasks on Workers.
This skill provides complete Cloudflare Queues knowledge including:
| Issue | Description | Prevention | |-------|-------------|------------| | Batch retry on single failure | One message fails → entire batch retried | Use explicit ack() for non-idempotent operations | | Messages deleted without DLQ | After max_retries, messages permanently lost | Configure dead_letter_queue in consumer | | Throughput exceeded | >5000 msg/s per queue causes errors | Document limit + implement retry logic | | Message too large | >128 KB fails to send | Validate message size before sending | | Ordering not guaranteed | Messages arrive out of order | Use timestamps, don't rely on delivery order | | Consumer timeout | Default 30s CPU limit too low | Set limits.cpu_ms up to 300000 (5 min) | | No explicit ack | DB writes/API calls repeated on retry | Always ack() after successful operations | | Rate limit errors | API rate limits (1200 req/5min) | Implement exponential backoff |
import { Hono } from 'hono';
type Bindings = {
MY_QUEUE: Queue;
};
const app = new Hono<{ Bindings: Bindings }>();
// Producer: Send message to queue
app.post('/tasks', async (c) => {
const task = await c.req.json();
// Send single message
await c.env.MY_QUEUE.send({
type: 'process-order',
orderId: task.orderId,
userId: task.userId,
});
return c.json({ status: 'queued' });
});
// Producer: Send batch of messages
app.post('/tasks/batch', async (c) => {
const tasks = await c.req.json();
// Send up to 100 messages at once
await c.env.MY_QUEUE.sendBatch(
tasks.map((task) => ({
body: {
type: 'process-order',
orderId: task.orderId,
},
}))
);
return c.json({ status: 'queued', count: tasks.length });
});
export default app;
// Consumer: Process messages from queue
export default {
async queue(
batch: MessageBatch,
env: Env,
ctx: ExecutionContext
): Promise<void> {
// Process each message
for (const message of batch.messages) {
try {
// Your processing logic
await processOrder(message.body);
// Explicitly acknowledge success
message.ack();
} catch (error) {
console.error(`Failed to process message ${message.id}:`, error);
// Retry with exponential backoff
message.retry({
delaySeconds: Math.min(60 * message.attempts, 3600),
});
}
}
},
};
SKILL.md - Complete Queues knowledge domaintemplates/wrangler-queues-config.jsonc - Producer + Consumer bindingstemplates/queues-producer.ts - Send messages (single + batch)templates/queues-consumer-basic.ts - Basic consumer (implicit ack)templates/queues-consumer-explicit-ack.ts - Explicit ack patterntemplates/queues-dlq-pattern.ts - Dead letter queue setuptemplates/queues-retry-with-delay.ts - Retry with exponential backoffreference/wrangler-commands.md - Complete CLI referencereference/producer-api.md - send/sendBatch API detailsreference/consumer-api.md - queue handler + batch operationsreference/best-practices.md - Patterns, concurrency, optimization✅ Production Ready
This skill is based on:
Last Updated: 2025-10-21 Status: Production Ready ✅ Maintainer: Jeremy Dawes | jeremy@jezweb.net
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer