Interface EventStoreClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InMemoryEventStore, LocalEventStoreClient, WebSocketEventStoreClient
Low-level client interface for interacting with the event store in Fluxzero.
This interface provides operations for storing, retrieving, and deleting event streams related to event-sourced aggregates, as well as managing entity relationships such as aggregate references and links.
Users rarely interact with this interface directly. Instead, they typically use higher-level abstractions such as:
EventStoreAggregateRepository- Static methods on
Fluxzero, e.g.Fluxzero.loadAggregate(...).
This interface is backed either by:
- a connection to the Fluxzero Runtime using a websocket-based implementation, or
- an in-memory store used for testing or standalone development purposes.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionCompletes after every affected root in a graph projection has crossed the requested committed state boundary.voidclose()Closes the client and releases any open resources or connections.default CompletableFuture<CommitModelsResult> commitModels(CommitModels commit) Atomically commits the ordered state transitions of one independent-model commit.default CompletableFuture<Void> deleteEvents(String aggregateId) Deletes all events for a specific aggregate.deleteEvents(String aggregateId, Guarantee guarantee) Deletes all events for a specific aggregate with a given delivery guarantee.default CompletableFuture<ModelDeletionResult> deleteModel(DeleteModel request) Executes or resumes an idempotent independent-model hard deletion.getAggregateIds(GetAggregateIds request) Gets aggregate IDs based on aGetAggregateIdsrequest.getAggregatesFor(String entityId) Gets a map of aggregate IDs that reference a given entity ID.default AggregateEventStream<SerializedMessage> Retrieves the full event stream for a given aggregate.default AggregateEventStream<SerializedMessage> Retrieves the event stream for an aggregate starting after the given sequence number.Retrieves the event stream for an aggregate with control over size and offset.default GetModelChangeResultgetModelChange(GetModelChange request) Resolves the durable targets of one model-commit substep.default GetModelEventsResultgetModelEvents(GetModelEvents request) Batch-loads independent model heads and event memberships at one pinned state boundary.default GetModelGraphResultgetModelGraph(GetModelGraph request) Loads one bounded temporal model graph and an optional first page of its grouped model streams.default ModelGraphProjectionStatusReturns the current high-watermark and backlog for one materialized graph projection.getRelationships(GetRelationships request) Gets relationships based on aGetRelationshipsrequest.default List<Relationship> getRelationships(String entityId) Gets relationships for the given entity.default ModelDeletionPlanplanModelDeletion(PlanModelDeletion request) Creates a bounded, non-mutating plan for an explicit independent-model hard deletion.Idempotently registers an asynchronous materialized model-graph projection.default CompletableFuture<Boolean> reindexModel(ReindexModel request) Refreshes a canonical Model source without changing its head or history.repairRelationships(RepairRelationships request) Repairs entity relationships, e.g. by forcing re-evaluation of existing relationships.default CompletableFuture<Void> storeEvents(String aggregateId, List<SerializedMessage> events, boolean storeOnly) Stores a list of serialized events for a given aggregate identifier.storeEvents(String aggregateId, List<SerializedMessage> events, boolean storeOnly, Guarantee guarantee) Stores events for a given aggregate with an explicit guarantee.default CompletableFuture<TrackModelUpdatesResult> trackModelUpdates(TrackModelUpdates request) Long-polls committed independent-model commit substeps after a client-controlled state cursor.updateRelationships(UpdateRelationships request) Updates entity relationships in the event store (e.g. parent-child, references).
-
Method Details
-
commitModels
Atomically commits the ordered state transitions of one independent-model commit.Unlike aggregate event appends, this operation returns the runtime-assigned state, event, and per-model stream positions. Implementations predating independent models remain source-compatible and fail only when this capability is invoked.
- Parameters:
commit- complete model commit with its durable idempotency key- Returns:
- durable result containing the positions assigned by the event store
-
reindexModel
Refreshes a canonical Model source without changing its head or history. -
getModelEvents
Batch-loads independent model heads and event memberships at one pinned state boundary. -
trackModelUpdates
Long-polls committed independent-model commit substeps after a client-controlled state cursor. -
getModelGraph
Loads one bounded temporal model graph and an optional first page of its grouped model streams. -
getModelChange
Resolves the durable targets of one model-commit substep. -
registerModelGraphProjection
default CompletableFuture<ModelGraphProjectionStatus> registerModelGraphProjection(RegisterModelGraphProjection request) Idempotently registers an asynchronous materialized model-graph projection. -
getModelGraphProjectionStatus
default ModelGraphProjectionStatus getModelGraphProjectionStatus(GetModelGraphProjectionStatus request) Returns the current high-watermark and backlog for one materialized graph projection. -
awaitModelGraphProjection
default CompletableFuture<ModelGraphProjectionStatus> awaitModelGraphProjection(AwaitModelGraphProjection request) Completes after every affected root in a graph projection has crossed the requested committed state boundary. -
planModelDeletion
Creates a bounded, non-mutating plan for an explicit independent-model hard deletion. -
deleteModel
Executes or resumes an idempotent independent-model hard deletion. -
storeEvents
default CompletableFuture<Void> storeEvents(String aggregateId, List<SerializedMessage> events, boolean storeOnly) Stores a list of serialized events for a given aggregate identifier.- Parameters:
aggregateId- The ID of the aggregate.events- The serialized events to store.storeOnly- Whether to store the events without publishing them.- Returns:
- A future that completes when the operation is acknowledged.
-
storeEvents
CompletableFuture<Void> storeEvents(String aggregateId, List<SerializedMessage> events, boolean storeOnly, Guarantee guarantee) Stores events for a given aggregate with an explicit guarantee.- Parameters:
aggregateId- The aggregate ID.events- Events to store.storeOnly- Iftrue, events will not be published.guarantee- The guarantee level for this operation.- Returns:
- A future representing completion of the store operation.
-
getEvents
Retrieves the full event stream for a given aggregate.- Parameters:
aggregateId- The aggregate ID.- Returns:
- A stream of serialized events.
-
getEvents
default AggregateEventStream<SerializedMessage> getEvents(String aggregateId, long lastSequenceNumber) Retrieves the event stream for an aggregate starting after the given sequence number.- Parameters:
aggregateId- The aggregate ID.lastSequenceNumber- The sequence number to start from (exclusive).- Returns:
- A stream of serialized events.
-
getEvents
AggregateEventStream<SerializedMessage> getEvents(String aggregateId, long lastSequenceNumber, int maxSize) Retrieves the event stream for an aggregate with control over size and offset.- Parameters:
aggregateId- The aggregate ID.lastSequenceNumber- Sequence number to resume after.maxSize- Maximum number of events to return (or -1 for unlimited).- Returns:
- A stream of serialized events.
-
deleteEvents
Deletes all events for a specific aggregate.- Parameters:
aggregateId- The aggregate ID.- Returns:
- A future that completes when deletion is acknowledged.
-
deleteEvents
Deletes all events for a specific aggregate with a given delivery guarantee.- Parameters:
aggregateId- The aggregate ID.guarantee- The guarantee to apply.- Returns:
- A future that completes when deletion is acknowledged.
-
updateRelationships
Updates entity relationships in the event store (e.g. parent-child, references).- Parameters:
request- The update request.- Returns:
- A future that completes when the operation is acknowledged.
-
repairRelationships
Repairs entity relationships, e.g. by forcing re-evaluation of existing relationships.- Parameters:
request- The repair request.- Returns:
- A future that completes when the repair is done.
-
getAggregatesFor
-
getAggregateIds
Gets aggregate IDs based on aGetAggregateIdsrequest.- Parameters:
request- The request containing filtering options.- Returns:
- A map of aggregate IDs referencing the target entity.
-
getRelationships
Gets relationships for the given entity.- Parameters:
entityId- The entity ID.- Returns:
- A list of matching relationships.
-
getRelationships
Gets relationships based on aGetRelationshipsrequest.- Parameters:
request- The request containing filter parameters.- Returns:
- A list of matching relationships.
-
close
void close()Closes the client and releases any open resources or connections.- Specified by:
closein interfaceAutoCloseable
-