Class InMemoryEventStore
java.lang.Object
io.fluxcapacitor.javaclient.tracking.client.InMemoryMessageStore
io.fluxcapacitor.javaclient.persisting.eventsourcing.client.InMemoryEventStore
- All Implemented Interfaces:
Monitored<List<SerializedMessage>>
,HasMessageStore
,MessageStore
,EventStoreClient
,AutoCloseable
An implementation of the
EventStoreClient
interface that provides an in-memory event storage solution. This
class extends InMemoryMessageStore
to inherit message store functionality and provides additional
capabilities for storing, retrieving, updating, and managing aggregate event streams and relationships in memory.
It is designed for use cases where events and relationships are stored and maintained in the application memory, which makes it lightweight but volatile. The stored data will not persist beyond the lifetime of the application process and is typically used in test scenarios or for development purposes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeleteEvents
(String aggregateId, Guarantee guarantee) Deletes all events for a specific aggregate with a given delivery guarantee.getAggregateIds
(GetAggregateIds request) Gets aggregate IDs based on aGetAggregateIds
request.Retrieves the event stream for an aggregate with control over size and offset.getRelationships
(GetRelationships request) Gets relationships based on aGetRelationships
request.repairRelationships
(RepairRelationships request) Repairs entity relationships, e.g. by forcing re-evaluation of existing relationships.storeEvents
(String aggregateId, List<SerializedMessage> events, boolean storeOnly, Guarantee guarantee) Stores events for a given aggregate with an explicit guarantee.toString()
updateRelationships
(UpdateRelationships request) Updates entity relationships in the event store (e.g. parent-child, references).Methods inherited from class io.fluxcapacitor.javaclient.tracking.client.InMemoryMessageStore
append, close, filterMessages, getBatch, getMessage, notifyMonitors, notifyMonitors, purgeExpiredMessages, registerMonitor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.javaclient.persisting.eventsourcing.client.EventStoreClient
close, deleteEvents, getAggregatesFor, getEvents, getEvents, getRelationships, storeEvents
Methods inherited from interface io.fluxcapacitor.common.tracking.MessageStore
append, getBatch, getMessageStore, setRetentionTime, unwrap
-
Constructor Details
-
InMemoryEventStore
public InMemoryEventStore() -
InMemoryEventStore
-
-
Method Details
-
storeEvents
public CompletableFuture<Void> storeEvents(String aggregateId, List<SerializedMessage> events, boolean storeOnly, Guarantee guarantee) Description copied from interface:EventStoreClient
Stores events for a given aggregate with an explicit guarantee.- Specified by:
storeEvents
in interfaceEventStoreClient
- 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.
-
updateRelationships
Description copied from interface:EventStoreClient
Updates entity relationships in the event store (e.g. parent-child, references).- Specified by:
updateRelationships
in interfaceEventStoreClient
- Parameters:
request
- The update request.- Returns:
- A future that completes when the operation is acknowledged.
-
repairRelationships
Description copied from interface:EventStoreClient
Repairs entity relationships, e.g. by forcing re-evaluation of existing relationships.- Specified by:
repairRelationships
in interfaceEventStoreClient
- Parameters:
request
- The repair request.- Returns:
- A future that completes when the repair is done.
-
getEvents
public AggregateEventStream<SerializedMessage> getEvents(String aggregateId, long lastSequenceNumber, int maxSize) Description copied from interface:EventStoreClient
Retrieves the event stream for an aggregate with control over size and offset.- Specified by:
getEvents
in interfaceEventStoreClient
- 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
Description copied from interface:EventStoreClient
Deletes all events for a specific aggregate with a given delivery guarantee.- Specified by:
deleteEvents
in interfaceEventStoreClient
- Parameters:
aggregateId
- The aggregate ID.guarantee
- The guarantee to apply.- Returns:
- A future that completes when deletion is acknowledged.
-
getAggregateIds
Description copied from interface:EventStoreClient
Gets aggregate IDs based on aGetAggregateIds
request.- Specified by:
getAggregateIds
in interfaceEventStoreClient
- Parameters:
request
- The request containing filtering options.- Returns:
- A map of aggregate IDs referencing the target entity.
-
getRelationships
Description copied from interface:EventStoreClient
Gets relationships based on aGetRelationships
request.- Specified by:
getRelationships
in interfaceEventStoreClient
- Parameters:
request
- The request containing filter parameters.- Returns:
- A list of matching relationships.
-
toString
- Overrides:
toString
in classInMemoryMessageStore
-