"Write" 将 C#/Node.js 与 Amazon Neptune 结合使用时,事务不起作用

"Write" Transactions don't work when using C#/Node.js with Amazon Neptune

我能够连接到 Neptune,并且能够毫无问题地向其添加一些数据。但是,当我尝试 https://tinkerpop.apache.org/docs/current/reference/#gremlin-dotnet-transactions 处的代码时,它似乎不起作用。我收到以下错误:

“收到反序列化为空对象消息的数据。无法对其进行操作。”

我什至跳到一个 JS 示例 (https://tinkerpop.apache.org/docs/current/reference/#gremlin-javascript-transactions) 并再次尝试。也不行。

我错过了什么?

在撰写本文时,Amazon Neptune 仅支持 TinkerPop 版本 3.4.11。您引用的使用 tx() 的“遍历事务”语义是 Apache TinkerPop 于 2022 年 1 月中旬发布的 3.5.2 中的新语义。

事务通常仅在您需要提交多个查询但所有查询都限制在一次提交内时才需要,或者如果其中一个查询失败则回滚。如果您不需要这个,那么发送到 Neptune 的每个 Gremlin 查询都将作为一个事务处理。

如果您确实需要 transaction-like 3.4.11 中的行为,这里有一个 link 文档,介绍如何使用 Gremlin 会话在 Neptune 中执行此操作:https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-sessions.html

如果您不需要交易,那么这里是通过提交个人查询与 Neptune 交互的示例:
(.NET)https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-dotnet.html

(JS)https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-node-js.html