EventSourcingStateAggregateRepository
Repository for loading state aggregates using event sourcing. This repository reconstructs the current state of an aggregate by combining snapshots (if available) with event streams from the event store. It supports loading aggregates up to a specific version or event time, enabling point-in-time state reconstruction.
The loading process works as follows:
If loading the latest version (tailVersion = Int.MAX_VALUE), attempt to load from snapshot first.
If no snapshot exists, create a new aggregate instance.
Apply events from the event store starting from the aggregate's expected next version.
Author
ahoo wang
Parameters
Factory for creating new state aggregate instances.
Repository for loading and storing aggregate snapshots.
Store for retrieving event streams associated with aggregates.
Constructors
Functions
Loads a state aggregate by its ID up to a specified version.
Loads a state aggregate by its ID up to a specified event time.