我有一个抽象的消息处理器,我想将其封装在布尔值评估中,以便在某些条件下关闭它。我想写出类似这样的代码:
<flow name="myFlow">
<if expression="${myFlag} == true">
<mynamespace:myCustomMessageProcessor .../>
</if>
</flow>
这在Mule ESB中是否可行?是否有示例可供参考?
我有一个抽象的消息处理器,我想将其封装在布尔值评估中,以便在某些条件下关闭它。我想写出类似这样的代码:
<flow name="myFlow">
<if expression="${myFlag} == true">
<mynamespace:myCustomMessageProcessor .../>
</if>
</flow>
<scripting:component doc:name="Groovy" doc:description="This component is used to check the value from properties file" >
<scripting:script engine="Groovy">
// use your if else code here like
if(${myFlag} == true)
{
return message.payload
}
</scripting:script>
</scripting:component>
<choice>
路由器进行条件检查。您可以定义不同的<when>
和一个<otherwise>
条件,用于回退决策。<choice doc:name="Choice condition">
<when expression="#[flowVars.myVar = 'on']">
<logger level="INFO" message="Case: myVar is on" />
</when>
<when expression="#[flowVars.myVar = 'off']">
<logger level="INFO" message="Case: myVar is off" />
</when>
<otherwise>
<logger level="INFO" message="Case: otherwise the default route is used" />
</otherwise>
</choice>