I have defined a Microservice:
AccountManagementService
- Handles CreateAccountCommand
- CreateAccountCommand shoots AccountCreatedEvent
- The new Account is then stored in mysql db
- Axon Server is used to store the event
Now I want another microservice B (that is connected to the same Axon Server) to handle the AccountCreatedEvent too.
Can I simply put
@EventHandler
protected void on(AccountCreatedEvent event){
}
in the second microservice B (for example in an Aggregate)? I tried that under the assumption that the event is stored in Axon Server and my second microservice automatically listens to that published event. It didn't work unfortunately.
How can microservice B subscribe to events (published by AccountManagementService) in the Axon Server?
