Hello,
I’m trying to trigger a replay of the events from a Tracking Processor ( Axon 3.3.2, Spring Boot 2.0.3)
Here is my configuration :
`
@Inject
public void configure(EventProcessingConfiguration configuration) {
configuration.registerTrackingEventProcessor(“foo.test.replay”,
(conf) -> TrackingEventProcessorConfiguration.forParallelProcessing(4));
}
`
The related Event Handler attached to this processor:
`
@AllowReplay
@Component
public class Replayer {
private int count;
@EventHandler
public void on(DomainEventMessage<?> message, ReplayStatus replayStatus) {
System.out.println(“Thread=” + Thread.currentThread().getId() + “, events replayed=” + ++count);
}
@ResetHandler()
public void onReset() {
System.out.println(“Reset Handler called !”);
}
}
`
And finally this is how I trigger the replay process :
`
eventProcessingConfiguration.eventProcessor(“foo.test.replay”, TrackingEventProcessor.class)
.ifPresent(eventProcessor -> {
eventProcessor.shutDown();
eventProcessor.resetTokens();
eventProcessor.start();
});
}
`
So far, so good, the replay process is working but what I notice is that the onReset() is not called as it should be when I call resetTokens() on the EventProcessor.
After investigating a bit further, I notice that the call of the method annotated with @ResetHandler is triggered by a call to EventHandlerInvoker::performReset. By default, it does nothing.
Now, this interface has three implementations : SimpleEventHandlerInvoker, MultiEventHandlerInvoker, and AbstractSagaManager.
For the SimpleEventHandlerInvoker, the performReset() is correctly implemented, by basically looping over all the EventListener.
But in my case, the Replayer event handler is attached to a MultiEventHandlerInvoker (I don’t know why actuallly, but this is part of the Axon internals), which doesn’t override the default implementation of performReset().
The obvious solution I have in mind is to implement it and delegate to all embedded EventHandlerInvoker, but before submitting a PR, I would like to validate with you my understanding of the issue.
Is this the right way to use the Replay feature ?
Cheers,
Jerome