We are using Hazelcast as shared memory on a high traffic web application. It is critical that http requests continue to be responded to quickly (about 100 ms) even if the connection between the Hazelcast client and server is disconnected. For this reason we cannot set the connection retry limit in the client config to be non zero (because then our application will not respond to requests in time). However, we do want to have a separate mechanism to check if a reconnection can be made, and to reconnect the client when available. What is the best practice for doing this?
Currently, I have a lifecycle listener configured in the client config, and I when I get the CLIENT_DISCONNECTED message, I know I need to reconnect, but I don't know how.
My application holds a HazelcastInstance object reference to the client. Do I need to create a new HazelcastInstance with:
hzInstance = HazelcastClient.newHazelcastClient(hzClientConfig);
or is there some way to reconnect the existing client? What is the best practice to reconnect the client in this situation?
Thanks,
Bob