You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mtod <mt...@thetods.net> on 2016/12/13 06:14:42 UTC
cameRoutesBrokerPlugin namespace question
I'm working with ActiveMQ 5.14.1 and trying to get the
camelRoutesBrokerPlugin to work with namespaces.
when I setup a routes.xml file that uses the following:
<routes id="esbRoute1" xmlns="http://camel.apache.org/schema/spring"
xmlns:km="http://xsdrepo.xxxx.com/messaging/esb" >
<route>
<from uri="activemq:queue:esb.*"/>
<doTry>
<to
uri="validator:http://xsdrepo.xxxx.com/messaging/esb/ESBMessageV3.xsd"/>
<setHeader headerName="Route1">
<xpath logNamespaces="true"
resultType="String">/km:FMIMessage/km:Header/km:Route/text()</xpath>
</setHeader>
<recipientList delimiter="false">
<header>Route1</header>
</recipientList>
<doCatch>
<exception>org.apache.camel.ValidationException</exception>
<onWhen>
<simple>${exception.message}</simple>
</onWhen>
<to uri="activemq:queue:invalid.schema"/>
</doCatch>
</doTry>
</route>
</routes>
And send a message to the esb.testit queue I receive a namespace error :
Prefix must resolve to a namespace: km
Normally using an import with a cameContext I would place the namespace in
the camelContext element.
such as :
<camelContext id="esbRoute1" trace="false" streamCache="true"
xmlns="http://camel.apache.org/schema/spring"
xmlns:km="http://xsdrepo.xxxx.com/messaging/esb">
That would work fine but with the plugin I don't seem to have that option.
Is there a way to add a namespace to the routes.xml camel file?
Thanks
Mike
--
View this message in context: http://activemq.2283324.n4.nabble.com/cameRoutesBrokerPlugin-namespace-question-tp4720237.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: cameRoutesBrokerPlugin namespace question
Posted by mtod <mt...@thetods.net>.
I noticed you said "next Camel 2.18.x" so does that mean it's not in the
current 2.18.1?
Any idea when that will be out?
Thanks
Mike
--
View this message in context: http://activemq.2283324.n4.nabble.com/cameRoutesBrokerPlugin-namespace-question-tp4720237p4720271.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: cameRoutesBrokerPlugin namespace question
Posted by mtod <mt...@thetods.net>.
Thanks for that info.
Do you have an example?
I tried Camel 2.18.1
*Activemq.log*
jvm 1 | INFO | Apache Camel 2.18.1 (CamelContext:
EmbeddedCamel-localhost) started in 0.166 seconds
*My routes file:*
<routes id="esbRoute1" xmlns="http://camel.apache.org/schema/spring"
xmlns:km="http://xsdrepo.xxxx.com/messaging/esb" >
<route>
<from uri="activemq:queue:esb.*/>
<doTry>
<to
uri="validator:http://xsdrepo.xxxx.com/messaging/esb/ESBMessageV3.xsd"/>
<setHeader headerName="Route1">
<xpath logNamespaces="true"
resultType="String">/km:FMIMessage/km:Header/km:Route/text()</xpath>
</setHeader>
<recipientList delimiter="false">
<header>Route1</header>
</recipientList>
<doCatch>
<exception>org.apache.camel.ValidationException</exception>
<onWhen>
<simple>${exception.message}</simple>
</onWhen>
<to uri="activemq:queue:invalid.schema"/>
</doCatch>
</doTry>
</route>
</routes>
*Error:
*
jvm 1 | org.apache.camel.builder.xml.InvalidXPathExpression: Invalid
xpath: /km:FMIMessage/km:Header/km:Route/text(). Reason:
javax.xml.xpath.XPathExpressionException: com.sun.org.apache.xpath.inte
rnal.domapi.XPathStylesheetDOM3Exception: Prefix must resolve to a
namespace: km
jvm 1 | at
org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:794)[camel-core-2.18.1.jar:2.18.1]
--
View this message in context: http://activemq.2283324.n4.nabble.com/cameRoutesBrokerPlugin-namespace-question-tp4720237p4720268.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: cameRoutesBrokerPlugin namespace question
Posted by Claus Ibsen <cl...@gmail.com>.
We have added support for namespaces in <routes> in next Camel 2.18.x
and 2.19.0 releases.
On Tue, Dec 13, 2016 at 7:14 AM, mtod <mt...@thetods.net> wrote:
> I'm working with ActiveMQ 5.14.1 and trying to get the
> camelRoutesBrokerPlugin to work with namespaces.
>
> when I setup a routes.xml file that uses the following:
>
> <routes id="esbRoute1" xmlns="http://camel.apache.org/schema/spring"
> xmlns:km="http://xsdrepo.xxxx.com/messaging/esb" >
> <route>
> <from uri="activemq:queue:esb.*"/>
> <doTry>
> <to
> uri="validator:http://xsdrepo.xxxx.com/messaging/esb/ESBMessageV3.xsd"/>
> <setHeader headerName="Route1">
> <xpath logNamespaces="true"
> resultType="String">/km:FMIMessage/km:Header/km:Route/text()</xpath>
> </setHeader>
> <recipientList delimiter="false">
> <header>Route1</header>
> </recipientList>
> <doCatch>
> <exception>org.apache.camel.ValidationException</exception>
> <onWhen>
> <simple>${exception.message}</simple>
> </onWhen>
> <to uri="activemq:queue:invalid.schema"/>
> </doCatch>
> </doTry>
> </route>
> </routes>
>
> And send a message to the esb.testit queue I receive a namespace error :
> Prefix must resolve to a namespace: km
>
> Normally using an import with a cameContext I would place the namespace in
> the camelContext element.
>
> such as :
>
> <camelContext id="esbRoute1" trace="false" streamCache="true"
> xmlns="http://camel.apache.org/schema/spring"
> xmlns:km="http://xsdrepo.xxxx.com/messaging/esb">
>
>
> That would work fine but with the plugin I don't seem to have that option.
>
> Is there a way to add a namespace to the routes.xml camel file?
>
> Thanks
>
> Mike
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/cameRoutesBrokerPlugin-namespace-question-tp4720237.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2