Uses of Package
dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern
-
Packages that use dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern Package Description dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern -
Classes in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern used by dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern Class Description AggregateRoot A modern opinionated interpretation of the classicAggregateRootdesign, where theEvent's are mutable.
The modern interpretation doesn't specify any requirement on the design of the Events, they can be Java 17+ records or simple POJO's.
Note: TheAggregateRootworks best in combination with theStatefulAggregateRepositorythat's configured to use theStatefulAggregateInstanceFactory.reflectionBasedAggregateRootFactory(), because theAggregateRootneeds to be provided its aggregated id through theAggregateRoot(Object)constructor!
The modernAggregateRootsupports keeping the state projection andEventHandlerannotated methods within theAggregateRootinstance or within anAggregateStateinstance.
If you wish to keep the state projection andEventHandlerannotated methods within anAggregateStateinstance, then you only need to implement theWithStateinterface:AggregateState Aggregate state object associated with a givenAggregateRootinstance (seeAggregateState.getAggregate())
Example: