Summary: We are seeing the Tracking Event Processor processes the same event twice. Has this behaviour been observed by anyone else? Is this a configuration based issue? Our configuration is as follows:
//The tracking processor @Autowired
public void configure(EventHandlingConfiguration config) {
config.registerTrackingProcessor(“model1”, c -> trackingEventProcessorConfiguration(), c-> sequencingPolicy());
}
@Bean
public Serializer serializer() {
return new XStreamSerializer();
}
public TrackingEventProcessorConfiguration trackingEventProcessorConfiguration() {
return TrackingEventProcessorConfiguration.forSingleThreadedProcessing();
}
public SequencingPolicy sequencingPolicy() {
return new SequentialPerAggregatePolicy();
}
We would appreciate any solutions/suggestions/insights into the root cause of this problem. Please let us know if we need to provide any other information to better troubleshoot this issue.
is this consistent behavior, or does it happen only sporadically?
I have seen similar behavior when applications had a @EnableAxon annotation, while also using Spring Boot Autoconfiguration. Is that the case in your application?
The handling of the events is being duplicated consistently. We did have both the @EnableAxon annotation as well as the Spring Boot Autoconfigurationenabled. However, we removed the Spring Boot Autoconfiguration but still observed the duplication of events.
In order to verify this duplicate event processing, we put a break point in the event handler registered to the tracking event processor. The same break point was hit twice and we observed that the value of the last token field in TrackingEventProcessor.java was the same during both passes. After the second pass, the breakpoint was not hit again as a result of the token finally being updated to the correct value.
If there is any other information that we can provide to get some insight on this issue, please do let us know.
I would recommend removing the @EnableAxon annotation, and using the Axon Spring Boot Starter module instead.
Can you (also) confirm that both invocations of the event handler have gone through the same processor instance as well as the same event handler instance? We have seen situations where, because of an error in the configuration, two event handler beans were created for the same class, hence causing duplicate invocations.
We indeed had a problem with our configuration where two even handler beans were being created, thereby causing duplicate invocations. After fixing this configuration issue, the problem goes away. Thank you for pointing us in the right direction.