Gremlin Java 3.4 withRemote 已弃用
Gremlin Java 3.4 withRemote deprecated
所以在 gremlin java 3.4 之前,我使用以下代码连接到远程图形:
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;
我已将 JanusGraph 更新到版本 0.4.0 并尝试使用 gremlin java 3.4.3,我发现每个 withRemote 方法现在都已弃用。
gremlin 服务器配置为使用 JanusGraphManager 和 ConfigurationManagementGraph。并在启动时运行以下脚本:
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()
我似乎找不到从 java 获取遍历源的新正确方法。
所以在 gremlin java 3.4 之前,我使用以下代码连接到远程图形:
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;
我已将 JanusGraph 更新到版本 0.4.0 并尝试使用 gremlin java 3.4.3,我发现每个 withRemote 方法现在都已弃用。
gremlin 服务器配置为使用 JanusGraphManager 和 ConfigurationManagementGraph。并在启动时运行以下脚本:
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()
我似乎找不到从 java 获取遍历源的新正确方法。