[英]How to call all deployed instance of a Ignite Service
I have a certain service that is deployed in a cluster group in an Apache Ignite cluster. 我有一个部署在Apache Ignite群集中的群集组中的特定服务。 Cluster group size is 3. Total Number of service instances = 3. Instance per node = 1.
群集组大小为3。服务实例总数=3。每个节点的实例= 1。
No whenever I want to execute the service, I can get an handle to once of the service instances on a node only. 否,无论何时我想执行服务,我都只能获得节点上一次服务实例的句柄。
But I want to execute the service on all the nodes. 但是我想在所有节点上执行服务。 ie.
即。 on all three nodes.
在所有三个节点上。
What is the correct way to do this? 正确的方法是什么?
According to the documentation , you can use node singletons to achieve that level of distribution for a service: 根据文档 ,您可以使用节点单例来实现服务的该分布级别:
Node Singleton
节点单例
You can deploy a per-node singleton service.
您可以部署每个节点的单例服务。 Ignite will guarantee that there is always one instance of the service running on each node.
Ignite将保证在每个节点上始终有一个服务实例在运行。 Whenever new nodes are started within the cluster group, Ignite will automatically deploy one instance of the service on every new node.
每当在群集组中启动新节点时,Ignite都会在每个新节点上自动部署服务的一个实例。
The comment refers to the following code snippets: 该注释引用以下代码段:
IgniteServices svcs = ignite.services();
//The .services() method has an overload, to which you can pass a cluster group
svcs.deployNodeSingleton("myNodeSingleton", new MyService());
And its alternative: 及其替代方案:
svcs.deployMultiple("myNodeSingleton", new MyService(), 0, 1);
I supposed that by "service instance", you meant "a running instance of the same service implementation". 我以为“服务实例”是指“同一服务实现的运行实例”。
It sounds like you're looking for remote service invocation. 听起来您正在寻找远程服务调用。 If that's the case, you can use service proxy: https://apacheignite.readme.io/docs/service-example#service-proxy
在这种情况下,您可以使用服务代理: https : //apacheignite.readme.io/docs/service-example#service-proxy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.