Skip to content

DefineEventConsumerOptions

Defined in: packages/server/src/events/consumer.ts:193

TRegistry extends SyncTableRegistry

optional batchSize?: number

Defined in: packages/server/src/events/consumer.ts:210

Max messages per read. Defaults to DEFAULT_EVENT_CONSUMER_BATCH_SIZE.


callback: EventConsumerCallback

Defined in: packages/server/src/events/consumer.ts:202


optional concurrency?: number

Defined in: packages/server/src/events/consumer.ts:223

Max CONCURRENT callback invocations per Event stream. Defaults to 1 (strictly sequential). Values above 1 are safe for the idempotent callback the lane already requires: ADR-0053 decision 6 disclaims any ordering across sub-batches precisely so concurrency is available. Reads stay serial — only the callbacks of one delivered read run in parallel.


optional maxAttempts?: number

Defined in: packages/server/src/events/consumer.ts:228

Deliveries a sub-batch gets before a further callback failure dead-letters it. Defaults to DEFAULT_EVENT_MAX_ATTEMPTS. A malformed body never gets attempts — it dead-letters on sight.


optional onDeadLetter?: (report) => void

Defined in: packages/server/src/events/consumer.ts:235

Notified for every dead-lettered sub-batch. The runner ALSO warn-logs each one unconditionally: loudness is the ADR’s requirement and a hook that swallows (or throws) must not be able to make a dead letter silent.

EventDeadLetterReport

void


optional poll?: EventConsumerPollOptions

Defined in: packages/server/src/events/consumer.ts:230

Adaptive-poll tuning. See EventConsumerPollOptions.


queue: EventQueue

Defined in: packages/server/src/events/consumer.ts:201

The queue to consume from — REQUIRED, and the reason the runner is backend-agnostic by construction. The ordinary wiring is createPgmqEventQueue({ db }) with the app’s own drizzle handle; constructing it here from a db option would bake the shipped backend into the runner for one line of ergonomics.


registry: TRegistry

Defined in: packages/server/src/events/consumer.ts:195

The sync registry whose streams this runner consumes.


optional streams?: readonly string[]

Defined in: packages/server/src/events/consumer.ts:208

Narrow to a subset of the registered Event streams — the knob that splits streams across processes. Defaults to ALL registered streams. An unknown name is a definition-time throw (fail-closed): a runner that silently consumed nothing is the failure mode this forbids.


optional visibilityTimeoutSeconds?: number

Defined in: packages/server/src/events/consumer.ts:216

The delivered-message invisibility window, renewed at half of it while the runner is still working through a read. Defaults to DEFAULT_EVENT_VISIBILITY_TIMEOUT_SECONDS. Size it above ONE callback’s worst case (renewal covers the rest of the batch), not above the whole batch’s.