Increasing segments for Tracking Event Processors in Axon v3.x

Good morning,

Following some research regarding splitting and merging Tracking Tokens, I wanted to ask whether this can be somehow achieved in earlier versions of Axon, such as version 3.

I understand that the split/merge functionality is available since v4.1, however, I would like to understand whether there is some way (ugly or not) how to achieve the same thing with Axon versions prior to 4.1

Thank you
Karl

Hi Karl,

From what I can see in the code, multi-segmented TrackingEP are available as of Axon 3.1.
You will however need some custom/manual work to split/merge segments. What I think will work:
to split: stop your application, duplicate the existing Tracking Token entry and increment it’s segment number (I assume you want the new segment to start where the old segment stopped) ; start you application with correct number of TrackingEP segments.

Regards,
Benoît

Hi Benoit.

Thanks for replying.

need some custom/manual work to split/merge segments

It might be feasible to do this custom work at this point in time. Can you direct me to some docs/code that can get me started?

What I think will work: to split: stop your application, duplicate t…

This is in fact what is being done currently and we are looking into not creating downtime, hence the original question.

You don’t necessarily have to stop the entire application. What would be mandatory though is to stop the TrackingEventProcessor (TEP) from processing. More specifically every instance of your application should have that TEP stop working. This is a requirement as you need to change the tokens each of those instances use and a TEP threads will try to claim a token whenever they can.

FYI, to stop the TEP, you can invoke the TrackingEventProcessor#shutDown method.

When it comes to actually splitting or merging the token…well you could have a look at the implementation if you want to have a full fledged solution like is part of more recent framework versions. Splitting would be most feasible to implement well I think, as you can simply insert a new token at the same location, with a different size to it. Merging is rather difficult though, as you will need to be aware that when you are merging there is zero guarantee the tokens you want to merge are at the same position. Hence, the merged token needs to keep track of both tokens, until they both reach the same point in the stream. Or, you would only allow a merge on tokens which have reached the head of the stream, that would solve it.

But, to be fair though, I would opt to moving to a more recent version of Axon Framework. It provides you all this out of the box, as well as a tremendous amount of other recent features you can tap into.

That’s my 2 cents to the situation, hope it helps you out @Karl_Muscat.

Cheers,
Steven