To Reference Another Flow (Design Center)

By placing a Flow Ref component in a flow you can execute another flow in your application. When this component is executed, it triggers the referenced flow into action. When the referenced flow is finished executing, the original flow continues where it left off after the Flow Ref component with the returned Mule event object from the referenced flow.

The Flow Ref compoonent is useful for reusing groups of components, you can create these components once in a separate flow, and then reference that flow from other flows in your application.

You can only reference flows that exist in the same Mule application.
  1. In Design Center, create an initial flow by adding components.

    Make sure this flow starts with a trigger, such as a Scheduler or an HTTP Listener.

  2. Create a second flow in your Mule project by clicking the Plus sign next to Flows on the left nav-bar.

    reference flow task design center 5a256

  3. Rename both of your flows to make them easier to identify. To do so, click the Options icon reference flow task design center b93f3 next to each flow name, and select Rename.

  4. Return to your first flow by clicking on its name in the left nav-bar.

  5. Add a Flow Ref component anywhere in this flow. In the Flow field, select your second flow.

  6. Go to your second flow by clicking its name on the left nav-bar or by clicking the Go button on the Flow Ref component. Build this second flow out by adding components.

    Don’t add a trigger to your second flow, as it’s meant to be triggered by the Flow Ref.

    When your first flow is triggered, data is processed through this flow until the flow reaches the Flow Ref component. The entire second flow gets executed. After the second flow finishes executing, the rest of the components (if there are any) in the first flow, are executed.

In this topic: