So prior to gremlin java 3.4 I used the following code to connect to a remote graph:
Cluster.Builder builder = Cluster.build();
builder.addContactPoint(GREMLIN_SERVER);
builder.port(GREMLIN_PORT);
builder.serializer(new GryoMessageSerializerV1d0());
cluster = builder.create();
g = EmptyGraph.instance().traversal().withRemote(DriverRemoteConnection.using(cluster, GRAPH_NAME));
return g;
I've updated JanusGraph to version 0.4.0 and tried to use gremlin java 3.4.3 and I see every withRemote method is now deprecated.
The gremlin server is configured to use the JanusGraphManager with the ConfigurationManagementGraph. And at startup it runs the following script:
def globals = [:]
def getGraph() {
def graphNames = ConfiguredGraphFactory.getGraphNames();
def graphMaps = [:];
for (graphName in graphNames) {
def g = ConfiguredGraphFactory.open(graphName);
graphMaps.put(graphName, g.traversal())
}
return graphMaps;
}
globals << getGraph()
I can't seem to find the new correct way to get a traversal source from java.