camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jar Lyons <jarlath.ly...@tideworks.com>
Subject Re: How do I get a Content Based Router configured in XML with ActiveMQ?
Date Sat, 15 Mar 2008 00:55:23 GMT

James,

I got the latest from the trunk and got juel working just fine.  Thank
You!!!

My last hurdle is how to route based on JMS message properties ....   It
doesn't look like the properties are available in juel .... so I tried going
after a property using the 'simple' syntax, but no joy ...

      <filter>
       
<simple>${in.header.JMSType.startsWith('RTLS.draymanLocate')}</simple>
        <to uri=.......>
      </filter>

Are the properties easily available via any of the standard expression
languages?  And if so, what exactly is the syntax?

I'd be happy to contribute some of my final settings to the site as examples
....

Jar




James.Strachan wrote:
> 
> On 07/02/2008, Jar Lyons <jarlath.lyons@tideworks.com> wrote:
>>
>> I have been trying for days now to get a message based router working in
>> ActiveMQ 5.1, and the only success I have had is with xpath.
>>
>> Unfortunately, xpath will only work when the message body is xml ...
>> which
>> often is not the case for me.
>>
>> Here is an example of what does work (assuming the message body is xml):
>>
>>     <route>
>>       <from uri="activemq:queue.dev.Tideworks.HelloWorld"/>
>>       <filter>
>>         <xpath>$JMSType = 'Tideworks.GateVision.OCR.Lane'</xpath>
>>         <to uri="activemq:queue.dev.Tideworks.HelloWorld"/>
>>       </filter>
>>     </route>
>>
>> So ... once I realized this only works with fully xml message bodies, I
>> tried all of the following, with no luck  ...
>>
>>   <route>
>>     <from uri="activemq:queue.dev.Tideworks.HelloWorld"/>
>>     <filter>
>>         <simple>property.JMSType =
>> 'Tideworks.GateVision.OCR.Lane'</simple>
>>         <to uri="activemq:queue.dev.Tideworks.HelloWorld.it_works"/>
>>     </filter>
>>   </route>
>>
>>   <route>
>>     <from uri="activemq:queue.dev.Tideworks.HelloWorld"/>
>>     <filter>
>>         <el>in.headers.jmstype startswith 'Tideworks'</el>
>>         <to uri="activemq:queue.dev.Tideworks.HelloWorld.it_works"/>
>>     </filter>
>>   </route>
>>
>> All of the above configurations will load and run without throwing
>> exceptions, but only the xpath example will do what I want.  And again, I
>> need to be able to operate with non-xml messages.
>>
>> In the ideal world, I would use a filter that allows me to use the same
>> style JMS selector expressions that a developer would be accustomed to
>> using
>> when configuring a MessageDrivenBean.
>>
>> I must be missing something very obvious here ....
> 
> I guess one option could be to add JMS SQL selector syntax into the
> filter as a language, which wouldn't be too hard.
> 
> For non-XML payloads then EL is probably the best choice (or OGNL if
> you know its syntax).
> 
> Its mostly a question of getting the EL expression correct for what
> you need. Maybe a little JUnit test case can help you experiment with
> EL expression (e.g. see the JuelLanguageTest in the camel-juel module
> for a place you can experiment).
> 
> FWIW I thought JUEL had method invocation enabled by default - it
> turns out it doesn't :). I've just raised this issue...
> https://issues.apache.org/activemq/browse/CAMEL-347
> 
> its now been fixed in trunk; so you can use expressions like:
> 
> ${in.headers.foo.startsWith('a')}
> 
> with JUEL and it works with method calls. Note with EL you use ${}
> around the dyamic bits - as JUEL can be used to create Strings too.
> 
> e.g. the following is valid JUEL
> 
> <el>hello ${in.header.name} how are you?</el>
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/How-do-I-get-a-Content-Based-Router-configured-in-XML-with-ActiveMQ--tp15339501s22882p16063142.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message