Bogdan Emil Mariesan
Bogdan Emil Mariesan

Reputation: 5647

Connect to remote GridGain node from Java Application

I am trying to connect to an existing grid of GridGain nodes configured as computing nodes, however I haven't managed to find a way to connect to the cluster without having to programmatically start and in-memory node.

I even tried to replicate the config in my Java app but still no progress:

List<String> addressList = new ArrayList<String>();
addressList.add("127.0.0.1:47500..47509");

GridTcpDiscoveryVmIpFinder gridTcpDiscoveryVmIpFinder = new GridTcpDiscoveryVmIpFinder();
gridTcpDiscoveryVmIpFinder.setAddresses(addressList);

GridTcpDiscoverySpi gridTcpDiscoverySpi = new GridTcpDiscoverySpi();
gridTcpDiscoverySpi.setIpFinder(gridTcpDiscoveryVmIpFinder);

Collection<GridNode> remoteNodes = gridTcpDiscoverySpi.getRemoteNodes();

Is there a way to connect to an existing grid without having to start an in-memory node?

EDIT:

I've also tried to connect to running nodes by using the UUID and again no luck:

Grid grid = GridGain.grid(UUID.fromString("186FFB45-2686-4A69-BAF0-791E4C0B5E69"));

Also what I'm trying to achieve is to make a remote computation with a Java Future:

 GridCompute gridCompute = gridNode.grid().compute();
 AsyncObject asyncObject = new AsyncObject();
 GridFuture gf = gridCompute.call(asyncObject);

Where AsyncObject is a class that implements the Callable interface and returns the sum of two numbers.

Upvotes: 0

Views: 432

Answers (1)

Dmitriy
Dmitriy

Reputation: 2292

You can have GridGain node connect to a cluster without participating in data caching. Take a look at Client Node vs Data Node documentation on GridGain Wiki.

Upvotes: 1

Related Questions