camel-users mailing list archives

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

You can use the recipient list EIP, and from a java bean you can
combine this with @RecipientList

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 <> 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:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message