如何将多个语句放入骆驼蓝图选择块中的逻辑表达式中?
How can I put multiple statements into a logical expression in a camel blueprint choice block?
在骆驼蓝图选择块中,我们有以下内容:
<when id='foo'
<simple><![CDATA[
${header.SrcSys} == 'System_A' and
${header.DestSys} == 'System_B'
]]></simple>
<!-- do something great -->
</when>
我知道这段代码不起作用,而且 and
已弃用 since Camel 2.9。但我想你知道我想做什么,也许你可以告诉我将这样一个简单的表达式实现到骆驼蓝图中的最佳方法 xml.
我找到了 this good answer by Claus Ibsen。也许我可以使用蓝图 xml 中的 PredicateBuilder
。但我试图找到一个没有 Java 代码的解决方案。
我会说你快到了。这对我有用:
<choice>
<when>
<!-- Do not break up the following simple expression over multiple lines. It won't work. -->
<simple>${exchangeProperty.prop1} == 'A' && ${exchangeProperty.prop2} == 'B'</simple>
<!-- Do something great... -->
</when>
</choice>
关键是不要将表达式拆分成多行。我无法让它工作。
在骆驼蓝图选择块中,我们有以下内容:
<when id='foo'
<simple><![CDATA[
${header.SrcSys} == 'System_A' and
${header.DestSys} == 'System_B'
]]></simple>
<!-- do something great -->
</when>
我知道这段代码不起作用,而且 and
已弃用 since Camel 2.9。但我想你知道我想做什么,也许你可以告诉我将这样一个简单的表达式实现到骆驼蓝图中的最佳方法 xml.
我找到了 this good answer by Claus Ibsen。也许我可以使用蓝图 xml 中的 PredicateBuilder
。但我试图找到一个没有 Java 代码的解决方案。
我会说你快到了。这对我有用:
<choice>
<when>
<!-- Do not break up the following simple expression over multiple lines. It won't work. -->
<simple>${exchangeProperty.prop1} == 'A' && ${exchangeProperty.prop2} == 'B'</simple>
<!-- Do something great... -->
</when>
</choice>
关键是不要将表达式拆分成多行。我无法让它工作。