我有一个到我的Corda节点的RPC连接,用于启动流程和查询保管库。
是否有推荐的方法来检查连接是否断开并自动重新连接?
答案 0 :(得分:1)
从Corda 4开始,没有内置API可以检测到断开连接或在断开连接时自动重新连接。
但是,这些RpcReconnectTests
定义了一个ReconnectingRPCConnection
类,该类包装了常规CordaRPCConnection
并在连接断开时自动重新连接到该节点:RpcReconnectTests。
特别要看一下Test that the RPC client is able to reconnect and proceed after node failure, restart, or connection reset
,它显示了在执行诸如启动流程和观察保管库之类的操作时,如何使用ReconnectingRPCConnection
处理连接中断。