You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mtod09 <mt...@thetods.net> on 2014/04/01 16:05:28 UTC
Re: Camel routing based on an xpath value in an XML message.
I'm having a problem getting the value from the Dest Element and using it in
the recipient list.
I don't get any errors but the message does not show up in the topics.
I'm using an input queue "activemq:queue:queue.ESB.incoming" then it should
route to 2 topics based on the Dest values.
XML Message example:
<FMIMessage version="1.0" MsgID="1804343574">
<Header1>
<Source>Pipeline</Source>
<AppVersion>1.1</AppVersion>
<Dest>topic:trftracking, topic:test</Dest>
</Header1>
<Event/>
</FMTMessage>
ActiveMQ.xml :
<camelContext id="TrackingRoute"
xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:queue:queue.ESB.incoming"/>
<recipientList delimiter=",">
<xpath>/Header1/Dest</xpath>
</recipientList>
</route>
</camelContext>
Note: I'm using ActiveMQ 5.9
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-based-on-an-xpath-value-in-an-XML-message-tp5749578p5749629.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel routing based on an xpath value in an XML message.
Posted by mtod09 <mt...@thetods.net>.
I was able to get this to work using the following:
ActiveMQ XMl:
<camelContext id="TRFTrackingRoute"
xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:queue:queue.ESB.incoming"/>
<setHeader headerName="Route1">
<xpath resultType="String">/FMIMessage/Header1/Dest/text()</xpath>
</setHeader>
<recipientList delimiter="false">
<header>Route1</header>
</recipientList>
</route>
</camelContext>
Message:
<FMIMessage version="1.0" MsgID="1804343574">
<Header1>
<Source>Pipeline</Source>
<AppVersion>1.1</AppVersion>
<Dest>activemq:topic:trftracking</Dest>
</Header1>
<Event/>
</FMIMessage>
Thanks for the insight.
Mike
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-based-on-an-xpath-value-in-an-XML-message-tp5749578p5749642.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel routing based on an xpath value in an XML message.
Posted by mtod09 <mt...@thetods.net>.
Thanks for the update.
I'm still have issues updating the header.
<camelContext id="TRFTrackingRoute"
xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:queue:queue.ESB.incoming"/>
<setHeader headerName="JMSDestinationName">
<xpath>/Header1/Dest/text()</xpath>
</setHeader>
<to uri="activemq:queue:trftracking"/>
</route>
</camelContext>
I tried setting the header but when I run this I don't get the correct
value.
Only the to uri is set.
I tried using a different header name "Route1" but that did not work.
Thanks
Mike
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-based-on-an-xpath-value-in-an-XML-message-tp5749578p5749640.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel routing based on an xpath value in an XML message.
Posted by "kraythe ." <kr...@gmail.com>.
I think your xpath is wrong, try: /Header1/Dest/text()
The easiest way to diagnose issues like these is split into two steps.
First store the value from the xpath in a header and then pass the header
to recipient list. That will allow you to use tracer to follow the flow.
*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*
On Tue, Apr 1, 2014 at 9:05 AM, mtod09 <mt...@thetods.net> wrote:
> I'm having a problem getting the value from the Dest Element and using it
> in
> the recipient list.
> I don't get any errors but the message does not show up in the topics.
>
> I'm using an input queue "activemq:queue:queue.ESB.incoming" then it should
> route to 2 topics based on the Dest values.
>
> XML Message example:
>
> <FMIMessage version="1.0" MsgID="1804343574">
> <Header1>
> <Source>Pipeline</Source>
> <AppVersion>1.1</AppVersion>
> <Dest>topic:trftracking, topic:test</Dest>
> </Header1>
> <Event/>
> </FMTMessage>
>
>
> ActiveMQ.xml :
>
> <camelContext id="TrackingRoute"
> xmlns="http://camel.apache.org/schema/spring">
> <route>
> <from uri="activemq:queue:queue.ESB.incoming"/>
> <recipientList delimiter=",">
> <xpath>/Header1/Dest</xpath>
> </recipientList>
> </route>
> </camelContext>
>
> Note: I'm using ActiveMQ 5.9
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-routing-based-on-an-xpath-value-in-an-XML-message-tp5749578p5749629.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>