Axon 4 - Saga run again after JVM restart

I am using Axon4 with Spring boot. Created simple saga. Its works well during JVM in flight. However once it restarts, it re-runs the Saga again.

Tried to to JpaSagaStore for persistance, did not work. Below are code snippet. Please help.

public class AxonConfig {

private EntityManager entityManager;

public SagaStore sagaStore() {
return JpaSagaStore.builder().entityManagerProvider(new SimpleEntityManagerProvider(entityManager)).build();


Hi Prashant,

Let me give you a little back ground first.

A Saga instance will receive it’s from an Event Processor.
The default Event Processor in Axon 4 is the TrackingEventProcessor - this will keep track of which events it has handled. This allows you to start and stop your application, without events being handled a new, as well as enabling replays for your Query Model.
The TrackingEventProcessor for this ‘keeps track’ of which events it has handled in a TrackingToken, which is stored in a TokenStore.

My hunch is that you’re using an InMemoryTokenStore - this means that on every restart, the TrackingEventProcessor used to provide events to your saga will start from the beginning of time.
Thus to resolve this you should ensure that the application running your Saga has a database to store tokens in.

Would this resolve the problem you’re encountering Prashant?