Camel routing based on an xpath value in an XML message

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Camel routing based on an xpath value in an XML message

mtod
I would like to perform a Camel route based on an xpath value in an XML message.

The XML Message example:

<xmlMessage>
        <header>
                <version>1</version>               
                <msgType>Event</msgType>       
                <source>App1<source>               
                <route>topic.A</route>
                <destination>AppA</destination>
        </header>
        <payload/>
</xmlMessage>

ActiveMQ example:

<camelContext id="TrackingRoute" xmlns="http://camel.apache.org/schema/spring">
        <route>
                <from uri="activemq:queue:queue.incoming"/>                       
                <filter>
                        <to uri="activemq:topic:topic.${topicUri}"/>       
                </filter>
    </route>
</camelContext>

Is it possible to query the XML using an xpath expression to return the destination value to a variable then use that to define the to uri?

Thanks

Mike
Reply | Threaded
Open this post in threaded view
|

Re: Camel routing based on an xpath value in an XML message

tabish121@gmail.com
On 03/31/2014 04:38 PM, mtod wrote:

> I would like to perform a Camel route based on an xpath value in an XML
> message.
>
> The XML Message example:
>
> <xmlMessage>
> <header>
> <version>1</version>
> <msgType>Event</msgType>
> <source>App1<source>
> <route>topic.A</route>
> <destination>AppA</destination>
> </header>
> <payload/>
> </xmlMessage>
>
> ActiveMQ example:
>
> <camelContext id="TrackingRoute"
> xmlns="http://camel.apache.org/schema/spring">
> <route>
> <from uri="activemq:queue:queue.incoming"/>
> <filter>
> <to uri="activemq:topic:topic.${topicUri}"/>
> </filter>
>      </route>
> </camelContext>
>
> Is it possible to query the XML using an xpath expression to return the
> destination value to a variable then use that to define the to uri?
>
> Thanks
>
> Mike
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Camel-routing-based-on-an-xpath-value-in-an-XML-message-tp4679753.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
You should direct that to the Camel mailing lists, this is for AMQ
questions.
https://camel.apache.org/mailing-lists.html

--
Tim Bish
Sr Software Engineer | RedHat Inc.
[hidden email] | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/

Reply | Threaded
Open this post in threaded view
|

Re: Camel routing based on an xpath value in an XML message

mtod
This is being implemented in ActiveMQ should it still go to Camel?
Reply | Threaded
Open this post in threaded view
|

Re: Camel routing based on an xpath value in an XML message

ceposta
Inline...

On Mon, Mar 31, 2014 at 1:56 PM, mtod <[hidden email]> wrote:
> This is being implemented in ActiveMQ should it still go to Camel?
>

Yes, you're asking about the routing and that is Camel :)

The quick answer is "Yes" you can do what you're asking.. use xpath
expressions and a dynamic router, or recipient list.

>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Camel-routing-based-on-an-xpath-value-in-an-XML-message-tp4679753p4679755.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



--
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta