On Sun, Sep 19, 2010 at 5:59 PM, Illtud Daniel
<illtud.dan...@llgc.org.uk> wrote:
> On 19/09/10 07:40, Claus Ibsen wrote:
>
>> And could you double check that there is no old versions of camel in
>> the classpath?
>> And the data you send is valid XML
>
> Ah. That's the problem. Since I wasn't using xpath to actually
> search any xml, I had a test message with no valid xml content.
> If I switch the content for xml, then it works as expected.
>
> Since the Content-Based Router EIP documents using <xpath>
> for content-based routing swiching on header values, does
> this mean you can only do this if the content is XML? Seems
> odd to me to tie one thing (routing on header values) to
> another unrelated property (XMLness of message). What if
> you want to switch based on headers but are sending JSON or
> text?

Yeah xpath works on the entire message expecting it to be in XML. You
know the world of XML used to be like "conquer the world".
So XML is up till your both ears.


>
> It does seem odd to me to overload the <xpath> operator
> with non-valid xpath to match on a header value anyway,
> to be honest.
>
> Somebody else suggested using:
> <simple>$header.foo=='value'</simple>
>
> Looking at the documentation for simple, I've tried:
>
>    <from uri="activemq:test_in"/>
>    <choice inheritErrorHandler="true" id="choice1">
>        <when inheritErrorHandler="true">
>            <simple>${in.header.foo}=='yes'</simple>
>            <to uri="activemq:test_out_true" inheritErrorHandler="true"
> id="to1"/>
>        </when>
>        <otherwise inheritErrorHandler="true">
>            <to uri="activemq:test_out_other" inheritErrorHandler="true"
> id="to2"/>
>        </otherwise>
>    </choice>
>
> But that *always* routes to test_out_true, regardless of the value
> of the foo header.

You need spaces around the operators
          <simple>${in.header.foo} == 'yes'</simple>




>
> I'm using stomp, BTW, to create the message in the first place, which
> may have a bearing on the problem. I can see the message properties
> (headers) in the activemq console, but I can't tell what type they
> are.
> .
>
> --
> Illtud Daniel                                 illtud.dan...@llgc.org.uk
> Prif Swyddog Technegol                          Chief Technical Officer
> Llyfrgell Genedlaethol Cymru                  National Library of Wales
>



-- 
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

Reply via email to