Skip to main content

Committed

@rotorsoft/act-root


@rotorsoft/act-root / act/src / Committed

Type Alias: Committed<TEvents, TKey>

Committed<TEvents, TKey> = Message<TEvents, TKey> & CommittedMeta

Defined in: libs/act/src/types/action.ts:193

A committed event with complete metadata.

Committed events include the message data plus metadata about when and how the event was created, including correlation and causation information for tracing event-driven workflows.

Type Parameters

TEvents

TEvents extends Schemas

Schemas map

TKey

TKey extends keyof TEvents

Event name

Example

// Committed events include:
// - id: global sequence number
// - stream: which state instance
// - version: event number within stream
// - created: timestamp
// - meta: correlation and causation

app.on("committed", (snapshots) => {
snapshots.forEach(snap => {
if (snap.event) {
console.log(`Event ${snap.event.name} #${snap.event.id}`);
console.log(`Stream: ${snap.event.stream} v${snap.event.version}`);
console.log(`Data:`, snap.event.data);
}
});
});

See

CommittedMeta for metadata structure