Skip to content

OffsetStore

Defined in: src/persistence/projection/OffsetStore.ts:19

Per-projection persistent cursor. The ProjectionActor loads the offset on preStart and writes it back after every successfully-handled event. The pair of (load → handle event → save) gives at-least-once delivery: the same event can be re-handled if the projection crashes between handle and save, which is exactly why projection handlers must be idempotent.

Two flavours of cursor are stored: a simple integer (sequence-based, used by eventsByPersistenceId) and the composite Offset (timestamp-based, used by eventsByTag). The store persists both as plain JSON so the underlying backend doesn’t need to know about the difference.

clear(projectionName): Promise<void>

Defined in: src/persistence/projection/OffsetStore.ts:27

Forget every cursor for projectionName. Used by tests + reset tooling.

string

Promise<void>


loadOffset(projectionName, tag): Promise<Offset>

Defined in: src/persistence/projection/OffsetStore.ts:23

string

string

Promise<Offset>


loadSequence(projectionName, persistenceId): Promise<number>

Defined in: src/persistence/projection/OffsetStore.ts:20

string

string

Promise<number>


saveOffset(projectionName, tag, offset): Promise<void>

Defined in: src/persistence/projection/OffsetStore.ts:24

string

string

Offset

Promise<void>


saveSequence(projectionName, persistenceId, seqNr): Promise<void>

Defined in: src/persistence/projection/OffsetStore.ts:21

string

string

number

Promise<void>