You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mta38 <mt...@orange-ftgroup.com> on 2009/02/04 11:39:03 UTC
Write routing condition in xml config file
Hi all,
Is someone can say me how to test a header exchange value in a xml config
file.
For example, if the header TEST exists in my " IN "message and its value is
10, I want to do the following:
<route>
<from uri="…"
<choice>
<when>
In.header.TEST==10
<to uri="…"/>
</when>
…
</choice>
</route>
Any help are welcome,
Best regards
Mta38
--
View this message in context: http://www.nabble.com/Write-routing-condition-in-xml-config-file-tp21828008s22882p21828008.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Write routing condition in xml config file
Posted by mta38 <mt...@orange-ftgroup.com>.
I found the answer by myself
Seems (but i'm not sure :-)) that choice processor is not the right
processor to use.
In fact, if we use <filter> instead like that :
<route>
<from uri="..." />
<filter>
<el>${in.headers['TEST '] == 10}</el>
<to uri="...." />
</filter>
...
</route>
the behaviour is right as expected =).
Mta38
mta38 wrote:
>
> Hi all,
> Is someone can say me how to test a header exchange value in a xml config
> file.
> For example, if the header TEST exists in my " IN "message and its value
> is 10, I want to do the following:
>
> <route>
> <from uri="…"
> <choice>
> <when>
> In.header.TEST==10
> <to uri="…"/>
> </when>
>
> …
> </choice>
>
> </route>
> Any help are welcome,
>
> Best regards
>
> Mta38
>
>
--
View this message in context: http://www.nabble.com/Write-routing-condition-in-xml-config-file-tp21828008s22882p21831713.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Write routing condition in xml config file
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Feb 4, 2009 at 11:39 AM, mta38 <mt...@orange-ftgroup.com> wrote:
>
> Hi all,
> Is someone can say me how to test a header exchange value in a xml config
> file.
> For example, if the header TEST exists in my " IN "message and its value is
> 10, I want to do the following:
>
> <route>
> <from uri="…"
> <choice>
> <when>
> In.header.TEST==10
> <to uri="…"/>
> </when>
>
> …
> </choice>
>
> </route>
> Any help are welcome,
See this wiki page:
http://camel.apache.org/content-based-router.html
The $ notation will get the header.
So you should do:
<xpath>$TEST = '10'</xpath>
Otherwise you can try some of the other languages
http://camel.apache.org/languages.html
... that can do = comparison, such as EL.
http://camel.apache.org/el.html
And the xpath is documented here:
http://camel.apache.org/xpath.html
>
> Best regards
>
> Mta38
>
> --
> View this message in context: http://www.nabble.com/Write-routing-condition-in-xml-config-file-tp21828008s22882p21828008.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/