正在 spring 中重新建立 RPC 连接
Re-establishing an RPC connection in spring
我是 运行 一个 spring 服务器,它通过 RPC 连接到一个 corda 节点,目前我正在初始化服务器时初始化连接。如果 rpc 节点出现故障,能够重新连接到 rpc 的最佳做法是什么?我只是轮询并检查 rpc 是否断开连接吗?
这在文档的 Reconnecting RPC Clients 部分中有关与节点交互的部分进行了某种程度的讨论。
In the current version of Corda the RPC connection and all the
observervables that are created by a client will just throw exceptions
and die when the node or TCP connection become unavailable.
It is the client’s responsibility to handle these errors and reconnect
once the node is running again. Running RPC commands against a stopped
node will just throw exceptions. Previously created Observables will
not emit any events after the node restarts. The client must
explicitly re-run the command and re-subscribe to receive more events.
RPCs which have a side effect, such as starting flows, may have
executed on the node even if the return value is not received by the
client. The only way to confirm is to perform a business-level query
and retry accordingly. The sample runFlowWithLogicalRetry helps with
this.
In case users require such a functionality to write a resilient RPC
client we have a sample that showcases how this can be implemented and
also a thorough test that demonstrates it works as expected.
目前有一个死的 link 到 ReconnectingCordaRPCOPs
已被移动 here
我是 运行 一个 spring 服务器,它通过 RPC 连接到一个 corda 节点,目前我正在初始化服务器时初始化连接。如果 rpc 节点出现故障,能够重新连接到 rpc 的最佳做法是什么?我只是轮询并检查 rpc 是否断开连接吗?
这在文档的 Reconnecting RPC Clients 部分中有关与节点交互的部分进行了某种程度的讨论。
In the current version of Corda the RPC connection and all the observervables that are created by a client will just throw exceptions and die when the node or TCP connection become unavailable.
It is the client’s responsibility to handle these errors and reconnect once the node is running again. Running RPC commands against a stopped node will just throw exceptions. Previously created Observables will not emit any events after the node restarts. The client must explicitly re-run the command and re-subscribe to receive more events.
RPCs which have a side effect, such as starting flows, may have executed on the node even if the return value is not received by the client. The only way to confirm is to perform a business-level query and retry accordingly. The sample runFlowWithLogicalRetry helps with this.
In case users require such a functionality to write a resilient RPC client we have a sample that showcases how this can be implemented and also a thorough test that demonstrates it works as expected.
目前有一个死的 link 到 ReconnectingCordaRPCOPs
已被移动 here