Reference One Flow from Another with Flow Ref (Flow Designer)

By placing a Flow Ref core component in a flow, you can run one flow from another within the same application. When Flow Ref is reached in a flow, it triggers the referenced flow. The referenced flow runs and returns the Mule event object to the original flow where execution proceeds after the Flow Ref component. Flow Ref is handy for reusing groups of components within the same Mule application.

fd flow ref
Figure 1. A Flow Ref card referencing one flow from the main flow
  1. The trigger card starts the main flow.

  2. The Flow Ref card passes the output from the second card to the first card in the referenced flow, triggering that flow.

  3. The last card in the referenced flow passes its output to the card that comes after the Flow Ref card in the main flow.

  4. This card processes processes the input, creates its own output, and continues the main flow.

Procedure for creating and referencing a second flow

  1. Create a second flow by following these steps:

    1. Click the plus sign to the right of Flows in the Project pane..

      add flow
    2. In the bottom-left corner of the Let’s get started wizard, click Go straight to the canvas. The wizard creates a flow that begins with a trigger. However, a flow that you reference with a Flow Ref card must not begin with a trigger. The Flow Ref card is its trigger.

    3. Rename the flow.

      rename flow
  2. Return to the first flow by clicking its name under Flows in the Project pane..

  3. Add a Flow Ref card at the point in the flow that you want to run the other flow. In the Flow field of the card, select the second flow. Then, click Go.

  4. Add cards to the second flow, but do not add a trigger card. Ensure that the last card in this flow produces an output that you want to use as input for the card that comes after the Flow Ref card in the main flow. If the output needs to be transformed before it can be used in that next card in the main flow, use a Transform card after the Flow Ref card.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub
Submit your feedback!
Share your thoughts to help us build the best documentation experience for you!
Take our latest survey!