Hi,
I start my application by using a docker compose file, which first starts axon server and then my application (which connects to the axon server).
Since the axon server takes some time to start, I check the state of the channel in order to make sure it is connected. When using axon server 2.4.1, I checked this with the method underneath, which is used from an Awaitility predicate in order to wait:
private static boolean isConnected(final AxonServerConnectionManager axonServerConnectionManager) {
ConnectivityState state = ConnectivityState.CONNECTING;
try {
//TODO Fix connection check, worked in previous axon server version
state = ((ManagedChannel) axonServerConnectionManager.getChannel()).getState(false);
} catch (Exception e) {
LOGGER.info("Waiting for axonServer, state: {}", state);
return true;
}
return (state == ConnectivityState.IDLE) || (state == ConnectivityState.READY);
}
Although it required some casting to specific classes it did the job. In the latest axon server 2.4.2 however I get a cast exception.
My question is, what is the proper way of waiting until the axon server is ready to take connections?