Publishing events from a command handler defined in an Aggregate ?


I would like to know if it make sense to publish events from an Aggregate ? And if yes, how should I do that ?

Actually, I can already publish events from a separate command handler, but from an aggregate I don’t have access to the event bus (didn’t find any way to get/inject its reference).

Thanks a lot for your help,


the primary purpose of the command model is to publish event, so yes, it definitely does make sense. You should use the apply method, as described in the ref guide: