First Successful in Mule 4
In mule 4 first successful sends payload to the list
of message processors until one process it successfully.
Flow:
Method: GET
Output:
XML project code:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="09c43633-4a07-458e-8ca7-5c9626559cab" >
<http:listener-connection host="0.0.0.0" port="8085" />
</http:listener-config>
<flow name="test_firstsucessfulFlow" doc:id="e01df686-3165-4ea7-9f93-f6f99364e86f" >
<http:listener doc:name="Listener" doc:id="b5e61a58-71e8-4cc3-987a-df955fd04e9a" config-ref="HTTP_Listener_config" path="/first"/>
<set-variable doc:name="Set Variable" doc:id="2a49e8f3-2446-4f45-921b-d7c8397ca3c2" variableName="var1" value="1"/>
<set-variable value="2" doc:name="Set Variable" doc:id="092294bd-39f2-41ff-a890-e4c54ab9f45d" variableName="var2"/>
<first-successful doc:name="First Successful" doc:id="db8d86b2-26d0-4c9e-a518-4becebcd60e2" >
<route >
<set-payload value="#[vars.var1]" doc:name="Set Payload" doc:id="ecfb2b75-2cf7-4e4a-89c1-1b46c6a394b8" />
</route>
<route >
<set-payload value='#[vars.var2]' doc:name="Set Payload" doc:id="c5ba54de-c613-4171-8114-66458062ce61" />
</route>
</first-successful>
</flow>
</mule>
No comments:
Post a Comment