Hello,
I’m trying to create a simple system, with a command side and a query side in two spring-boot based services.
The aggregate inside the command side is handling the command which is written in the db, the generated event is then sent through RabbitMQ but the eventhandler inside the other service is not called.
I’ve tried so many things and I don’t know how to solve.
Thanks for any help (also, while this is a development code which went throu many tests to get this working, I’m very open to any suggestions or other strange/unusual code - I’m new to Spring).
Instead of name, you should specify the actual name of your processor. This defaults to the package name of the class with the @EventHandler annotated methods. You can override this by adding a @ProcesingGroup annotation on the class.
Thanks a lot! Adding the @ProcessingGroup notation helped. One more thing: have someone any idea why the queue may be delivering one message every two?
Thanks again and have a good WE!
FP
On the query side application your are using the same Queue you have configured and created on the command side. This is not a publish-subscribe model you probably want to achieve.
Your event handlers in different services (command application & query application) will compete reading the messages on the same queue. In order to implement publish-subscribe model you can configure a unique Queue for each service (application). You can do that by configuring new unique Queue on the query side application, and bind it to the same exchange ‘Axon.EventBus’. This is the simplest solution (one unique queue per service). RabbitMQ allows more sophisticated message routing…