[Axon 3.3.2] Replay Events API, @ResetHandler not called

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

Hi Jérôme,

Great observation and thanks for pointing out this issue!
If you would be open to creating a PR to adjust the MultiEventHandlerInvoker to override the default behavior, that would be much appreciated.

I would like to point out that the PR should perform the supportsReset() call on each EventHandlerInvoker prior to performing the performReset() call on it.

From the snippet you’ve shared I assume you are using the Replay functionality as intended by the way.
So no worries in that space so far.

By the way, if a PR doesn’t fit in your schedule, an issue documenting this would also be very beneficial to us. :slight_smile:

Cheers,
Steven

Ok, thanks ! I’ll do it this week-end.

Cheers,
Jerome