Nav

Flow Reference Component Reference

Use a Flow Reference component in a flow to direct Mule to send a message to another flow for processing. When a message reaches a flow reference component in a flow, Mule sends the message to another flow according to the configuration of the flow-ref attributes.

When Mule passes a message to another flow via a flow reference, the message is not carried via a transport. Thus, any outbound properties on the message remain outbound properties rather than being converted into inbound properties (as they would be if the message crossed the transport barrier.)

A flow reference can route messages to any type of flow within the same application. Refer to Flows and Subflows for more information.

Configuration

  1. Place the Flow Reference component on the canvas at the point where you want the current flow to call another flow. 

    flowref

  2. Open the flow reference component’s Properties Editor to configure it according to the table below.

    flowrefconf

Attribute Value Description

Display Name

Flow Reference

Customize to display a unique name for the component in your application.

Flow name

Mule auto-populates this drop-down with the flow names in your application

Select the name of the flow that you want to invoke using this flow reference.

Add a flow-ref element to your flow, then configure its attributes according to the table below. Refer to code sample below.

Element Description

flow-ref

Insert the flow-ref element into your code at the point where you want the current flow to call another flow.

Element Attribute Description

name

Specify the name of the flow that you want to invoke using this flow reference.

doc:name

Customize to display a unique name for the component in your application.

Note: This attribute is not required in a Mule Standalone configuration.

<flow-ref name="flowrefFlow" doc:name="flowrefFlow"/>

Example Flow Reference XML


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
        xmlns:spring="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
    <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration"/>
    <flow name="flowrefexampleFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/flow1" doc:name="HTTP"/>
        <set-payload value="Flow 1" doc:name="Set Payload"/>
        <logger message="#[message]" level="INFO" doc:name="Logger"/>
        <flow-ref name="Flow2" doc:name="Call Flow 2"/>
    </flow>
    <flow name="Flow2">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/flow2" doc:name="HTTP"/>
        <set-payload value="Flow 2" doc:name="Set Payload"/>
        <logger message="#[message]" level="INFO" doc:name="Logger"/>
    </flow>
</mule>

See Also