Hi,
The event handlers in my app are using the default TrackingEventProcessor (auto configuration) with a Persisted store.
I want to expose a controller endpoint that will trigger a replay of processing group on-demand.
I’d like to know which is the better approach to do this.
- On every replay request I am creating a new TrackingEventProcessor with a new InMemoryTokenStore (initialized to HeadToken)
TrackingEventProcessor trackingEventProcessor = TrackingEventProcessor.builder().build();
then do the replay:
trackingEventProcessor.shutDown();
trackingEventProcessor.resetTokens();
trackingEventProcessor.start();
- Reuse the existing TrackingEventProcessor (the default with a persisted store)?
configuration.eventProcessingConfiguration()
.eventProcessorByProcessingGroup(processorName, StreamingEventProcessor.class)
.ifPresent(streamingEventProcessor -> {
if (streamingEventProcessor.supportsReset()) {
streamingEventProcessor.shutDown();
streamingEventProcessor.resetTokens();
streamingEventProcessor.start();
}
});
I am able to make both work but I wanted to know which approach is better?
Thanks!