DefineEventConsumerOptions
Defined in: packages/server/src/events/consumer.ts:193
Type Parameters
Section titled “Type Parameters”TRegistry
Section titled “TRegistry”TRegistry extends SyncTableRegistry
Properties
Section titled “Properties”batchSize?
Section titled “batchSize?”
optionalbatchSize?:number
Defined in: packages/server/src/events/consumer.ts:210
Max messages per read. Defaults to DEFAULT_EVENT_CONSUMER_BATCH_SIZE.
callback
Section titled “callback”callback:
EventConsumerCallback
Defined in: packages/server/src/events/consumer.ts:202
concurrency?
Section titled “concurrency?”
optionalconcurrency?: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.
maxAttempts?
Section titled “maxAttempts?”
optionalmaxAttempts?: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.
onDeadLetter?
Section titled “onDeadLetter?”
optionalonDeadLetter?: (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.
Parameters
Section titled “Parameters”report
Section titled “report”Returns
Section titled “Returns”void
optionalpoll?: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
Section titled “registry”registry:
TRegistry
Defined in: packages/server/src/events/consumer.ts:195
The sync registry whose streams this runner consumes.
streams?
Section titled “streams?”
optionalstreams?: readonlystring[]
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.
visibilityTimeoutSeconds?
Section titled “visibilityTimeoutSeconds?”
optionalvisibilityTimeoutSeconds?: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.