The fix is rather simple; just start Axon Server components when the factory produces them.
Timing is always safe, as factory involvement will happen only after the main MultiTenant component is registered to configuration and ready to use.
Unfortunately, it is not possible to write a test as component is created inside factory method, therefore it is not mockable.
Also none of produce components exposes something like isStarted() method where we could check if start was invoked.
The fix is rather simple; just start Axon Server components when the factory produces them. Timing is always safe, as factory involvement will happen only after the main MultiTenant component is registered to configuration and ready to use.
Unfortunately, it is not possible to write a test as component is created inside factory method, therefore it is not mockable. Also none of produce components exposes something like isStarted() method where we could check if start was invoked.
Passed manual testing.