method WorkersBroker.prototype.dispatch
WorkersBroker.prototype.dispatch(batch: IQueueMessageBatch): Promise<void>

Dispatches one delivered batch into the registered subscribers and responders.

Every message is acked or retried exactly once:

  • a body that is not a readable envelope → retry(), because a foreign producer or a version skew is a configuration problem and acking would discard the message permanently and silently;
  • a publish whose topic has no subscriber → ack(), because publishing to a topic nobody listens on is ordinary pub/sub, and retrying would burn the queue's retry budget and dead-letter every fire-and-forget message;
  • a publish whose handler throws → retry(), leaving the queue's own max_retries and dead-letter configuration to decide what happens next;
  • a request whose topic has no responder, or whose responder throws → ack() after sending the caller a failed reply, because the caller is waiting and a redelivery would re-run a handler that already ran.

Parameters

The delivered batch

Return Type

Promise<void>

Resolves once every message has been acked or retried

Usage

import { WorkersBroker } from "cloudflare-plugin/src/index.ts";