I changed from our custom replay (via repo-> deleteToken) to the 3.2 api.
Our appication solely relies on the eventstore and does a full replay of the in-memory model-state on every restart.
I use the following shutdown->reset->start cycle in a spring smartLifecycle (kotlin syntax, “it” refers to the trackingProcessor in loop)
with(eventHandlingConfiguration.trackingEventProcessors()) {
// note: this has to be done in 3 iterations, because we have eventProcessors that
// listen to the same event types and they would miss events.
forEach {
it.shutDown()
}
forEach {
it.resetTokens()
}
forEach {
it.start()
logger.debug { "Replayed ${it.name}" }
}
}
where the trackingProcessors is an extension function that filters for instance of TrackingProcessor and casts accordingly.
I found that shutdown-reset-start in one loop does not work, because our tracking processors listens to shared events and get confused when on processor is already in replay while the others are being reset.
The above code generally works in prod, but during i-tests (SpringRunner/SpringBootTest, I got
2018-04-03 10:28:43.133 WARN 30022 — [rLeaderBoard]-1] o.a.e.TrackingEventProcessor : Error occurred. Starting retry mode.
java.lang.IllegalArgumentException: Incompatible token type provided.
I assume this is related to the asynchronous nature of the shutdown/reset cycle and the single thread test runner with spring Boot …
Question: what is the correct way to replay multiple trackingProcessors on application start and make sure they all are up and running to access the replayed events once?
Or would it make sense two create the model with one trackingProcessor and let the dedicated views query their results vie queryGateway?
Thanks a lot
Jan