Using Subflows
Flogo 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:
- 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.
- 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 results in an infinite calling cycle and the "Cyclic dependency detected in the subflow" error is displayed.
- You can configure the iteration details on 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.