Event applied to an aggregate state results in a modified aggregate state:
(aggregate, Event) -> aggregate'
Commands are handled by aggregates resulting in a zero, one or several events:
(Aggregate, Command) -> Vec<NewEvent>
(NewEvent, Store) -> DomainEvent
Aggregates have a generation property. The generation of an aggregate enumerates the number of modifications through a sequence of applied events.
Applying an event to an aggregate advances its state from the current generation n to the next generation n+1:
(Aggregate(n), DomainEvent) -> Aggregate(n+1)
Aggregates can be replayed by applying all stored events to a newly initialized aggregate:
(initialized aggregate, &[DomainEvent]) -> current aggregate
Given a command we need to find the right aggregate instance to handle it.
When dispatcher gets the aggregate instance it calls the handle_command function. The returned
list of events (
Vec<NewEvent>) will be enriched with the address properties of the aggregate to
get the related