I put Event Handler to query my events in axon framework in my spring application. I can put an event from my command up and I can read them from my query app.until reboot time no problem But when I reboot my query app Each time it reads same events again at the beginning and it cause duplicate process. How can I commit an event when I read it?
ToMyAxonConfig
@Bean
public TokenStore tokenStore(Serializer serializer, EntityManagerProvider entityManagerProvider) {
return JpaTokenStore.builder()
.entityManagerProvider(entityManagerProvider)
.serializer(serializer)
.build();
}
@Autowired
public void configureProcessors(EventProcessingConfigurer eventProcessingConfigurer) {
TrackingEventProcessorConfiguration tepConfig = TrackingEventProcessorConfiguration.forSingleThreadedProcessing().andInitialTrackingToken(StreamableMessageSource::createHeadToken);
eventProcessingConfigurer.registerTrackingEventProcessorConfiguration(config -> tepConfig);
}