You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gerald Kallas <ca...@mailbox.org> on 2020/01/14 16:26:03 UTC

Simple condition doesn't always work with the 'contains' operator (Camel 3.0.0)

Dear community,

I've following Blueprint DSL snippet inside Camel 3.0.0 ..

..

<log message="body class: ${body.class()}" />
<choice>
<when>
<simple>${body.class()} contains 'GroupedExchangeList'</simple>
<log message="inner condition" />
</when>
</choice>
..

The first log message is been written like ..

body class: class org.apache.camel.processor.aggregate.AbstractListAggregationStrategy$GroupedExchangeList

The simple condition should evaluate if the class name contains 'GroupedExchangeList'. Nevertheless this doesn't work, the log message 'inner condition' ist not shown.

The change to

<simple>${body.class().toString()} contains 'GroupedExchangeList'</simple>

did the trick. When do I need to perform an explicit type conversion?

Best
- Gerald

Re: Simple condition doesn't always work with the 'contains' operator (Camel 3.0.0)

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You should get the name of the class  ${body.class.name}

On Tue, Jan 14, 2020 at 5:26 PM Gerald Kallas <ca...@mailbox.org> wrote:
>
> Dear community,
>
> I've following Blueprint DSL snippet inside Camel 3.0.0 ..
>
> ..
>
> <log message="body class: ${body.class()}" />
> <choice>
> <when>
> <simple>${body.class()} contains 'GroupedExchangeList'</simple>
> <log message="inner condition" />
> </when>
> </choice>
> ..
>
> The first log message is been written like ..
>
> body class: class org.apache.camel.processor.aggregate.AbstractListAggregationStrategy$GroupedExchangeList
>
> The simple condition should evaluate if the class name contains 'GroupedExchangeList'. Nevertheless this doesn't work, the log message 'inner condition' ist not shown.
>
> The change to
>
> <simple>${body.class().toString()} contains 'GroupedExchangeList'</simple>
>
> did the trick. When do I need to perform an explicit type conversion?
>
> Best
> - Gerald



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2