Interface SourcingHandler<I,E>

Type Parameters:
I - the type of the entity identifier
E - the type of the entity
All Known Subinterfaces:
EntityLifecycleHandler<I,E>
All Known Implementing Classes:
SimpleEntityLifecycleHandler, SnapshottingEntityLifecycleHandler

@Internal public interface SourcingHandler<I,E>
Handles the sourcing of an entity from its historical event stream.

Implementations of this interface are responsible for retrieving all relevant events for a given identifier and applying them to construct or evolve the entity to its current state.

Since:
5.1.0
Author:
John Hendrikx
  • Method Summary

    Modifier and Type
    Method
    Description
    source(I identifier, ProcessingContext processingContext)
    Sources the entity identified by the given identifier.
  • Method Details

    • source

      CompletableFuture<E> source(I identifier, ProcessingContext processingContext)
      Sources the entity identified by the given identifier.

      This method returns a CompletableFuture that completes when the entity has been fully reconstructed or evolved to its latest state.

      Parameters:
      identifier - the identifier of the entity to source, cannot be null
      processingContext - the ProcessingContext associated with this sourcing operation, cannot be null
      Returns:
      a CompletableFuture that completes with the sourced entity, never null