我正在开发一个包含多个节点的Cordapp。在我的应用程序中,每一方都将由两个在不同地点运行的节点来代表,其中一个节点将始终在线,而另一个节点有时可以离线。其中一个节点将始终在线,而另一个节点有时可以离线。
我正在寻找一个Corda中的API,使离线节点能够运行jobapi与在线节点同步。我找不到任何这样的API。
你能不能建议一下,如果你遇到过类似的情况,而且这里已经有任何可用的APIusecase。
你可以为onoff节点编写一对流程,请求从始终在线的节点克隆所有细节。
On-Off 节点
FlowSession session = initiateFlow(alwaysOnNode);
//Send any hint for the other node to query the past transactions, maybe a timestamp?
session.send(hint);
/*
* Waiting for the On/Off node to reply
*/
//Receive the transaction and store it in its vault. The use of ALL_VISIBLE is critical here
subFlow(new ReceiveTransactionFlow(session, true, StatesToRecord.ALL_VISIBLE));
始终在节点上
//Query the newest transaction happened from the vault. Here I used the transaction hash in my case
SignedTransaction stx = getServiceHub().getValidatedTransactions().getTransaction(state.getRef().getTxhash());
//Send it back to the on/off node for update
subFlow(new SendTransactionFlow(holderSession, stx));
喏 是我写的一个例子,股东向公司询问任何发生的关于StockState的交易。