0
votes

I have written an RPC client that connects to my node and starts a flow. If my RPC client disconnects before the flow completes, how can I retrieve the flow and check its status (e.g. if it has completed)?

1

1 Answers

0
votes

The flow returns a unique identifier when started. If you store this unique identifier somewhere, you can use it later to retrieve the flow and check its status, e.g. by printing its current progress tracker step:

val flowId = cordaRPCOps.startFlowDynamic(MyFlow::class.java).id

val flow = cordaRPCOps.stateMachinesSnapshot().single { it.id == flowId }

val flowSteps = flow.progressTrackerStepAndUpdates!!

println(flowSteps.snapshot.last())