Hello,
I’m trying to replay events using tracking processor.The events are loaded correctly from DB, the TokenEntry is updated in DB too, but in my EventSourcingHandler, only the object creation event (MessageCreatedEvent from examples) is passed to event handler.
I only use hibernate without Spring and Axon framework 3.1.1
this is my config and how i start the replay :
public TrackingProcessorService(EntityManagerProvider entityManagerProvider, TransactionManager transactionManager, EventStore eventStore, AggregateAnnotationCommandHandler<MessagesAggregate> messagesAggregateAggregateAnnotationCommandHandler, MessagesEventHandler messagesEventHandler) {
this.entityManagerProvider = entityManagerProvider;
this.eventHandlingConfiguration = new EventHandlingConfiguration()
.registerEventHandler(c -> messagesEventHandler);
this.eventHandlingConfiguration.usingTrackingProcessors();
Configuration configuration = DefaultConfigurer.jpaConfiguration(entityManagerProvider, transactionManager)
.configureAggregate(MessagesAggregate.class)
.registerModule(this.eventHandlingConfiguration)
.configureEventStore(e -> eventStore)
.registerCommandHandler(c -> messagesAggregateAggregateAnnotationCommandHandler)
.buildConfiguration();
configuration.start();
}
public void startReplay() {
String endOfReplay = getEndOfReplay(entityManagerProvider.getEntityManager());
Optional<EventProcessor> processor = this.eventHandlingConfiguration.getProcessor(processorName);
processor.get().registerInterceptor(new MessageHandlerInterceptor() {
@Override
public Object handle(UnitOfWork unitOfWork, InterceptorChain interceptorChain) throws Exception {
if(endOfReplay.equals(unitOfWork.getMessage().getIdentifier())){
processor.get().shutDown();
return null;
}else {
return proceedWithReplay(interceptorChain);
}
}
});
processor.get().shutDown();
processor.get().start();
}
annotating the event handler with @ProcessingGroup(processorName) does not seem to make any difference.
Thanks for help, much appreciated.