About event handler in aggregate in spring cloud amqp distributed env

I implemented axon in a spring cloud micro service system. Currently the running process is as below:

  1. the command is dispatched in spring cloud services, and handled by one service.
  2. for command is handled by one service instance, and applied an event.
  3. that service instance handled the event by calling event handler method. (this is a local call)
  4. the event is dispatched to amqp queue.
  5. another query service got the msg from the queue, and the handler method is called, and save view data into DB.

My question is, the event handler method in aggregate is called locally, is that right?
What I had thought is, all event would be dispatched to amqp, and got by event processor with some message source, and call related handler method.

No any help?

Yes that is correct. @EventSourcingHandler use to update the Aggregate state. But the event will push to the relevant queues.
https://github.com/keaz/cqrs_axon/blob/dev/command/src/main/java/com/ktzone/cqrs/command/aggregate/Employee.java

Hi Mavlarn/Kasun,

What Kasun points out is correct

The event sourcing (note sourcing here) handler in the aggregate will only handle events which have been published by that Aggregate itself.

Thus, an Aggregate cannot handle events which are published by other instances of that Aggregate or entirely different services for that matter.

I hope this clarifies some concerns you guys might have.

Cheers,

Steven