Re: rabbitmq component headers
Thanks Willem. The documentation says the URI should look like: rabbitmq://hostname[:port]/exchangeName?[options] So I do have the exchange name in the URI in my example. See http://camel.apache.org/rabbitmq.html Sent from phone On 21 Sep 2016 1:49 a.m., "Willem Jiang"wrote: > You should add the exchangeName parameter to the rabbitmq uri if you don’t > want to specify the message header there. > > -- > Willem Jiang > > > Blog: http://willemjiang.blogspot.com (English) > http://jnn.iteye.com (Chinese) > Twitter: willemjiang > Weibo: 姜宁willem > > > > On September 21, 2016 at 5:14:54 AM, Emre Kartoglu Ismail ( > ismailemrekarto...@gmail.com) wrote: > > Hello Camel users, > > > > I have a question regarding the camel-rabbitmq component. The following > > code sends the message “test” to exchange “A” with routing key “B” every > > 5 seconds: > > > > > > from("timer:test?period=5000").process(new Processor() { > > @Override > > public void process(Exchange exchange) throws Exception { > > exchange.getOut().setBody("test", String.class); > > exchange.getOut().getHeaders().put("rabbitmq.EXCHANGE_NAME", "A”); ** > > exchange.getOut().getHeaders().put("rabbitmq.ROUTING_KEY", "B”); ** > > } > > }) > > .to("rabbitmq://localhost/A?username=guest=guest& > routingKey=B=1=false"); > > > > > > > > However when I comment out the lines with **, the message does not get > > sent. Is this an expected behaviour? I found this stack overflow post, > > essentially discussing the same issue: > > http://stackoverflow.com/questions/22449086/apache- > camel-rabbitmq-endpoint-not-creating > > . > > > > There is a paragraph at http://camel.apache.org/rabbitmq.html that says > > > > "Headers are set by the consumer once the message is received. The > > producer will also set the headers for downstream processors once the > > exchange has taken place. Any headers set prior to production that the > > producer sets will be overridden.” > > > > The last sentence seems to suggest that the behaviour I described here > > is expected. My question then is would it not make more sense if we did > > not have to specifically set the headers in the out message? > > > > > > Kind regards, > > Ismail > > > >
Re: rabbitmq component headers
You should add the exchangeName parameter to the rabbitmq uri if you don’t want to specify the message header there. -- Willem Jiang Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On September 21, 2016 at 5:14:54 AM, Emre Kartoglu Ismail (ismailemrekarto...@gmail.com) wrote: > Hello Camel users, > > I have a question regarding the camel-rabbitmq component. The following > code sends the message “test” to exchange “A” with routing key “B” every > 5 seconds: > > > from("timer:test?period=5000").process(new Processor() { > @Override > public void process(Exchange exchange) throws Exception { > exchange.getOut().setBody("test", String.class); > exchange.getOut().getHeaders().put("rabbitmq.EXCHANGE_NAME", "A”); ** > exchange.getOut().getHeaders().put("rabbitmq.ROUTING_KEY", "B”); ** > } > }) > .to("rabbitmq://localhost/A?username=guest=guest=B=1=false"); > > > > > However when I comment out the lines with **, the message does not get > sent. Is this an expected behaviour? I found this stack overflow post, > essentially discussing the same issue: > http://stackoverflow.com/questions/22449086/apache-camel-rabbitmq-endpoint-not-creating > > . > > There is a paragraph at http://camel.apache.org/rabbitmq.html that says > > "Headers are set by the consumer once the message is received. The > producer will also set the headers for downstream processors once the > exchange has taken place. Any headers set prior to production that the > producer sets will be overridden.” > > The last sentence seems to suggest that the behaviour I described here > is expected. My question then is would it not make more sense if we did > not have to specifically set the headers in the out message? > > > Kind regards, > Ismail >
Re: rabbitmq component headers
Even you specify the routingKey in the rabbitmq uri, camel cannot find out the exchange name without checking it from message header. So you cannot comment out the exchange name setting part. -- Willem Jiang Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On September 21, 2016 at 5:14:54 AM, Emre Kartoglu Ismail (ismailemrekarto...@gmail.com) wrote: > Hello Camel users, > > I have a question regarding the camel-rabbitmq component. The following > code sends the message “test” to exchange “A” with routing key “B” every > 5 seconds: > > > from("timer:test?period=5000").process(new Processor() { > @Override > public void process(Exchange exchange) throws Exception { > exchange.getOut().setBody("test", String.class); > exchange.getOut().getHeaders().put("rabbitmq.EXCHANGE_NAME", "A”); ** > exchange.getOut().getHeaders().put("rabbitmq.ROUTING_KEY", "B”); ** > } > }) > .to("rabbitmq://localhost/A?username=guest=guest=B=1=false"); > > > > > However when I comment out the lines with **, the message does not get > sent. Is this an expected behaviour? I found this stack overflow post, > essentially discussing the same issue: > http://stackoverflow.com/questions/22449086/apache-camel-rabbitmq-endpoint-not-creating > > . > > There is a paragraph at http://camel.apache.org/rabbitmq.html that says > > "Headers are set by the consumer once the message is received. The > producer will also set the headers for downstream processors once the > exchange has taken place. Any headers set prior to production that the > producer sets will be overridden.” > > The last sentence seems to suggest that the behaviour I described here > is expected. My question then is would it not make more sense if we did > not have to specifically set the headers in the out message? > > > Kind regards, > Ismail >
Re: org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to validate xml
One part of this that's been bothering mainly due to my ignorance of not having used in my testing is the adviceWith. And the weaveById. Route definitions throw the generic big E exception. I wonder if you'd see anyting in there if you did something like this. At least that could identify whether there was a problem there or not. By the way I'm freehanding my try/catches there so the may not be aligned correctly. @Test public void testMessageReceived() throws Exception { try{ context.getRouteDefinition("i4ip-order-publish-route").adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { *try{* replaceFromWith("direct:in"); weaveById("publishedMessage").after().to("mock:increment"); *} catch(Exception e) {* *System.out.println("We threw an exception in the weaving".* * }* *} catch(Excepion e)* *System.out.println("We caught an error in the route builder."* *}* }); On Tue, Sep 20, 2016 at 12:15 PM, Brad Johnsonwrote: > Too bootstrap a route from the Java DSL you only need to do something like > this: > > http://camel.apache.org/schema/blueprint;> > > my.routes.internal > > > > And in the my.routes.internal package (or whatever you want to call it) you > would have route builder. You could put mock:out instead of direct:out. > You'll still use blueprint to export or import OSGi services if you are using > them but that's a trivial matter and I wouldn't worry about it just yet. > While those routes are hard coded in here you'll later replace them with > substitution variable names that you can change from the properties. Use the > default properties first and then you can override them in you cfg file for > production. > > public class ARouteBuilder extends RouteBuilder { > > public void configure() { > > from("direct:in") >.log("${body}") >.to("direct:out"); > > } > > } > > Also, I'm not sure how IDEA works but I'm sure there's something > equivalent to what one would do in Eclipse to start a project with a Maven > archetype. Just type in: > > camel-archetypes- > > and it should give you a list of sample archetypes to use to start a > project. Also, since you are using Fuse there's a selection of projects > under the "quickstarts" directory in there. > > Brad > > > > > On Tue, Sep 20, 2016 at 6:27 AM, owain > wrote: > >> Brad, >> >> I am using 2.15.6 since this is the >> closest >> to Fuse-6.2.1. I have just tried the test with CBTS 2.17.0. Is there a >> higher version? >> >> I add mock:increment (now refactored to mock:out) and replace the "from" >> with direct:in in. >> >> >> context.getRouteDefinition("i4ip-order-publish-route").advic >> eWith(context, >> new AdviceWithRouteBuilder() { >> @Override >> public void configure() throws Exception { >> replaceFromWith("direct:in"); >> weaveById("publishedMessage").after().to("mock:out"); >> } >> }); >> >> Also I am drawing the same conclusion about the XML only approach. Could >> you kind enough to post and example to how to bootstrap the Java DSL from >> the Blueprint XML. >> >> Thanks for your help. I will try putting it in a new project and see if >> that >> was the problem. In a single xml file. >> >> O. >> >> >> >> -- >> View this message in context: http://camel.465427.n5.nabble. >> com/org-osgi-service-blueprint-container-ComponentDefinition >> Exception-Unable-to-validate-xml-tp5787642p5787758.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> > >
rabbitmq component headers
Hello Camel users, I have a question regarding the camel-rabbitmq component. The following code sends the message “test” to exchange “A” with routing key “B” every 5 seconds: from("timer:test?period=5000").process(new Processor() { @Override public void process(Exchange exchange) throws Exception { exchange.getOut().setBody("test", String.class); exchange.getOut().getHeaders().put("rabbitmq.EXCHANGE_NAME", "A”); ** exchange.getOut().getHeaders().put("rabbitmq.ROUTING_KEY", "B”); ** } }) .to("rabbitmq://localhost/A?username=guest=guest=B=1=false"); However when I comment out the lines with **, the message does not get sent. Is this an expected behaviour? I found this stack overflow post, essentially discussing the same issue: http://stackoverflow.com/questions/22449086/apache-camel-rabbitmq-endpoint-not-creating . There is a paragraph at http://camel.apache.org/rabbitmq.html that says "Headers are set by the consumer once the message is received. The producer will also set the headers for downstream processors once the exchange has taken place. Any headers set prior to production that the producer sets will be overridden.” The last sentence seems to suggest that the behaviour I described here is expected. My question then is would it not make more sense if we did not have to specifically set the headers in the out message? Kind regards, Ismail
Re: org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to validate xml
Too bootstrap a route from the Java DSL you only need to do something like this: http://camel.apache.org/schema/blueprint;> my.routes.internal And in the my.routes.internal package (or whatever you want to call it) you would have route builder. You could put mock:out instead of direct:out. You'll still use blueprint to export or import OSGi services if you are using them but that's a trivial matter and I wouldn't worry about it just yet. While those routes are hard coded in here you'll later replace them with substitution variable names that you can change from the properties. Use the default properties first and then you can override them in you cfg file for production. public class ARouteBuilder extends RouteBuilder { public void configure() { from("direct:in") .log("${body}") .to("direct:out"); } } Also, I'm not sure how IDEA works but I'm sure there's something equivalent to what one would do in Eclipse to start a project with a Maven archetype. Just type in: camel-archetypes- and it should give you a list of sample archetypes to use to start a project. Also, since you are using Fuse there's a selection of projects under the "quickstarts" directory in there. Brad On Tue, Sep 20, 2016 at 6:27 AM, owainwrote: > Brad, > > I am using 2.15.6 since this is the closest > to Fuse-6.2.1. I have just tried the test with CBTS 2.17.0. Is there a > higher version? > > I add mock:increment (now refactored to mock:out) and replace the "from" > with direct:in in. > > > context.getRouteDefinition("i4ip-order-publish-route").adviceWith(context, > new AdviceWithRouteBuilder() { > @Override > public void configure() throws Exception { > replaceFromWith("direct:in"); > weaveById("publishedMessage").after().to("mock:out"); > } > }); > > Also I am drawing the same conclusion about the XML only approach. Could > you kind enough to post and example to how to bootstrap the Java DSL from > the Blueprint XML. > > Thanks for your help. I will try putting it in a new project and see if > that > was the problem. In a single xml file. > > O. > > > > -- > View this message in context: http://camel.465427.n5.nabble. > com/org-osgi-service-blueprint-container-ComponentDefinitionException- > Unable-to-validate-xml-tp5787642p5787758.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: cxf-core 3.1.7 Validation issue with camel
I think you you need to specify the schemaLocation from the spring configuration file to let the CXF Endpoint knows about. Please check the example here[1] [1]http://camel.apache.org/cxf.html#CXF-ConfiguretheCXFendpointswithSpring -- Willem Jiang Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On September 20, 2016 at 2:49:38 PM, sari.reach (sari.re...@gmail.com) wrote: > Please find the camel route below. Please let me know if you need additional > information. I am pasting the exception trace as well. > > > > > > uri="cxf:/HotelBookPort?wsdlURL=hotel/hotelbook.wsdl=PAYLOAD=true" > > /> > > > > loggingLevel="INFO"/> > > > > > Exception Trace: > > org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused > by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of > element 'ATT_CheckRS'.. > at > org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:99) > > at > org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:54) > > at > org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:100) > > at > org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:81) > > at > org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:137) > > at > org.apache.cxf.wsdl.interceptors.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68) > > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) > > at > org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:83) > > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) > > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > > at > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251) > > at > org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) > > at > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) > > at > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) > > at > org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180) > > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293) > > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:212) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:755) > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268) > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728p5787746.html > > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to validate xml
Brad, I am using 2.15.6 since this is the closest to Fuse-6.2.1. I have just tried the test with CBTS 2.17.0. Is there a higher version? I add mock:increment (now refactored to mock:out) and replace the "from" with direct:in in. context.getRouteDefinition("i4ip-order-publish-route").adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:in"); weaveById("publishedMessage").after().to("mock:out"); } }); Also I am drawing the same conclusion about the XML only approach. Could you kind enough to post and example to how to bootstrap the Java DSL from the Blueprint XML. Thanks for your help. I will try putting it in a new project and see if that was the problem. In a single xml file. O. -- View this message in context: http://camel.465427.n5.nabble.com/org-osgi-service-blueprint-container-ComponentDefinitionException-Unable-to-validate-xml-tp5787642p5787758.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: cxf-core 3.1.7 Validation issue with camel
Please find the camel route below. Please let me know if you need additional information. I am pasting the exception trace as well. http://camel.apache.org/schema/spring;> Exception Trace: org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'ATT_CheckRS'.. at org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:99) at org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:54) at org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:100) at org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:81) at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:137) at org.apache.cxf.wsdl.interceptors.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:83) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:212) at javax.servlet.http.HttpServlet.service(HttpServlet.java:755) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268) -- View this message in context: http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728p5787746.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel- WebSphere MQ Integration
Sent from my iPhone > On 20-Sep-2016, at 11:31 AM, sari.reach [via Camel] >wrote: > > Hi souciane, > > I am posting message to websphere queue with all the headers set to camel > message but this message is not published to MQ. However, when I try to > publish it with a standalone applciation, the message is published. Please > find sample code below. > > message.setHeader("provider-uri", providerUri); > message.setHeader(JmsConstants.JMS_IBM_MQMD_APPLIDENTITYDATA, > > appIdententyData()); > message.setHeader(JmsConstants.JMS_IBM_MQMD_MSGID, createMsgId()); > message.setHeader(JmsConstants.JMS_IBM_MQMD_PERSISTENCE, > > MQC.MQPER_NOT_PERSISTENT); > MQMessage mqMessage = new MQMessage(); > mqMessage.write(byte[]) > message.setBody(mqMessage); > > if (camelContext.getComponent(connName) == null) { > camelContext.addComponent(connName, JmsComponent > > .jmsComponent(createWMQConnection(wmqHost, mqPort, > > queueMngr, channel))); > > } > > > private UserCredentialsConnectionFactoryAdapter > createWMQConnection( > String host, int port, String > queueMngr, String channel) > throws JMSException { > > MQEnvironment.CCSID = 943; > MQEnvironment.channel = channel; > MQEnvironment.hostname = host; > MQEnvironment.port = port; > > MQPutMessageOptions pmo = new > MQPutMessageOptions(); > > pmo.options = MQC.MQPMO_FAIL_IF_QUIESCING > + > MQC.MQPMO_SET_IDENTITY_CONTEXT; > > JmsFactoryFactory ff = JmsFactoryFactory > > .getInstance("com.ibm.msg.client.wmq"); > JmsConnectionFactory cf = > ff.createConnectionFactory(); > // Set the properties > cf.setStringProperty("XMSC_WMQ_HOST_NAME", > host); > cf.setIntProperty("XMSC_WMQ_PORT", port); > cf.setStringProperty("XMSC_WMQ_CHANNEL", > channel); > cf.setBooleanProperty("Use MQCSP > authentication", true); > cf.setIntProperty("XMSC_WMQ_CONNECTION_MODE", > 1); > > cf.setStringProperty("XMSC_WMQ_QUEUE_MANAGER", queueMngr); > > ucf = new > UserCredentialsConnectionFactoryAdapter(); > ucf.setTargetConnectionFactory(cf); > ucf.setUsername("JTB0001"); > ucf.setPassword("1BOI6F4Ztgkd4X6EDNaQ9"); > return ucf; > } > > > > > > If you reply to this email, your message will be added to the discussion > below: > http://camel.465427.n5.nabble.com/Camel-WebSphere-MQ-Integration-tp5787731p5787741.html > To start a new topic under Camel - Users, email > ml-node+s465427n465428...@n5.nabble.com > To unsubscribe from Camel - Users, click here. > NAML -- View this message in context: http://camel.465427.n5.nabble.com/Camel-WebSphere-MQ-Integration-tp5787731p5787745.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel- WebSphere MQ Integration
Hi souciane, I am posting message to websphere queue with all the headers set to camel message but this message is not published to MQ. However, when I try to publish it with a standalone applciation, the message is published. Please find sample code below. message.setHeader("provider-uri", providerUri); message.setHeader(JmsConstants.JMS_IBM_MQMD_APPLIDENTITYDATA, appIdententyData()); message.setHeader(JmsConstants.JMS_IBM_MQMD_MSGID, createMsgId()); message.setHeader(JmsConstants.JMS_IBM_MQMD_PERSISTENCE, MQC.MQPER_NOT_PERSISTENT); MQMessage mqMessage = new MQMessage(); mqMessage.write(byte[]) message.setBody(mqMessage); if (camelContext.getComponent(connName) == null) { camelContext.addComponent(connName, JmsComponent .jmsComponent(createWMQConnection(wmqHost, mqPort, queueMngr, channel))); } private UserCredentialsConnectionFactoryAdapter createWMQConnection( String host, int port, String queueMngr, String channel) throws JMSException { MQEnvironment.CCSID = 943; MQEnvironment.channel = channel; MQEnvironment.hostname = host; MQEnvironment.port = port; MQPutMessageOptions pmo = new MQPutMessageOptions(); pmo.options = MQC.MQPMO_FAIL_IF_QUIESCING + MQC.MQPMO_SET_IDENTITY_CONTEXT; JmsFactoryFactory ff = JmsFactoryFactory .getInstance("com.ibm.msg.client.wmq"); JmsConnectionFactory cf = ff.createConnectionFactory(); // Set the properties cf.setStringProperty("XMSC_WMQ_HOST_NAME", host); cf.setIntProperty("XMSC_WMQ_PORT", port); cf.setStringProperty("XMSC_WMQ_CHANNEL", channel); cf.setBooleanProperty("Use MQCSP authentication", true); cf.setIntProperty("XMSC_WMQ_CONNECTION_MODE", 1); cf.setStringProperty("XMSC_WMQ_QUEUE_MANAGER", queueMngr); ucf = new UserCredentialsConnectionFactoryAdapter(); ucf.setTargetConnectionFactory(cf); ucf.setUsername("JTB0001"); ucf.setPassword("1BOI6F4Ztgkd4X6EDNaQ9"); return ucf; } -- View this message in context: http://camel.465427.n5.nabble.com/Camel-WebSphere-MQ-Integration-tp5787731p5787741.html Sent from the Camel - Users mailing list archive at Nabble.com.