If I have an Akka cluster, what is the best way to access a list of members of that cluster?
I can listen for events and manage my own registry on each node in my cluster. I can also use Cluster(system).state but according to the docs this isn't necessarily in-sync with the published events. Is one of these preferred/better?
My use case is this:
我有一个包含各种服务(不同角色)的集群。当我需要特定角色的服务时,我会在集群中的所有节点列表中进行过滤,以获取具有我需要的角色的节点,然后随机选择其中一个进行通信。这就是为什么我想要集群中所有节点的列表。
这是实现此用例的最佳方法吗?