camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: spring xpath message router
Date Tue, 26 Jun 2012 14:08:04 GMT
Hi

You can use the recipient list EIP, and from a java bean you can
combine this with @RecipientList
http://camel.apache.org/recipientlist-annotation.html

XPath is a complex language, and figuring out how to do like can take time.
But I think it has a sub string function etc.

If you wanna go down that path. Then I suggest using some xpath UI
tool where you can live enter xpath expressions
and see when you get it working.

I assume there may be some plugins for that to install in an IDE or the likes.




On Tue, Jun 26, 2012 at 2:35 PM, john race <john.race@wwctrials.com> wrote:
> Camel spring routing:
>
> I'm trying to route a message depending on the content of an element. e.g.
> for elements "aaaa_test1"/"aaaa_test2"/"bbbb_test"/"cccc_test" I want to say
> - if the first 4 characters are "aaaa" route to queue 1, "bbbb" route to
> queue 2, etc.
>
> I know I can do a direct comparison (e.g. <xpath>/root/element =
> 'aaaa_test1'</xpath> ) but want to make it more flexible. Ideally I want to
> acheive the following:
>
> <choice>
>    <when>
>    <xpath>/root/element *LIKE *'aaaa'</xpath>
>        <inOnly uri="activemq:queue1"/>
>    </when>
>    <xpath>/root/element *LIKE *'bbbb'</xpath>
>        <inOnly uri="activemq:queue2"/>
>    </when>
>    <otherwise>
>        <inOnly uri="activemq:queue3"/>
>    </otherwise>
> </choice>
>
>
> Anyone know how to do this?
>
> thanks.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/spring-xpath-message-router-tp5715114.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message