Я определил внешний xml, который содержит несколько выражений.Динамические условия Mule
<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>
В основном потоке я хотел бы оценить эти вычеты, но результат всегда верен. Вот что я сделал до сих пор.
<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
Great! Да, с помощью этого метода некоторые ярлыки выражения недоступны. – MarcosNC