Yannick
Yannick

Reputation: 683

How can I put multiple statements into a logical expression in a camel blueprint choice block?

Inside a camel blueprint choice block we have the following:

<when id='foo'
    <simple><![CDATA[
        ${header.SrcSys} == 'System_A' and
        ${header.DestSys} == 'System_B'
    ]]></simple>

    <!-- do something great -->
</when>

I know this code is not working and also that and ist deprecated since Camel 2.9. But I think you know what I'm trying to do and maybe you can tell me the best way to implement such a simple expression into a camel blueprint xml.

I found this good answer by Claus Ibsen. Maybe I could use the PredicateBuilder inside the blueprint xml. But I try to find a solution without Java code.

Upvotes: 0

Views: 1058

Answers (1)

Ralf
Ralf

Reputation: 6853

I'd say you are almost there. This works for me:

<choice>
    <when>
        <!-- Do not break up the following simple expression over multiple lines. It won't work. -->
        <simple>${exchangeProperty.prop1} == 'A' &amp;&amp; ${exchangeProperty.prop2} == 'B'</simple>
        <!-- Do something great... -->
    </when>
</choice>

The key is not to split the expression across multiple lines. I could not get this to work.

Upvotes: 1

Related Questions