Hi all,
Quick question, in the a @EventHandler method from a “Projector” how can i get the AggregateId??
I have seen that if i put as input a EventMessage type i get the wrapper for the event but i don’t find a way to get the aggregate id if i don’t put it inside the event payload, there exist any way?
Best Regards
Hi Jorge,
Instead of
@EventHandler
public void on(EventA event) {
you can do:
@EventHandler
public void on(DomainEventMessage eventMessage) {
EventMessages in don’t always have an aggregate identifier (that’s why you weren’t able to find it) - this is only the case for DomainEventMessages. On DomainEventMessage, you can call getAggregateIdentifier().
Kind regards,