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

Dispatches one delivered batch into the registered processors.

Every message is acked or retried exactly once:

  • a body that is not a readable envelope → retry(), because a message the consumer cannot route is a configuration problem and acking would discard it permanently and silently;
  • a name with no registered processor → retry(), same reason;
  • attempts past the envelope's maxAttemptsack() without running the processor, since the caller asked for the job to stop;
  • a processor that throws → retry(), leaving the queue's own max_retries and dead-letter configuration to decide what happens next;
  • a processor that resolves → ack().

Parameters

The delivered batch

Return Type

Promise<void>

Resolves once every message has been acked or retried

Usage

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