Interface StateRebuildingHandler<I,E>

Type Parameters:
I - the instance type
E - the event type to be sourced
All Known Subinterfaces:
StateRebuildingHandler.FromObject<I,E>, StateRebuildingHandler.FromObjectAndMetaData<I,E>, StateRebuildingHandler.FromObjectAndMetaDataAndSubject<I,E>, StateRebuildingHandler.FromObjectAndMetaDataAndSubjectAndRawEvent<I,E>, StateRebuildingHandler.FromObjectAndRawEvent<I,E>

Sealed base interface for inherited FunctionalInterface variants encapsulating the event-sourcing logic needed to reconstruct instance state from an event stream.

Implementations of this will be used during Command execution as follows:

  1. The instance state will be reconstructed based on the Events sourced for the Command.getSubject() before the CommandHandler execution, after they have been successfully upcasted and converted to their appropriate Java object type. This phase allows access to the raw Event read from the event store.
  2. Any event published during command execution via CommandEventPublisher will be applied to update the instance state before the events will be written to the event store. Hence, this phase does not have access to the raw Event.