Reputation: 504
I have build a CorDapp using "Yo!CorDapp" example (https://github.com/corda/spring-observable-stream), over release-v1 of Corda platform.
The CorDapp has four nodes - Controller node (provides network map service and validating notary service), "node A", "node B" and "node C". Following are the flows defined in the app -
Flow 1: "Node A" sends a trade request to "Node B". "Node C" is also notified.
Flow 2: "Node B" approves the trade request, self-signs it, gets signature from A and closes the trade. "Node C" is also notified.
I want "Node A" to check whether "Node B" is running, so that it can decide to initiate the flow "Flow 1".
Is this possible? If yes, kindly elaborate.
Upvotes: 2
Views: 412
Reputation: 920
You should be able to check the network map cache:
serviceHub.networkMapCache.allNodes.map { node -> node.legalIdentities.first() }
Check that the party you want to communicate with is in that list.
That said, it should not matter if the counterparty node is up or not. Corda will handle delivery to the node when the counterparty comes back up.
Upvotes: 2