best practice concerning EventHandling in AggregateMembers


I have a question regarding best practice:

I would like to split up EventHandling of Child-Entity-specific events into these Entities and keep the AggregateRoot clean of that handling as much as possible. We already keep CommandHandling out in a separate Component, so we basically have left the methods applying the events and the @EventSourcingHandler annotated methods changing the state.

We have an Aggregate and a related LifeCycle Entity (Annotated @AggregateMember) within it. When a Command is published that concerns the LifeCycle (log operating hours), we would like to call it like that:


Aggregate<SomeAggregate> user = repository.load(command.getSomeAggreagteIdId());
user.execute(aggregate ->



Is that considered good practice? Would it be better to have the method logManualOperatingHours in the AggregateRoot and just the @EventSourcingHandler inside the LifeCycle-Entity?

Kind regards,
Lars Karschen

Hi Lars,

I’d say this approach is fine, to have the actually expression of intent handled by a specific entity rather than the aggregate root.
If you’d let the Aggregate handle the commands by having the @CommandHandler annotation on the functions in your Aggregate instead of loading the Aggregate yourself like in your example.
In that scenario it would be more than fine to add the @CommandHandler annotations on the entities within that Aggregate to handle that command.
Thus I’d argue your approach is also fine.

Hope this helps!