0
votes

I am working on a Cordapp that contain multiple nodes. In my app, every party will be represented by two nodes running at different locations. One of the nodes will always be Online where as the other node can be offline/online at times.

I am looking for an API with-in Corda that will enable the offline node to run a job/api to synchronize with the online node. I could not find any such API.

Can you please suggest if you have come across a similar scenario and it here is already any available API/usecase.

1
Scenario: during the flow's Broadcasting step, it waits indefinitely if the other Party is offline. Can we do this as an asynchronous process where the Broadcast can initiate sending the state/transaction and commit the transaction in current node. The other Party can receive the states as and when it comes online.Sri Y
Sounds like a failover/HA scenario. Don't think that corda is at that stage yet. See the design specs for Corda HA/failover: discourse.corda.net/t/…Jacob

1 Answers

0
votes

You can write a pair of flows for the on/off node to request clone all the details from the always-online node.

On/Off node

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));

Always on node

//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));

Here is an example I wrote which the shareholder asks the company for any happened transaction about a StockState.