WriteQueue
Source:
src/Cloudflare/Queues/WriteQueue.ts
Binding service that turns a {@link Queue} resource into a typed {@link WriteQueueClient} you can call from a Worker’s runtime Effect.
The Cloudflare Worker queue binding is producer-only — send for a
single message and sendBatch for many in one call. Messages can be
any JSON-serializable value.
Sending Messages
Section titled “Sending Messages”Producer route
const queue = yield* Cloudflare.Queues.WriteQueue(Queue);
return { fetch: Effect.gen(function* () { yield* queue.send({ text: "hi", sentAt: Date.now() }); return HttpServerResponse.empty({ status: 202 }); }),};Sending a batch
yield* queue.sendBatch([ { body: { event: "click", id: 1 } }, { body: { event: "click", id: 2 } }, { body: "raw text", contentType: "text" },]);Provide {@link WriteQueueBinding} (native Worker binding) or {@link WriteQueueHttp} (scoped HTTP token) in the worker’s runtime layer to resolve the underlying queue at request time.
WriteQueue is a single identifier that is simultaneously the binding’s
Context tag, its type, and the callable —
yield* Cloudflare.Queues.WriteQueue(queue).