Lots of exchange instances are being created.

2015-10-21 Thread akab
Hi
i have a question about exchange creating in camel routes and ill explain my
issue with the following example knowing that i am using camel-2.15.1:
i have a simple camel route like this :



the Simple bean class is :



and the simple pojo is :



when i run this route then i check Jprofiler Live memory for objects
creating i found 100 SimplePojo instances and 600 DefaultExchange instances
living in the memory and never get collected by the GC,.

i decided to open the camel source code and noticed the copy method in the
DefaultExchange class which was being called several times and also the
constructors of the DefaultExchange class which results in creation of many
Instances of the DefaultExchange refrencing the simplePojo instances
preventing the GC from collecting them and free the memory.

i would like to ask why all these instences of the exchange object are being
created and why they are being referenced even after the route has completed
the execution, and why they still reference my pojo.
because as it is now this represent a very big memory leak issue.
thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Lots-of-exchange-instances-are-being-created-tp5772941.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Metrics during Exception

2015-10-21 Thread vivekrao001
Hi,

I have a question regarding the metrics, for the following route :

from("direct:in")
.to("metrics:timer:simple.timer?action=start")
.to("*direct:calculate*")
.to("metrics:timer:simple.timer?action=stop");

If the *direct:calculate* raises an exception, what would be the
consequences, should we try to stop the timer in exception block? And the
timer will not stop until a new request pass through?

Any suggestion is greatly appreciated.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Metrics-during-Exception-tp5772948.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exchanges body and properites are not collected if it contains reference object which lead to memory leak

2015-10-21 Thread Darwish
The  issue fixed and it's not related to body content type !

The case for anyone may face this issue result from a SEDA point with NO
consuming route "BLACK HOLE " , i have a seda point in a route context 
defined in separate file  , in main camel config file I imported that file
and disable "comment " the routecontext  ... 

The result , all camel context exchange messages  forwarded  to this memory
queue waiting a processing "consuming" and  kept in memory heap forever!






-
Othman Darwish
ProgressSoft Corp.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Exchanges-body-and-properites-are-not-collected-if-it-contains-reference-object-which-lead-to-memoryk-tp5772861p5772954.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Is it possible to read the contents of a file in Camel Spring DSL w/o File component?

2015-10-21 Thread Claus Ibsen
Look at wire tap eip, or the threads eip.

On Wed, Oct 21, 2015 at 5:38 PM, gramanero  wrote:
> I have searched through the user forum and done some research through Camel
> docs as well, so if I missed the answer somewhere then I apologize.
>
> I read that the File component is single threaded and what I would like to
> be able to do, all while staying within Spring DSL, is to read file and fire
> off a call to a web service. I do have this working, however I really want
> to process the files in a multi-threaded fashion so as to speed up the
> process. I can scale out using more servers, but that is less than ideal.
>
> is there a way to queue up the name and location of the file, pull that info
> off of a queue (i.e. from(activemq) and then read the file contents to fire
> off to a web service, without getting back into a single threaded scenario?
>
> Just looking for general direction and I should be able to take it from
> there.
>
> Much appreciated!
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Is-it-possible-to-read-the-contents-of-a-file-in-Camel-Spring-DSL-w-o-File-component-tp5772942.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition


Is it possible to read the contents of a file in Camel Spring DSL w/o File component?

2015-10-21 Thread gramanero
I have searched through the user forum and done some research through Camel
docs as well, so if I missed the answer somewhere then I apologize.

I read that the File component is single threaded and what I would like to
be able to do, all while staying within Spring DSL, is to read file and fire
off a call to a web service. I do have this working, however I really want
to process the files in a multi-threaded fashion so as to speed up the
process. I can scale out using more servers, but that is less than ideal.

is there a way to queue up the name and location of the file, pull that info
off of a queue (i.e. from(activemq) and then read the file contents to fire
off to a web service, without getting back into a single threaded scenario?

Just looking for general direction and I should be able to take it from
there.

Much appreciated!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Is-it-possible-to-read-the-contents-of-a-file-in-Camel-Spring-DSL-w-o-File-component-tp5772942.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Is it possible to read the contents of a file in Camel Spring DSL w/o File component?

2015-10-21 Thread gramanero
I think threads may be the way to go because i am using the File component in
a way that deletes the file upon successful processing. The WireTap route,
should it fail, means that my file is gone and I lose knowledge that the
File ever existed (I am still learning so perhaps that in and of itself is a
poor approach).

Also, I am stuck on Camel 2.8 so not sure how much flexibility I have with
threads, but essentially it looks like I would do something like this:


   
   
  
   


My question is, does this free up the single threaded file component to pick
up another file? If so, what happens if the processing inside the thread
fails? I suspect that the File component will have already deleted the file
at that point?

Thank you Claus for the quick response!




--
View this message in context: 
http://camel.465427.n5.nabble.com/Is-it-possible-to-read-the-contents-of-a-file-in-Camel-Spring-DSL-w-o-File-component-tp5772942p5772945.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Is it possible to read the contents of a file in Camel Spring DSL w/o File component?

2015-10-21 Thread gramanero
I just discovered this article
(http://www.davsclaus.com/2009/05/on-road-to-camel-20-concurrency-with.html).
I think this answers my questions above. It is the  that takes over
the file exchange as handles the file completion piece. That tells me that
the deletion of the file will happen in the  message exchange and
that the File component is free to pick p another file.

If I am understanding that correctly, then that is exactly what i needed.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Is-it-possible-to-read-the-contents-of-a-file-in-Camel-Spring-DSL-w-o-File-component-tp5772942p5772946.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Rest DSL Jetty multiple handlers causes java.lang.StackOverflowError

2015-10-21 Thread Karts
Hi,

On 2.16.0, I am getting a StackOverflowError when I have multiple handlers
defined for my restConfiguration jetty component. It works with single
handlers.





This causes the following exception on startup: 

2015-10-21 21:29:59,543 [main   ] WARN  AbstractLifeCycle 
- FAILED org.eclipse.jetty.server.Server@58035754:
java.lang.StackOverflowError
java.lang.StackOverflowError
at
org.eclipse.jetty.server.handler.AbstractHandlerContainer.expandHandler(AbstractHandlerContainer.java:80)
at
org.eclipse.jetty.server.handler.HandlerWrapper.expandChildren(HandlerWrapper.java:123)
...(loops)

If I just use either securityHandler or jettyRequestLog alone, it works
fine. 

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Rest-DSL-Jetty-multiple-handlers-causes-java-lang-StackOverflowError-tp5772952.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Bindy dataformat usage in Spring v/s Java DSL

2015-10-21 Thread calyan.bandi
Hi,

I am working on a camel route that reads an excel and does some processing.
I had this written in Spring DSL as shown below.



   


In the processor, the exchange body i received is
java.util.ArrayList. Using a simple iterator i was able to do my
processing. 

List orders = exchange.getIn().getBody(List.class);
for(Order order : orders)
{
  // simply reading the order object and doing processing
}


Recently, we moved to Java DSL and the code looks as below and below is how
we have our route written.

DataFormat bindy = new BindyCsvDataFormat("org.examples.camel.model");

from("file:csv?fileName=orders1.csv=true")
.unmarshal(bindy)
.process(new Processor() {
.
 });

The exchange body that i have received in my processor is of type:
java.util.ArrayList>

Why is there a difference in the way the exchange body is created in both
the cases? The camel documentation for bindy data format -
http://camel.apache.org/bindy.html also tells that the exchange body will be
of type List> but this is not the case with Spring
DSL. 

Thanks,
Kalyan



--
View this message in context: 
http://camel.465427.n5.nabble.com/Bindy-dataformat-usage-in-Spring-v-s-Java-DSL-tp5772940.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Share database connection pool among routes

2015-10-21 Thread ramnar
No Im using spring



--
View this message in context: 
http://camel.465427.n5.nabble.com/Share-database-connection-pool-among-routes-tp5772925p5772929.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Spring Boot WS - After receiving request, camel throws NullPointerException

2015-10-21 Thread yuncil
Thanks a lot, Claus. Will this fix be i the new camel version, or where do I
get the fix then?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Spring-Boot-WS-After-receiving-request-camel-throws-NullPointerException-tp5772930p5772936.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Spring Boot WS - After receiving request, camel throws NullPointerException

2015-10-21 Thread Claus Ibsen
Yeah any of the next release will have the fix

On Wed, Oct 21, 2015 at 2:27 PM, yuncil  wrote:
> Thanks a lot, Claus. Will this fix be i the new camel version, or where do I
> get the fix then?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Spring-Boot-WS-After-receiving-request-camel-throws-NullPointerException-tp5772930p5772936.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition


Spring Boot WS - After receiving request, camel throws NullPointerException

2015-10-21 Thread yuncil
Hi guys,

recently I try to expose a SOAP-WS with Spring-Boot and Camel, on
Glassfish-4.0. I send my requests via SOAP-UI and they'll be received
sucessfully by the WS. I can see the messages in the log-files but then
camel throws a NullPointerException. More specific, the
DefaultRuntimeEndpointRegistry class throws it. I think it could be a
problem getting the request URI. Maybe you can help me.

*Here is my set-up:*

@Configuration
public class ServiceConfigurator extends WsConfigurerAdapter {
Logger logger = Logger.getLogger(ServiceConfigurator.class);

private static final String CAMEL_URL_MAPPING = "/ws/*";

@Bean
public CamelEndpointMapping endpointMapping(ApplicationContext
applicationContext) {
logger.info("Konfiguriere EndpointMapping...");
CamelEndpointMapping mapping = new CamelEndpointMapping();

return mapping;
}

@Bean
public ServletRegistrationBean
messageDispatcherServlet(ApplicationContext applicationContext) {
logger.info("Konfiguriere MessageDispatcher...");
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
ServletRegistrationBean bean = new ServletRegistrationBean(servlet,
CAMEL_URL_MAPPING);
bean.setLoadOnStartup(1);
return bean;
}

*The Camel-Route looks like this:*

@Component
public class ServiceRoutes extends RouteBuilder {
Logger logger = Logger.getLogger(ServiceRoutes.class);

@Override
public void configure() throws Exception {
   logger.info("Konfiguriere Camel-Routes...");

 from("spring-ws:soapaction:mySoapAction#endpointMapping")
   .convertBodyTo(String.class)
   .log(${body})
   .setBody(simple("MyResponse"))
   .end();

}

*Here is my stacktrace:*

Error notifying event ID-WSU05812-52703-1445423313461-0-2 exchange created:
Exchange[ID-WSB03512-52703-1445423313461-0-2][SpringWebserviceMessage[SaajSoapMessage
{http://example//search]]. This exception will be ignored. 
java.lang.NullPointerException
at
org.apache.camel.impl.DefaultRuntimeEndpointRegistry.notify(DefaultRuntimeEndpointRegistry.java:245)
at org.apache.camel.util.EventHelper.doNotifyEvent(EventHelper.java:805)
at
org.apache.camel.util.EventHelper.notifyExchangeCreated(EventHelper.java:411)
at
org.apache.camel.impl.DefaultUnitOfWork.(DefaultUnitOfWork.java:123)
at
org.apache.camel.impl.DefaultUnitOfWork.(DefaultUnitOfWork.java:72)
at
org.apache.camel.impl.DefaultUnitOfWorkFactory.createUnitOfWork(DefaultUnitOfWorkFactory.java:34)
at
oRerg.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.createUnitOfWork(CamelInternalProcessor.java:663)
at
org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.before(CamelInternalProcessor.java:631)
at
org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.before(CamelInternalProcessor.java:608)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:138)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)
at
org.apache.camel.component.spring.ws.SpringWebserviceConsumer.invoke(SpringWebserviceConsumer.java:61)
at
org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:43)
at
org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:236)
at
org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:176)
at
org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89)
at
org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:61)
at
org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
at
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at

Re: Spring Boot WS - After receiving request, camel throws NullPointerException

2015-10-21 Thread Claus Ibsen
Hi

Ah the NPE has been fixed in camel-core but its due the component that
creates the exchange is likely doing it the wrong way (without telling
which endpoint its from).

Let me dive into camel-spring-ws to see about that and fix it there too.

On Wed, Oct 21, 2015 at 1:12 PM, yuncil  wrote:
> Hi guys,
>
> recently I try to expose a SOAP-WS with Spring-Boot and Camel, on
> Glassfish-4.0. I send my requests via SOAP-UI and they'll be received
> sucessfully by the WS. I can see the messages in the log-files but then
> camel throws a NullPointerException. More specific, the
> DefaultRuntimeEndpointRegistry class throws it. I think it could be a
> problem getting the request URI. Maybe you can help me.
>
> *Here is my set-up:*
>
> @Configuration
> public class ServiceConfigurator extends WsConfigurerAdapter {
> Logger logger = Logger.getLogger(ServiceConfigurator.class);
>
> private static final String CAMEL_URL_MAPPING = "/ws/*";
>
> @Bean
> public CamelEndpointMapping endpointMapping(ApplicationContext
> applicationContext) {
> logger.info("Konfiguriere EndpointMapping...");
> CamelEndpointMapping mapping = new CamelEndpointMapping();
>
> return mapping;
> }
>
> @Bean
> public ServletRegistrationBean
> messageDispatcherServlet(ApplicationContext applicationContext) {
> logger.info("Konfiguriere MessageDispatcher...");
> MessageDispatcherServlet servlet = new MessageDispatcherServlet();
> servlet.setApplicationContext(applicationContext);
> servlet.setTransformWsdlLocations(true);
> ServletRegistrationBean bean = new ServletRegistrationBean(servlet,
> CAMEL_URL_MAPPING);
> bean.setLoadOnStartup(1);
> return bean;
> }
>
> *The Camel-Route looks like this:*
>
> @Component
> public class ServiceRoutes extends RouteBuilder {
> Logger logger = Logger.getLogger(ServiceRoutes.class);
>
> @Override
> public void configure() throws Exception {
>logger.info("Konfiguriere Camel-Routes...");
>
>  from("spring-ws:soapaction:mySoapAction#endpointMapping")
>.convertBodyTo(String.class)
>.log(${body})
>.setBody(simple("MyResponse"))
>.end();
>
> }
>
> *Here is my stacktrace:*
>
> Error notifying event ID-WSU05812-52703-1445423313461-0-2 exchange created:
> Exchange[ID-WSB03512-52703-1445423313461-0-2][SpringWebserviceMessage[SaajSoapMessage
> {http://example//search]]. This exception will be ignored.
> java.lang.NullPointerException
> at
> org.apache.camel.impl.DefaultRuntimeEndpointRegistry.notify(DefaultRuntimeEndpointRegistry.java:245)
> at 
> org.apache.camel.util.EventHelper.doNotifyEvent(EventHelper.java:805)
> at
> org.apache.camel.util.EventHelper.notifyExchangeCreated(EventHelper.java:411)
> at
> org.apache.camel.impl.DefaultUnitOfWork.(DefaultUnitOfWork.java:123)
> at
> org.apache.camel.impl.DefaultUnitOfWork.(DefaultUnitOfWork.java:72)
> at
> org.apache.camel.impl.DefaultUnitOfWorkFactory.createUnitOfWork(DefaultUnitOfWorkFactory.java:34)
> at
> oRerg.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.createUnitOfWork(CamelInternalProcessor.java:663)
> at
> org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.before(CamelInternalProcessor.java:631)
> at
> org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.before(CamelInternalProcessor.java:608)
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:138)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)
> at
> org.apache.camel.component.spring.ws.SpringWebserviceConsumer.invoke(SpringWebserviceConsumer.java:61)
> at
> org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:43)
> at
> org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:236)
> at
> org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:176)
> at
> org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89)
> at
> org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:61)
> at
> org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293)
> at
> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
> at
> org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
> at 

Re: Swagger error

2015-10-21 Thread Anton Hughes
FYI - this issue has been fixed in
https://github.com/wildfly-extras/wildfly-camel/issues/923  - thanks goes
to the Wildfly-camel team.

On Sat, Oct 17, 2015 at 2:09 PM, Anton Hughes  wrote:

>
> On Sat, Oct 17, 2015 at 1:58 PM, Claus Ibsen 
> wrote:
>
>> Ah I think they plan on support camel-swagger-java in the near future.
>
>
> Unless I am mistaken, it is already supported:
> https://github.com/wildfly-extras/wildfly-camel/issues/895
>


Re: Share database connection pool among routes

2015-10-21 Thread Henryk Konsek
Hi,

Add you data source to your Camel registry [1]. For example for Spring that
would be just adding data source bean. Then refer to that data source in
your endpoints. For example:

@Bean
DataSource myDataSource() {
  ...
}

from("timer:dbOperation").to("jdbc:myDataSource");

Cheers!

[1] http://camel.apache.org/registry.html

śr., 21.10.2015 o 09:42 użytkownik ramnar  napisał:

> Hi
> I want to share the database connection poll among various routes i
> have.Iam
> using apache common dbcp to implement database connection pooling.Some
> where
> it was mentioned to create osgi service of the connection pool and use the
> service in all the routes.But I could not find resources how to do it.Any
> pointer s to it .Thanks in advance
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Share-database-connection-pool-among-routes-tp5772925.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
-- 
Henryk Konsek
http://about.me/hekonsek


Share database connection pool among routes

2015-10-21 Thread ramnar
Hi
I want to share the database connection poll among various routes i have.Iam
using apache common dbcp to implement database connection pooling.Some where
it was mentioned to create osgi service of the connection pool and use the
service in all the routes.But I could not find resources how to do it.Any
pointer s to it .Thanks in advance



--
View this message in context: 
http://camel.465427.n5.nabble.com/Share-database-connection-pool-among-routes-tp5772925.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Share database connection pool among routes

2015-10-21 Thread ramnar
Hi
Thanks for the solution.But my routes are in different bundles not in the
same bundle.Will the solution work in that case



--
View this message in context: 
http://camel.465427.n5.nabble.com/Share-database-connection-pool-among-routes-tp5772925p5772927.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Share database connection pool among routes

2015-10-21 Thread Matt Sicker
Are you using blueprints?

On 21 October 2015 at 03:56, ramnar  wrote:

> Hi
> Thanks for the solution.But my routes are in different bundles not in the
> same bundle.Will the solution work in that case
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Share-database-connection-pool-among-routes-tp5772925p5772927.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Matt Sicker