我可以 运行 在 Apache Ignite 中部署服务的所有实例吗?

Can I run all the instances of a deployed service in Apache Ignite?

是否可以 运行 在 Apache Ignite 中部署服务的所有实例?服务 returns 一些基于节点上 Ignite SQL 存储内容的节点状态信息。我需要让它在组中的每个节点上执行,而不是在随机的单个节点上执行。

我尝试使用 Broadcast() 在所有适用的节点上调用一个函数,这些节点又调用该服务。它确实有效,但是否有更直接的方法来实现这一目标?

此外,我不想单独使用计算网格,因为这需要我将上述逻辑中的所有依赖项都引入调用服务——基本上是将目标服务的代码注入调用方。

我使用 Apache Ignite for Net v2.7。谢谢!

您可以为 IgniteServices#services(ClusterGroup) 指定集群组。 下面是在每个服务器节点上调用服务的例子:

Collection<ClusterNode> nodes = ignite.cluster().forServers().nodes();
for (ClusterNode node : nodes) {
            ExampleService service = ignite.services(ignite.cluster().forNode(node)).service("service");
            service.call();
}