Package dk.cloudcreate.essentials.components.eventsourced.aggregates.decider
package dk.cloudcreate.essentials.components.eventsourced.aggregates.decider
-
ClassDescriptionAggregateIdResolver<T,
ID> Interface responsible for resolve the optional aggregate id associated with the typeT
Example of usages:
Command - return the aggregate id associated with the command (can return anOptional.empty()) in case server generated id's are used for commands that create a new Aggregate instance) Event - return the aggregate id associated with the event State - return the aggregate id associated with the aggregate state event projection View - return the aggregate id associated with the View event projectionCommandHandler<COMMAND,EVENT, ERROR> Command Handler which is responsible for loading any existing AggregateSTATEfrom the underlyingEventStore(seeCommandHandler.deciderBasedCommandHandler(ConfigurableEventStore, AggregateType, Class, AggregateIdResolver, AggregateIdResolver, AggregateSnapshotRepository, Class, Decider)) and coordinate persisting any changes to the Aggregate, in the form ofEVENT's, to theEventStoreas part of an activeUnitOfWork(if one exists)
The actual logic is delegated to an instance of aDeciderDecider<COMMAND,EVENT, ERROR, STATE> Variant of the event sourced Decider pattern, which supports building an AggregateSTATEbased on previousEVENT's that relate to the aggregate instance, and which can handleCOMMAND's, whose side effect is either anERRORor a List ofEVENT's (can be an empty list)Handler<COMMAND,EVENT, ERROR, STATE> Deciderrelated interface that is responsible for handlingCOMMAND(s),whose side effect is either anERRORor a List ofEVENT's (can be an empty list)HandlerResult<ERROR,EVENT> Captures that result of calling aHandler.handle(Object, Object)for a specificCOMMANDand aggregateSTATE
Concrete instances can either be of typeHandlerResult.Successor typeHandlerResult.ErrorHandlerResult.Error<ERROR,EVENT> Error variant of theHandlerResultHandlerResult.Success<ERROR,EVENT> Success variant of theHandlerResultInitialStateProvider<STATE>DeciderorViewrelated interface, which provides the InitialSTATEfor a given aggregate/projection/view.
TheInitialStateProviderworks in collaboration with theStateEvolverin the context of theDeciderorViewpatternIsStateFinalResolver<STATE>Deciderrelated interface that resolves if the aggregate's state is final and no more changes can occur, i.e.StateEvolver<STATE,EVENT> View<STATE,EVENT> Variant of the Event Sourced Projection/View concept