Using Subflows

TIBCO Cloud Integration - Flogo (PAYG) provides the ability to call any flow from another flow in the same app. The flow being called becomes the subflow of the caller flow. This helps in separating the common app logic by extracting the reusable components in the app and creating standalone flows for them within the app. Any flow in the app can become a subflow for another flow within the same app. Also, there are no restrictions on how many subflows a flow can have or how many times the same subflow can be called or iterated in another flow. Hence, subflows are useful when you want to iterate a piece of app logic more than once or have the same piece of logic repeat in multiple locations within the app.

Here are a few points to keep in mind when creating and using subflows:

Note:
  • The subflow and its calling flow must both reside within the same app. You cannot call a flow from another app as a subflow in your app.
  • Subflows must be blank flows (flows without triggers). Flows that were created by starting with a trigger are not supported as subflows. This is because flows created with triggers do not have flow inputs and outputs configured (no Flow Inputs&Outputs tab which acts as the bridge between the subflow and its calling flow). The trigger input and output act as the flow input and output for flows created with a trigger. Hence, there is no bridge to connect the subflow to the Start a SubFlow activity in the calling flow.

  • Since you can call any flow from any other flow within the app, you must be careful not to create cyclical dependency where a flow calls a subflow and the subflow in turn calls its calling flow. This will result in an infinite calling cycle and you will receive an error "Cyclic dependency detected in the subflow".
  • Important!! You can delete any flow in an app even though the flow might be in use as a subflow within another flow. You will not receive any error messages at the time of deletion, but when you run the app, its exectution fails with an error.
  • You can configure the iteration details in the Loop tab of the Start a SubFlow activity. The Start a SubFlow activity iterates multiple times, resulting in the subflow being called multiple times.