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 Thu, 28 Feb 2008 17:40:12 GMT

Thank you James!!

I'll get the latest drop and try out Juel.

Also, I strongly recommend adding the JMS SQL style selector capability, as
it will make for a much easier sell for projects considering switching to
ActiveMQ ... who are already working with legacy enterprise messaging
brokers, like Tibco (which rely quite heavily on this mechanism).



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--tp15339501s22882p15741806.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message