corda / net.corda.core.flows / FlowLogic / subFlow

subFlow

@Suspendable open fun <R> subFlow(subLogic: FlowLogic<R>): R

Invokes the given subflow. This function returns once the subflow completes successfully with the result returned by that subflow's call method. If the subflow has a progress tracker, it is attached to the current step in this flow's progress tracker.

If the subflow is not an initiating flow (i.e. not annotated with InitiatingFlow) then it will continue to use the existing sessions this flow has created with its counterparties. This allows for subflows which can act as building blocks for other flows, for example removing the boilerplate of common sequences of sends and receives.

Exceptions

FlowException - This is either thrown by subLogic itself or propagated from any of the remote FlowLogics it communicated with. The subflow can be retried by catching this exception.