0
votes

I am aware that there is a probe available at /hazelcast/health/ready at port 5701.

However I need to do this progamatically through code as I am using embedded hazelcast deployed on a kubernetes cluster and all communication should pass through the main application (that means hazelcast cannot expose that endpoint, using http requests through localhost would not suffice). I tried looking into the documentation but I found no help in this.

Only thing that I found is to use instance.getServer().getPartitionService().isLocalMemberSafe() but I got no evidence that this is effectively the same as checking the readiness probe.

Any help would be appreciated, thanks!

1

1 Answers

0
votes

The exact logic for /ready endpoint is:

node.isRunning() && node.getNodeExtension().isStartCompleted()

I guess you can't use exactly the same from the code, but fairly good approximations are:

  1. instance.getLifecycleService().isRunning() (the only difference is that it won't wait with being ready for joining other members)
  2. instance.getPartitionService().isClusterSafe() (the difference is that it will wait for all the Hazelcast migration to finish)

You can use any of them. If you want to be really sure that Hazelcast member can receive the traffic when its ready, then the second option is totally safe.