Event handler invocation inconsistent

Hi

I am evaluating axon and am using the sample chat application as part of my POC. I am facing issue wherein event handler is not getting invoked always.
I have RoomCreatedHandler which I have attached. When the application starts up I am debugging and see that EventHandlerRegistrar.setEventHandlers gets invoked and io.axoniq.labs.chat.handler.RoomCreatedHandler (my event handler) is in the list. I also see as part of debugging that EventProcessingModule.buildEventProcessor creates MultiEventHandlerInvoker and my event handler is passed to it. When I invoke CreateRoom command it goes and creates the aggregate and invokes the event sourcing handler in the aggregate (this is happening all the time) but the RoomCreatedHandler invocation is inconsistent (sometimes it is not invoked). In my most recent run after starting the application the 1st 3 times it didn’t get invoked. After that I tried debugging AnnotatedAggregate class and it started working.

I am running it as a Java application in Eclipse (photon) and my application uses Spring Boot. I am also using spring-boot-starter-web & spring-boot-starter-data-jpa. I upgraded to axon 4.1.1 from 4.0.3 and it still didn’t resolve the issue.
I don’t see any exception in my application or axon sever. I have also tried deleting the data directory and restarting axon server.

Please suggest anything else that I can try to identify the root cause of this issue.

Thanks

Regards
Sunil

RoomCreatedHandler.java (364 Bytes)

Hi Sunil,

note that there is a difference in timing of the invocation of Event Handlers in aggregates and those outside. When apply()ing an event, event handlers inside the aggregate get invoked immediately. Event Handlers in other classes are only invoked after the unit of work in which the event was produced has committed. In fact, the other event handlers get their events from AxonServer asynchronously.

Note that we have seen some cases where spring-boot-devtools messed up with Axon’s beliefs of Event Handler interfaces. We haven’t resolved all issues there, yet. If you use dev-tools, try removing it from the classpath before running your application.

Cheers,

Hi Allard
Thanks for your response.
I stopped anti-virus running on my laptop and didn’t face this issue after that.

Regards
Sunil