Skip to main content
Version: Current

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:198

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