I created a monitoring node in my akka.net cluster and I'm using cluster.SendCurrentClusterState(Self)
but not all nodes are visible immediately, also sometimes a node leaves the cluster and while the log says the node was removed correctly, the state says the node is up for a long time.
What is the best/correct way to get the updated state of the entire akka.net cluster?
There are two important properties worth to remember when it comes to cluster state:
The simplest for of the cluster state at the moment is Cluster.Get(Context.System).State
which contains info about currently known members as well as unreachable nodes.
Another way is to cluster.Subscribe(Self, typeof(ClusterEvent.IMemberEvent), typeof(ClusterEvent.IReachabilityEvent))
(which have to be unsubscribed when actor dies). This way you can get notified about cluster state changes as they come up.
Regarding long time required to acknowledge removed node. Depending of what one would mean by "long", this may be a sign of some bug. In that case it would be great, if you could set an issue with repro steps.