Convincing my company to use axon, but event distribution demo is not working


So, I have a JPA aggregate where all the message handlers are scattered on different Spring beans, as well as the event publishing happens through the event gateway.
So, I put @Profile annotations on these spring beans and split up the service into multiple and it all works, except that my event listener, which is supposed to log any event, doesn’t seem to receive any events.
I am using Axon Server SE for that.
Tried making event processors subscribing – no difference.
@EventHandler javadoc says to not ignore events (why do we event have to do something to not ignore events???) place the handle in an abstract class, so I put it in an aggregate superclass but – no difference.

The application is basically Allard’s bike rental demo. I have registration, rental, and return services, which all share the same H2 database.
Please, don’t mind the weirdness, this demo is gradual and in the end I will put all into the aggregate, but even then we got problems with events being ignored.

Find the sources at this branch

Actually, if I use subscribing event processors, then only one of the 3 apps logs the events. So if we only have one app instead of 3, all works great.

Also, about queries that actually go to all 3 apps, is that intended? I mean, it works, but I thought they would be routed exactly like commands

Hi Sam,

The Subscribing Event Processor is intended for use within a single JVM.
It does so by subscribing to the existing Event Bus, after which it is the Event Bus it’s job to push events towards the Subscribing Event Processor.

Axon Server does not do that operation towards any client which is connected, as that enforces distributed transactions (which are difficult and complex).

Instead, if you want to handle events amongst different application, you are required to use the Tracking Event Processor.

Thus, for demoing purposes to your company, I’d change the demo around to using Tracking Event Processors instead. :slight_smile:

Hope this sheds some light on the situation Sam.


Hi, thanks!

Sorry for a long reply. The example above already uses Tracking processors.
However, I have found what the problem was - it is that I define this event logger as an actual @EventListener but I use the same class, which leads all 3 services registering it under the same event processor name, which shares the token entry in Axon Server, which leads only one service actually printing stuff.
I’ve copy-pasted this event listener into different packages unique for each service and now all services print all events! :slight_smile:

for future reference:

I will delete the video and the help branch
You can find the solution in a commit with the name “Showcase the Location Transparency…” on the master branch