... <choice doc:name="Choice"> <when expression="#[flowVars['language'] == 'Spanish']"> <set-payload value="Hola!" doc:name="Reply in Spanish"/> </when> <when expression="#[flowVars['language'] == 'French']"> <set-payload value="Bonjour!" doc:name="Reply in French"/> </when> <otherwise> <logger message="No language specified. Using English as a default." level="INFO" doc:name="Logger"/> <set-variable variableName="language" value="English" doc:name="Set Language to English"/> <set-payload value="Hello!" doc:name="Reply in English"/> </otherwise> </choice> ...
<?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" version="EE-3.4.1" 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/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> <flow name="CBR_TutorialFlow1" doc:name="CBR_TutorialFlow1"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/> <expression-filter expression="#[message.payload != '/favicon.ico']" doc:name="Expression"/> <set-variable doc:name="Set Language Variable" value="#[message.inboundProperties['language']]" variableName="language"/> <choice doc:name="Choice"> <when expression="#[flowVars['language'] == 'Spanish']"> <set-payload doc:name="Reply in Spanish" value="Hola!"/> </when> <when expression="#[flowVars['language'] == 'French']"> <set-payload doc:name="Reply in French" value="Bonjour!"/> </when> <otherwise> <flow-ref name="CBR_TutorialFlow2" doc:name="Flow Reference"/> </otherwise> </choice> <logger level="INFO" doc:name="Logger" message="The reply "#[message.payload]" means "hello" in #[flowVars['language']]."/> </flow> <sub-flow name="CBR_TutorialFlow2" doc:name="CBR_TutorialFlow2"> <logger message="No language specified. Using English as a default." level="INFO" doc:name="Logger"/> <set-variable variableName="language" value="English" doc:name="Set Language to English"/> <set-payload value="Hello!" doc:name="Reply in English"/> </sub-flow> </mule>
Mule ESB-Content-Based Routing Tutorial(2),布布扣,bubuko.com
Mule ESB-Content-Based Routing Tutorial(2)
原文地址:http://blog.csdn.net/shan9liang/article/details/18360383