Hello,
I can’t seem to find how to do a replay with axon 3, all examples I find online point to axon 2 examples. Can someone point me in the correct direction?
Thanks!
Mauricio
Hello,
I can’t seem to find how to do a replay with axon 3, all examples I find online point to axon 2 examples. Can someone point me in the correct direction?
Thanks!
Mauricio
I’ve experimented with replaying events to query model (ORM) handlers, for the scenario where a query model database migration might not be possible.
Not sure if this is the best approach but it seems to work.
`
@Inject
List queryModelUpdaters;
@Inject
private EventStorageEngine eventStore;
…
EventHandlingConfiguration ehConf = new EventHandlingConfiguration();
for (QueryModelUpdater queryModelUpdater : queryModelUpdaters) {
System.out.printf(“Registering replay event handler %s\n”, queryModelUpdater.getClass().getSimpleName());
ehConf.registerEventHandler(conf -> queryModelUpdater);
}
Configuration config = DefaultConfigurer.defaultConfiguration()
.registerModule(ehConf)
.buildConfiguration();
config.start();
EventBus replayEventBus = config.eventBus();
this.eventStore.readEvents(null, false).forEach(msg -> {
System.out.printf(“Replaying %s\n”, msg.getPayload().getClass().getSimpleName());
replayEventBus.publish(msg);
});
`
Hi,
replays have been redesigned in Axon 3. Instead of doing a ‘replay’, you can configure groups of Event Handlers (so called processing groups) to be assigned to a TrackingProcessor. The TrackingProcessors track the events in the Event Store and keep track of where they are. By default, they start from the beginning.
To force a replay, you would clear the token for such a processor as well as any query models it creates. When the processor starts, it will replay all events and automatically continue processing as events come in.
Check the reference guide on how to configure processors.
Hope this helps.
Cheers,
Allard
Hi,
Thanks for the replies. I’ve read through the event processing guide and also playing a bit with the API.
Mauricio
Hi Mauricio,
Hope this answers your questions Mauricio!
I think in short; Axon 3.1 should lift some of these ‘concerns’ of yours.
Cheers,
Steven