Replay events to send data to new database

Hi all,

we’re in the process of refactoring some databases and moving data around.
We want to replay some events with a new eventhandler, for just one time, which has the @disallowreplay annotation, but it will replay existing events in the db. This new eventhandler is going to call 2 api’s to send data from events it is replaying.

We use PooledStreamingEventProcessor and head/tail tokens for our eventhandlers. We’re on java/springboot and axon 4.9.1.
We’re unsure on how to handle when the new eventhandler encounters an error when calling the api’s. The new eventhandler will start replay the old events once the new app version goes live on production, but it can happen that the other services are still in the proces of booting up.

Would a track event processor be better to use for this new event handler? Or is there a better way of getting the info from the old events to a new db?
We have a sql script ready, but we would like to just be able to start the app and let axon do the work in the background.

Hi Mick,

There shouldn’t be any issues in processing events the way you describe, just make sure that:

  • The event processor is configured with a PropagatingErrorHandler, so that the event is retried in case of an exception.
  • Whether an incremental back-off strategy is required (if you want to “throttle” failing API calls); A TrackingEventProcessor employs this, while a PooledStreamingEventProcessor simply lets whatever thread is available retry directly.
  • Finally, if the external API calls are continually failing (maybe the external API is down for a period of time), you might want to look into using a DLQ.

Of course, there are other approaches; you could e.g. process events to just create a simple projection that is a “Todo list”, and let a separate process/workflow read that projection to perform & manage the external API calls.

/Marc