Skip to content

EventsEnqueuedHook

EventsEnqueuedHook = (info) => void

Defined in: packages/server/src/events/route.ts:93

Fired after a request has ENQUEUED at least one sub-batch (ADR-0053 amendment, 2026-08-02) — the deployment-agnostic seam a serverless deployment uses to NUDGE its drain function.

The library stays out of the transport: this hook hands over “something landed on these streams” and the deployment decides what that means. A long-lived runner deployment wires nothing (its poller is already about to read). A serverless one fires a fetch-and-forget at whatever endpoint calls the consumer’s drainOnce(), so an interactive append is drained in milliseconds rather than at the next scheduled tick.

It is latency, never delivery. The scheduled sweep is the guarantee; a nudge that is lost, refused or never sent costs nothing but time. So it is fire-and-forget by construction: it is called AFTER the enqueue transaction committed, its return value is ignored (it is void — do not await anything through it), and a throw is caught and warn-logged rather than affecting the response the client already earned.

EventsEnqueuedInfo

void