You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by yaog <ya...@gmail.com> on 2010/01/07 10:40:23 UTC

correct use of choice

Hi,

I want to test out filters. I have this route:

<route id="route1">

   <from uri="direct:start" />						
   <to uri="bean:compAImpl" />

   <camel:setHeader
headerName="goto"><camel:constant>B</camel:constant></camel:setHeader>

   <camel:choice>

      <when>
           <camel:simple>in.header.goto='B'</camel:simple>
           <to uri="bean:compBImpl" />
      </when>

      <otherwise>
           <to uri="bean:compCImpl" />
      </otherwise>

   </camel:choice>
</route>

It is not working. only C is invoked.

What is wrong?
-- 
View this message in context: http://old.nabble.com/correct-use-of-choice-tp27057257p27057257.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: correct use of choice

Posted by yaog <ya...@gmail.com>.
Thanks.

Works now. I copied from a wrong example in another forum to begin with...
-- 
View this message in context: http://old.nabble.com/correct-use-of-choice-tp27057257p27057521.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: correct use of choice

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 7, 2010 at 10:40 AM, yaog <ya...@gmail.com> wrote:
>
> Hi,
>
> I want to test out filters. I have this route:
>
> <route id="route1">
>
>   <from uri="direct:start" />
>   <to uri="bean:compAImpl" />
>
>   <camel:setHeader
> headerName="goto"><camel:constant>B</camel:constant></camel:setHeader>
>
>   <camel:choice>
>
>      <when>
>           <camel:simple>in.header.goto='B'</camel:simple>
>           <to uri="bean:compBImpl" />
>      </when>
>
>      <otherwise>
>           <to uri="bean:compCImpl" />
>      </otherwise>
>
>   </camel:choice>
> </route>
>
> It is not working. only C is invoked.

The simple languages support a limited set of operators as listed here
http://camel.apache.org/simple.html

The eq is using double = so you should use == instead of only a single =

And you need ${ } around the header. Just check the simple
documentation page as there are plenty of examples.


>
> What is wrong?
> --
> View this message in context: http://old.nabble.com/correct-use-of-choice-tp27057257p27057257.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus