我定義了一個外部xml,其中包含幾個表達式。騾動態條件
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring-security="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.1/mule-spring-security.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<beans:bean id="conditions" class="java.util.ArrayList" name="conditions">
<beans:constructor-arg>
<beans:list>
<beans:value>#[flowVars.price == '1000']</beans:value>
<beans:value>...</beans:value>
</beans:list>
</beans:constructor-arg>
</beans:bean>
</mule>
在主要流程中,我想評估這些experssions,但結果總是如此。這是我迄今爲止所做的。
<spring:beans>
<spring:import resource="classpath:my-conf-dir/expressions.xml"/>
</spring:beans>
<flow name="mainFlow" doc:name="mainFlow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<expression-filter expression="#[payload != '/favicon.ico']" doc:name="Expression"/>
<set-variable variableName="price" value="1001" doc:name="Set Price" />
<foreach collection="#[app.registry.get('conditions')]" doc:name="For Each">
<logger message="Condition: #[payload]" level="INFO" doc:name="Logger"/>
<choice>
<when expression="#[payload]">
<logger message="OK" level="INFO" doc:name="Logger"/>
</when>
<otherwise>
<logger message="KO" level="INFO" doc:name="Logger"/>
</otherwise>
</choice>
</foreach>
</flow>
有什麼方法可以評估表達式列表嗎?
任何幫助,將不勝感激。
它的工作原理,雖然我不得不修改表達 – Daniel 2015-02-12 14:02:04
太棒了!是的,某些表達式快捷鍵無法使用此方法。 – MarcosNC 2015-02-12 14:48:27