Skip to main content

BatchHandler

@rotorsoft/act-root


@rotorsoft/act-root / act/src / BatchHandler

Type Alias: BatchHandler<TEvents>

BatchHandler<TEvents> = (events, stream) => Promise<void>

Defined in: libs/act/src/types/reaction.ts:259

Batch handler for projections that processes multiple events in a single call.

Receives the full ordered array of all event types declared on the projection, enabling bulk DB operations (batch INSERT/UPDATE) in a single transaction. The handler is always called when defined โ€” even for a single event.

Type Parametersโ€‹

TEventsโ€‹

TEvents extends Schemas

Event schemas (all events declared on the projection)

Parametersโ€‹

eventsโ€‹

ReadonlyArray<BatchEvent<TEvents>>

Ordered array of committed events (discriminated union)

streamโ€‹

string

The target stream name

Returnsโ€‹

Promise<void>

Seeโ€‹

BatchEvent for the discriminated union type