Best Way to avoid replays


we have new event handlers in a new package. Currently they get replayed each time we go to a new stage. But on prod we don’t want/need the replay as it will kill our cache.

What is the best ways to avoid this? Adding tracking processor entries manually to the database?


And how do we have to configure them? how many processors are needed? will axon pick up the ones we define or generate more depending on the config of the event processors?

I think you are going to have to write some configuration code to make this happen. You want to initialize the Tracking Processor to have its initial tracking token to be at the head of the stream. Something like this.

void config(EventProcessingConfigurer configurer,
            EventStore mongoDbEventStore) {
    configurer.registerTrackingEventProcessor("MyTrackingProcessorsName") {
    } {
        configuration ->
                    .andInitialTrackingToken({ streamableMessageSource -> streamableMessageSource.createHeadToken() })

Here is the link in the axon framework documentation…

Hi Ben,

So this only sets a new tracking processor to the latest event? So if it already exists the config is ignored?

So in our case where we already started a replay we have to delete the "old" entries in the db?

Also in the example on the site o see a time. Because it is interesting for us to e.g. have the events from the last hour but not the ones 1 month ago.

I have not seen a value for the counter. Does it mean that the important part is the time? And not the blob where a counter value is in?

Because our idea by creating them manually was focusing on the counter in the blob. Not the date...

Best Michael

Hi Michael,

the “initialTrackingToken” setting is only used when a processor starts for the first time, or when a reset is performed without a given token. Any processors that have already started will continue where they left off.
The API currently allows retrieving tokens for the HEAD (where new events are added), TAIL (starting at the beginning) and any time-based, which gives you the first event on or after that timestamp and everything after that.
If you want, you can construct your own token to start wherever you like. The important thing is to make sure you create the type of token that is supported by the underlying implementation.


Hi Allard,

Thanks for the clarification. The one with the time is perfect.
I already do some first testing.

The only “drawback” is that the configuration with the application.yml does not interfere. I have now a “autoconfig” section and a section for this new tracking processor.

Thanks, Michael