2
votes

Currently we are using Axon 2. We would like to upgrade Axon 2 to 4. We used Axon 2 subscribing event processor with replay options. In Axon 4, One significant difference is Tracking event processors. It seems,Tracking processors are must for replay. Is it possible to have subscribing and tracking event processors? Is it possible to use tracking processors only for replay and leaving the rest? Or is it must to change whole structure?

1

1 Answers

1
votes

Let me give you some background to help on the matter.

We used Axon 2 subscribing event processor with replay options.

In Axon Framework 2.x, there was no notion of the SubscribingEventProcessor. Axon 2 used event Clusters to group event handlers and provide the technical logic of handling events.

Is it possible to have subscribing and tracking event processors?

The SubscribingEventProcessor and TrackingEventProcessor are no more than distinct implementations of an EventProcessor. The EventProcessor in turn is used to manage the technical aspect of providing events to the Event Handling Components you write.

What I mean with an "Event Handling Component", is the entire object with the @EventHandler annotated methods in it.

Thus, EventProcessors are in control of one or several event handling components. Added, you can have several of these groups as you see fit.

Concluding, it is indeed possible to have both TrackingEventProcessors and SubscribingEventProcessors in an application.

Or is it must to change whole structure?

It is here where I however would suggest to migrate towards the use of TrackingEventProcessors. What it does it truly separating your Command side from your Query side. This holds as Axon will use dedicated threads to pull the events from the EventStore when using a TrackingEventProcessor. A SubscribingEventProcessor is called within the same thread which will handle the event, which gives you a more synchronous feel to the application.

It exactly that power of segregation which makes Axon such a powerful tool to use in your application, as it provides you with the freedom to decouple your services further, whenever the need arises.

So in essence, no, you do not have to use the TrackingEventProcessor. It is however the default in Axon Framework for a reason, as it provides a lot of benefits (allowing replays being one of them) for application developers.

In the mean time, it might be interesting to read up on this blog from AxonIQ on the TrackingEventProcessor. Additionally, AxonIQ has been giving webinars providing a quick overview of Axon entirely, giving you the option to ask questions too. Here's a link for the webinar in question.