camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Illtud Daniel <illtud.dan...@llgc.org.uk>
Subject Re: <xpath>$headername = 'value</xpath> still works?
Date Sun, 19 Sep 2010 15:59:46 GMT
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?

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.

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.daniel@llgc.org.uk
Prif Swyddog Technegol                          Chief Technical Officer
Llyfrgell Genedlaethol Cymru                  National Library of Wales

Mime
View raw message