Alex Avrutin
Alex Avrutin

Reputation: 1391

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

Is it possible to run all the instances of a deployed service in Apache Ignite? The service returns some per node state information based on the contents of the Ignite's SQL store on the nodes. I need to get it to execute on every node in the group, not on a random single node.

I tried to use the Broadcast() to call a function on all the applicable nodes which, in turn, calls the service. It does work but is there a more straightforward method to achieve this?

Also, I would not like to use solely the Compute grid, as this requires me to bring all the dependencies in the above logic into the calling service -- basically inject the target service's code into the caller.

I use Apache Ignite for Net v2.7. Thank you!

Upvotes: 0

Views: 129

Answers (1)

Pavel Vinokurov
Pavel Vinokurov

Reputation: 334

You could specify the cluster group for IgniteServices#services(ClusterGroup). Below the example of calling the service on each server node:

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

Upvotes: 2

Related Questions