如何在 Neptune 中使用 Gremlin 会话?

How do I use Gremlin sessions in Neptune?

我正在尝试将 Gremlin sessions 与 Amazon Neptune 一起使用。我可以在会话之外很好地执行字节码查询,并且我可以 运行 在会话客户端上进行字符串查询,但是尝试 运行 使用会话客户端进行字节码查询会导致此错误:

"code":"MalformedQueryException",
"detailedMessage":"Message with op code [bytecode] is not recognized."

我完全遵循了 AWS 文档。

Cluster cluster = Cluster.build().with {
    addContactPoint('host')
    port(8182)
    enableSsl(true)
    serializer(Serializers.GRAPHBINARY_V1D0)
    create()
}

def client = cluster.connect('session ID')

println client.submit('g.V()').all().get() // works

println traversal().withRemote(DriverRemoteConnection.using(client))
    .V().iterate() // returns the error above

println traversal().withRemote(DriverRemoteConnection.using(cluster))
    .V().iterate() // works, without a session

我正在使用 Gremlin 3.4.8。我如何让它工作?

Neptune 根本不支持基于字节码的请求(甚至 Gremlin Server 本身作为参考实现)。造成这种差异的主要原因是 TinkerPop 不想进一步推广会话的使用。 TinkerPop 主要为工具支持的狭窄用例构建会话 - 例如Gremlin 控制台远程连接、可视化工具包和图形分析工具。然而,鉴于 Gremlin 对远程多请求事务用例的支持较弱,用户已扩展会话使用作为解决该弱点的方法。

我感觉这个扩展可能会迫使 TinkerPop 在会话中提供字节码支持,但目前还没有决定。另一种方法是改进对事务的支持,但考虑到此类更改的性质,这在 TinkerPop 3.x 的范围内可能是不可能的。

目前,如果您想使用会话,您只能提交脚本。