Blueprint and property placeholder

2016-09-20 Thread dpravin
Hello All,

We have some common properties, not integration/bundle specific. Can
multiple routes/bundles refer to these property files from blueprint using
cm:property-placeholder?

I also found out that if you have set update-strategy="reload" the bundle
get restarted irrespective of the property being used by the bundle. Is this
the default behavior? Is there anything that can help avoid reload/restart
of bundle if the property is not used?

Thanks,
Pravin 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Blueprint-and-property-placeholder-tp5787763.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel MQTT Connection Pooling

2016-09-20 Thread Joe San
Camel Users,

Is there a comparable pooled connection implementation for the MQTT
component in Camel? For the ActiveMQ / JMS, there is a
*PoolingConnectionFactory* that I could use. Is there something for the
MQTT component? Looking at the configuration parameters, I suspect it is
not:

http://camel.apache.org/mqtt.html

Any suggestions?

Thanks and Regards,
Joe


Re: rabbitmq component headers

2016-09-20 Thread Ismail Emre Kartoglu
Sorry, I’ve switched to using the camel & rabbitmq-component version 2.17.3 
(latest in maven central repo), and my initial issue does not exist with this 
version. 

Now I have a slightly different question:

from("rabbitmq://localhost/A?username=guest&password=guest&routingKey=B&threadPoolSize=1&autoAck=false")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("X: " + 
exchange.getIn().getBody(String.class));
exchange.getOut().setBody("Test X");
exchange.getOut().getHeaders().put(“key”, “val"); **
}
})
.to("rabbitmq://localhost/C?username=guest&password=guest&routingKey=D&threadPoolSize=1&autoAck=false");



If you comment out the line with **, the message does not get sent to exchange 
C, as specified in the “to” endpoint, because:

1) in-message headers contain the exchange name and routing key of the consumer.
2) out-message headers copy the in-headers if no out-message header is set.
3) RabbitMQProducer.java (2.17.3), line 246 and 248 set the exchange name and 
routing key from the header, and ignore the producer URI configuration.


I think the documentation suggests that this is the expected behaviour. But it 
would be more intuitive to set the exchange name and the routing key from the 
producer uri, rather than setting it from the in-message headers (which are not 
visible in code) and ignoring the producer configuration.

Kind regards
Ismail


> On 21 Sep 2016, at 05:26, Ismail Emre Kartoglu  
> wrote:
> 
> 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&password=guest&routingKey=B&threadPoolSize=1&autoAck=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: cxf-core 3.1.7 Validation issue with camel

2016-09-20 Thread sari.reach
Hi,

Please find the entire camel-config.xml. 
Schema information is inside the resource folder(in classpath). For this
scenario, request validation is working fine and only response validation is
creating an issue



http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:camel="http://camel.apache.org/schema/spring";
xmlns:cxf="http://camel.apache.org/schema/cxf";
xsi:schemaLocation="http://www.springframework.org/schema/beans 
   
http://www.springframework.org/schema/beans/spring-beans.xsd
   
http://camel.apache.org/schema/spring 
  
http://camel.apache.org/schema/spring/camel-spring.xsd
   http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd";>


http://camel.apache.org/schema/spring";>












--
View this message in context: 
http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728p5787798.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: rabbitmq component headers

2016-09-20 Thread Ismail Emre Kartoglu
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&password=guest&
> routingKey=B&threadPoolSize=1&autoAck=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

2016-09-20 Thread Willem Jiang
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&password=guest&routingKey=B&threadPoolSize=1&autoAck=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

2016-09-20 Thread Willem Jiang
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&password=guest&routingKey=B&threadPoolSize=1&autoAck=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

2016-09-20 Thread Brad Johnson
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 Johnson  wrote:

> 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

2016-09-20 Thread Ismail Emre Kartoglu

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&password=guest&routingKey=B&threadPoolSize=1&autoAck=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

2016-09-20 Thread Brad Johnson
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").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

2016-09-20 Thread Willem Jiang
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&dataFormat=PAYLOAD&properties.schema-validation-enabled=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

2016-09-20 Thread owain
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.