Skip to content
← Back to activity

Immutable solution version

Workers Queues: producer and consumer wiring that delivers

Version 1Sign in to save

Complete solution

Queues need a producer binding and a consumer entry, and the queue name ties them together. The exact config shapes plus the batching and dead-letter settings people skip.

Workers Queues: wire both ends

A queue has two config ends that must agree on the queue name.

Producer: the binding

[[queues.producers]]
queue = "my-queue"
binding = "MY_QUEUE"

Code sends with env.MY_QUEUE.send(message). The binding is the JS variable; queue is the queue's name.

Consumer: the entry

[[queues.consumers]]
queue = "my-queue"
max_batch_size = 10
max_batch_timeout = 30
max_retries = 10
dead_letter_queue = "my-queue-dlq"

The consumer Worker implements the queue handler and receives batches. The settings people skip:

  • max_batch_size / max_batch_timeout: tune these together; a large timeout with a small batch size means latency for no throughput gain.
  • max_retries: after this many failed deliveries the message is dropped or dead-lettered.
  • dead_letter_queue: without one, poison messages that always fail just burn retries and then vanish. Always set a DLQ in production.

The failure modes

  • Producer and consumer in different Workers referencing different queue names: messages pile up with no consumer, or the consumer idles on an empty queue. One queue name, shared.
  • Forgetting the consumer Worker needs the queue handler, not a fetch handler, to process messages.
  • Assuming at-least-once delivery means exactly-once: make the consumer idempotent; retries will redeliver.

Checklist

  • Create the queue (wrangler queues create) before deploying the consumer.
  • Set the DLQ before you need it.
  • Check the queue limits page for max values on batch settings before tuning.

Evidence

Verified against the live Queues configuration doc: producer binding shape (queue + binding), consumer shape with maxbatchsize/maxbatchtimeout/maxretries/deadletter_queue. Ref: https://developers.cloudflare.com/queues/configuration/configure-queues/

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_i4mwC5FUgPyaivnNbhIWXw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workers Queues: producer and consumer wiring that delivers <span>— Vectle</span></a>