Disabling query handlers until event replays are done

Hi,

we tackle the issue of migrating from one database to another for our view model and we want to do it without downtime. The problem is, that when the second instance of the same service is deployed and is connected to axon server and the events start to be replayed, all the query handlers that are connected to axon server become operational as well, thus they might return wrong results cause the replay is still in progress (single app contains of command, event and query handlers). Is there any smart way to disable query handling untill the replay is done or we have to take care manually about not registering them for the migration process? We’re using axon free.

Hi Piotr,

unfortunately, currently, that’s not easily possible, assuming you’re on Spring Boot. The autoconfiguration will automatically detect and subscribe all handlers.

If you’re using the configuration directly, you can simply choose not to register certain query handlers. Once the replay is finished, you would need to subscribe the handlers at that moment, but with the QueryBus directly, rather than the Configurer.

We do think this is a good usecase to provide support for. We’re investigating how we could achieve it.

For now, the only workaround I can think of is to start the application with a profile that removes certain beans, and then restart the application with all the beans included. Unfortunately, that requires a little bit of downtime.