Class DefaultEventStore

java.lang.Object
io.fluxcapacitor.javaclient.persisting.eventsourcing.DefaultEventStore
All Implemented Interfaces:
EventStore, HasLocalHandlers

public class DefaultEventStore extends Object implements EventStore
Default implementation of the EventStore interface, providing mechanisms to store and retrieve events associated with aggregate instances.

This implementation includes support for intercepting and modifying event messages during dispatch. The HandlerRegistry is used to locally invoke event handlers after events are published.

  • Constructor Details

    • DefaultEventStore

      public DefaultEventStore()
  • Method Details

    • storeEvents

      public CompletableFuture<Void> storeEvents(Object aggregateId, List<?> events, EventPublicationStrategy strategy)
      Description copied from interface: EventStore
      Stores a list of events for the given aggregate using a specified publication strategy.
      Specified by:
      storeEvents in interface EventStore
      Parameters:
      aggregateId - The ID of the aggregate.
      events - The events to store.
      strategy - Whether to publish the events in addition to storing them.
      Returns:
      A future that completes once the operation is acknowledged.
    • getEvents

      public AggregateEventStream<DeserializingMessage> getEvents(Object aggregateId, long lastSequenceNumber, int maxSize, boolean ignoreUnknownType)
      Description copied from interface: EventStore
      Retrieves the event stream for an aggregate with full control over behavior.
      Specified by:
      getEvents in interface EventStore
      Parameters:
      aggregateId - The ID of the aggregate.
      lastSequenceNumber - The last known sequence number to resume from.
      maxSize - The maximum number of events to return.
      ignoreUnknownType - Whether to ignore unknown payload types when deserializing events.
      Returns:
      A stream of deserialized messages representing the event history of the aggregate.