Flogo Subflows: Boosting the Manteniability of Your Software

Reuse is one of the most important capabilities in Application Development and this is something that has been implemented so great in Flogo Enterprise that you’re going to be amazed how great it is. Let’s take a look at Flogo Subflows

In Flogo it doesn’t exist the concept of Subflow when you create an application, you only can create flows. If you remember Flow was created based on Triggers and Actions:

Application In Terms Of&Nbsp;Flogo

So, what is subflow in Flogo? A Flow without the triggers. That simple. So, it means that I need to create a new flow, but removing any trigger or using a special trigger so this could be reused in a different flow? No. Not needed.

Any flow can be reused as subflows as is. Only change when you invoke it as a subflow the triggers are not going to be executed. That simple. So, yes, you can reuse any flow you’ve created without doing anything at all. Let’s see how

Remember the application that we’ve created in the past post about GraphQL:

We have a flow named Mutation_asignUser where we need to gather the info from the user and the company, the same thing we were already doing in the following flows Query_currentUser and Query_company. So, how easy is to reuse them? Let’s take a look at Mutation_asignUser in more detail:

Mutation_Asignuser With Highlighted Subflows&Nbsp;Usage

In the activities with the red box around is where we’re calling our “subflows” and this is so easy as include an activity called “Start a SubFlow”

This activity is going to ask for the flow, that it could be any flow you have in your application (not flows from other applications can be included as subflow)

And once you select the flow, input and output are going to be populated based on the flow interface. So easy, right?

Let’s hack it! and start creating more Flogo apps!!!!

If you find this content interesting please think about making a contribution using the button below to keep this content updated and increased!

Alexandre Vazquez: