AggregateLifecycleprovides a simple means to achieve the above:
AggregateLifecycle#apply(Object)will go through a number of steps:
Object, will be wrapped in an
EventMessagewill also receive the
sequenceNumberfrom the previous step, as well as the Aggregate it's identifier.
MetaData in Aggregate Event MessagesThe
AggregateLifecyclealso provides an
apply(Object, MetaData)function. This can be used to attach command-handler specific MetaData.