Recently our project got upgraded from Axon 3.2 to Axon 4.x(Enabled Distributed Bus). However we see the default saga config to be running asynchronously which made some of our scenarios to run into a race conditions. Earlier we designed our whole domain driven design to run the sagas synchronously when an event is fired from an aggregate. So how can I setup the sagas back to synchronous mode.
Firstly, note that this is not only a direct channel to the AxonIQ team, but to anybody in the community.
With that said, I’d like to state that I am happy to hear you’ve migrated to Axon 4.x!
Know that 4.2 has been released a couple of weeks ago, so I would suggest to move to the latest whilst you’re following this upgrade process.
Then, for your request, one of the main changes we’ve put through was to replace the Subscribing Event Processor for the Tracking Event Processor as the default.
We view this as ideal, as decoupling your threads in doing so, thus by making it asynchronous, is definitely the strong suit of following the paradigm Axon helps you with.
If you still feel you have to revert this to fully synchronous (which has definite drawbacks when it comes to performance of course), then you can simply switch back the default from tracking to subscribing.
Take a look at the EventProcessingConfigurer#usingSubscribingEventProcessors method.
Calling that method in your configuration will flip the default back to subscribing, making everything async.
Hope this helps Krishna!
Thank you so much Steven.