Different ways to Record Events
Two ways of setting up Event Sourced Aggregates
There are two ways we can configure our Aggregate to record Events.
1) Pure Event Sourced Aggregate
This way of handling events does allow for pure functions. This means that actions called on the Aggregate returns Events and are not changing internal state of Aggregate.
Event Sourced Aggregate must provide version. You may leave it to
Ecotone
usingWithAggregateVersioning
or you can implement it yourself.EventSourcingHandler
is method responsible for reconstructingAggregate
from previously created events. At least one event need to be handled in order to provideIdentifier
.
2) Internal Recorder Aggregate
In order to make use of alternative way of handling events, we need to provide trait WithEvents.
Last updated
Was this helpful?