Re: Lifecycle of a Camel Component

2009-11-27 Thread Claus Ibsen
Hi Peter



On Fri, Nov 27, 2009 at 5:33 AM, Pete Mueller p...@routecloud.com wrote:

 Thanks very much for your answers, I also found an excellent programming
 guide at the FUSEsource site.  That helped a lot as well.

 I understand what you wrote below, but it raises some concerns in my mind
 with the reliability of Camel when dealing with unreliable external
 entities.  I'm guessing that just stems from a lack of understanding on my
 part.  If it helps, I come from an EDI background where systems are designed
 to gaurantee delivery of millions of messages a day to thousands of
 different endpoints.  I'll try and illustrate my concern.

 I have two routes, the input, from a custom component, is a graphic image
 that is analyized (which can take 30-90 seconds) and them placed on a queue.
 The second route takes items off the queue and emails them to a destination
 AND puts the modified image back on the server.
 Something like:

 from(mycomp:host)
 .to(new MyImageProcessor())
 .to(amq:input_queue);

 from(amq:input_queue)
 multicast().to(smtp:t...@test.com, mycomp:host);

 Here what I need to account for:
 1.  Most importantly, I cannot lose any messages.  So let's say that a
 message is taken off the queue and passed to the smtp component, but the
 mail server is not up, so it throws an exception.
 - What happens to the message?  Does it get placed back on the queue?  Is
 there a concept of transactions around routes so that only after BOTH
 endpoints confirm a sucessful delivery does the message get removed from the
 queue?

Yes you can use transactions so the message will be rolled back to the
JMS queue.

 - What if the smtp server sucessfully delivers and mycomp throws an
 exception?


SMTP protocol does not support transactions, its in fact only a few
protocols that does this such as JMS, JDBC.
The same applies for HTTP based as well.

Its not a limitation in Camel but just in general that these protocols
cannot participate in distributed transactions.


 I am aware of the exceptionHandler() idea, but it seems exceptionHandlers
 are placed on a RouteCollection, not a single route. Each instance of
 RouteBuilder could have one route in it.  But that creates a lot of extra
 classes.


No you can have error handlers on a global and route scope.


 2. After ensuring that i did not lose the message pending at the smtp
 component, I need to shut down the routes since the smtp service is dead
 (for the moment).  This would seem to be a job for exceptionHandler(),
 however that handler would need to know which object threw the exception (in
 this case the smtp Producer) and what route it belongs to.  then, it would
 need to scan all other route that use the same endpoint, and stop them too.
 I see no way of doing this from within the handler, since it is not notified
 which Producer threw the exception.  Also, I see no way of consistently
 getting from a Producer to it's owner endpoint.

In Camel 2.1 a header will be enriched with the endpoint that failed
so you got that information at hand now.
Exchange.FAILURE_ENDPOINT


 - How do you gracefully and without data loss bring down a route?
 - Does bringing down a route destroy the consumer/producer objects? or just
 stop() them?


See for example RoutePolicy. Also if you use JMS as safe grounds for
messages then you will not loose messages.
So if a remote SMTP server is temporary down the need to shutdown a
route is not as important.



 3.  Assuming I could figure out which routes to shut down.  I can execute
 route.stop().  But what happens to messages that are in process  take for
 example a message from mycomp that is currently being analyzed, when the
 analyzer finishes (say 20-30 seconds after the route.stop() was called:
 - Is the queue Producer still available?
 - Will route.stop() block until all parts of the route are shut down?
 - Will route.stop() stop ONLY the consumer that is part of it's route, or
 the entire route?

We have graceful shutdown on the roadmap for 2.2. However the key
pieces are in 2.1 already.
There is an in flight registry you can poke to see if there are any
exchanges in progress on a particular route.
And thus know when to stop it.


 - Really, I would not need to bring down the route, just stop() the consumer
 at the beginning.  Do the Producers/Consumers/Endpoint have any knowledge
 about the route they are on? Or can they get it some how?
 - Can a Consumer/Producer be shared amongst several routes?


Yes but then you need to do that manually as the fluent builder will
create a new consumer/producer per route.
And you can design your custom endpoint to return a shared
consumer/producer if you really need this?


 It could be that I have the wrong idea of what Camel is meant to do.  All of
 the examples I've seen deal with short routes from some system to some other
 system where it seems the assumption is made that everything is up all the
 time.  That is the nature of examples.  When dealing with Enterprise
 Integrations 

Re: Lifecycle of a Camel Component

2009-11-27 Thread Claus Ibsen
 The same applies for HTTP based as well.
Should be that they do NOT support transactions. (well maybe that
WebService transaction does but I have newer seen that in action)


Re: Using Guice with Camel

2009-11-27 Thread Claus Ibsen
On Thu, Nov 26, 2009 at 6:27 PM, mumbly mcner...@gmail.com wrote:

 So to make things simple, let's base it on the existing Guice/Camel example.
 So in SomeBean.java, let's say I want to include an injected component and
 add:

 public class SomeBean {
 �...@inject
  private OtherBean ob;

  public void someMethod(String body) {
     System.out.println(Received:  + body);
     System.out.println(OtherBean:  + ob);
  }

 Define OtherBean as you wish. I'd expect(hope) without any other
 configuration that I'd get a non-null result for OtherBean, just using
 default binding values. It seems that it should be able to autowire (or
 whatever the Guicey version of that term is) ob. But though the
 configuration seems to be done via Guice, I don't think once inside the
 routing context that Guice is used to build/instantiate the bean from:

 from(file://target/routeOutput?noop=true).
                bean(new SomeBean());

 I can see that it seems to have been created by new and not via Guice. What
 I'm wondering is if there is some way that I can tell it to grab a via built
 up via Guice instead of passing a specific instance.


The fluent builder is *just* regular Java code. So instead of bean(new
SomeBean()); you should be able to refer to a object which Guice have
injected

@Inject (or whatever the Guice notion is)
private SomeBean some;

from 
bean(some);



 Does that make sense? As I mentioned, I'm still new with both Guice and
 Camel, so I could be way off the mark here.

 --Tim



 willem.jiang wrote:

 What kind of Object you want to inject into the bean component?
 Did you add that bind in your module ?

 Please let me have a look at your module class.

 Willem

 mumbly wrote:
 I've been taking a look at using Camel with Guice for DI, but I'm having
 a
 little trouble understanding exactly what the integration provides. I've
 got
 the configuration aspect and that seems to work fine. But it is unclear
 to
 me if/how to work with Guice enhanced components. Specifically, if I am
 using a bean component which uses @Inject, it doesn't appear that the
 bean
 is being pulled from the Guice context (in other words, the other
 components
 aren't being injected).

 I'm new to both Camel and Guice, so I could be missing something obvious
 here or there may be another pattern for DI using Guice with Camel that I
 missed. So I guess my basic question is does the Camel/Guice integration
 provide the ability to inject components within the routing chain? with
 the
 bean component?

 I see in the Guice example included in the dist, but it only seems to
 deal
 with using Guice for configuration of the routes.

 --Tim




 --
 View this message in context: 
 http://old.nabble.com/Using-Guice-with-Camel-tp26517323p26532640.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: Camel: memory management (memory leak)

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 11:43 AM, titexe tit...@yahoo.fr wrote:

 Thank you for your reply :

 I tested this expression and it does not work, it generates me an error that
 not recognize this URI:

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/

 I think we should use this :

 from uri=jms:queue:foo?maxMessagesPerTask=-1/

 What do you think?


Yes.
Its standard URI options so if only have ONE parameter then use ? to
indicate the first parameter.

If you have TWO+ parameters then use  to separate those.
And if you do that in a XML file then you must escape  so it become amp;




 Thank you

 titexe

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/



 Claus Ibsen-2 wrote:

 Hi

 Have you read the warning on top of the JMS wiki page?
 http://camel.apache.org/jms.html


 On Fri, Nov 27, 2009 at 11:10 AM, titexe tit...@yahoo.fr wrote:

 Hello,

 I am analyzing a problem of memory leak,

 each execution for flow camel, memory increases, but there's not
 releasing
 memory after.

 analyzing the problem with jconsole and jvisualvm, there's a lot of
 threads
 (ActiveMQ Session ID: Server-1997-XX) which is still in wait and
 will not release, these threads are added more and more each time you run
 flow camel:

 Name of threads : ActiveMQ Session ID: Server-1997-XX

 Is not that there's a way to release those threads or configuration to
 do?

 VersionJava: 1.6
 Fuse Message Broker Version: V5.3.0.3
 Camel Version: 1.6.1.2


 Thank you in advance

 Best regards.

 titexe
 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540277.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context: 
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540657.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: Camel: memory management (memory leak)

2009-11-27 Thread titexe

bizarre, even by putting maxMessagesPerTask, the problem is not solved, every
second I have a thread that add, and it :

ActiveMQ Session ID: Server-1997-XX

I don't understand anything?

Thank you in advance,

titexe


Claus Ibsen-2 wrote:
 
 On Fri, Nov 27, 2009 at 11:43 AM, titexe tit...@yahoo.fr wrote:

 Thank you for your reply :

 I tested this expression and it does not work, it generates me an error
 that
 not recognize this URI:

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/

 I think we should use this :

 from uri=jms:queue:foo?maxMessagesPerTask=-1/

 What do you think?

 
 Yes.
 Its standard URI options so if only have ONE parameter then use ? to
 indicate the first parameter.
 
 If you have TWO+ parameters then use  to separate those.
 And if you do that in a XML file then you must escape  so it become amp;
 
 
 
 
 Thank you

 titexe

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/



 Claus Ibsen-2 wrote:

 Hi

 Have you read the warning on top of the JMS wiki page?
 http://camel.apache.org/jms.html


 On Fri, Nov 27, 2009 at 11:10 AM, titexe tit...@yahoo.fr wrote:

 Hello,

 I am analyzing a problem of memory leak,

 each execution for flow camel, memory increases, but there's not
 releasing
 memory after.

 analyzing the problem with jconsole and jvisualvm, there's a lot of
 threads
 (ActiveMQ Session ID: Server-1997-XX) which is still in wait
 and
 will not release, these threads are added more and more each time you
 run
 flow camel:

 Name of threads : ActiveMQ Session ID: Server-1997-XX

 Is not that there's a way to release those threads or configuration to
 do?

 VersionJava: 1.6
 Fuse Message Broker Version: V5.3.0.3
 Camel Version: 1.6.1.2


 Thank you in advance

 Best regards.

 titexe
 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540277.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540657.html
 Sent from the Camel - Users mailing list archive at Nabble.com.


 
 
 
 -- 
 Claus Ibsen
 Apache Camel Committer
 
 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus
 
 

-- 
View this message in context: 
http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540897.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Using Guice with Camel

2009-11-27 Thread Willem Jiang

Hi,

I made a patch which is based on current trunk guicy-jms example to 
implements you requirement. Hope it can help you.


Willem

### Eclipse Workspace Patch 1.0
#P camel-example-guice-jms
Index: src/main/java/org/apache/camel/example/guice/jms/SomeBean.java
===
--- src/main/java/org/apache/camel/example/guice/jms/SomeBean.java 
(revision 884351)
+++ src/main/java/org/apache/camel/example/guice/jms/SomeBean.java 
(working copy)

@@ -16,13 +16,18 @@
  */
 package org.apache.camel.example.guice.jms;

+import com.google.inject.Inject;
+
 /**
  * @version $Revision$
 */
 public class SomeBean {
+@Inject
+private Printer printer;

 public void someMethod(String body) {
-System.out.println(Received:  + body);
+printer.print(body);
+//System.out.println(Received:  + body);
 }

 @Override
Index: src/main/java/org/apache/camel/example/guice/jms/Printer.java
===
--- src/main/java/org/apache/camel/example/guice/jms/Printer.java 
(revision 0)
+++ src/main/java/org/apache/camel/example/guice/jms/Printer.java 
(revision 0)

@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.example.guice.jms;
+
+public class Printer {
+
+public void print(String body) {
+System.out.println(Received:  + body);
+}
+
+}

Property changes on: 
src/main/java/org/apache/camel/example/guice/jms/Printer.java

___
Added: svn:keywords
   + Rev Date
Added: svn:eol-style
   + native

Index: src/main/java/org/apache/camel/example/guice/jms/MyModule.java
===
--- src/main/java/org/apache/camel/example/guice/jms/MyModule.java 
(revision 884351)
+++ src/main/java/org/apache/camel/example/guice/jms/MyModule.java 
(working copy)

@@ -16,6 +16,7 @@
  */
 package org.apache.camel.example.guice.jms;

+import com.google.inject.Injector;
 import com.google.inject.Provides;
 import com.google.inject.name.Named;
 import org.apache.activemq.ActiveMQConnectionFactory;
@@ -37,6 +38,7 @@

 // lets add in any RouteBuilder instances we want to use
 bind(MyRouteBuilder.class);
+bind(Printer.class);
 }

 /**
@@ -48,4 +50,10 @@
 JmsComponent jms(@Named(activemq.brokerURL) String brokerUrl) {
 return JmsComponent.jmsComponent(new 
ActiveMQConnectionFactory(brokerUrl));

 }
+
+@Provides
+@JndiBind(myBean)
+SomeBean someBean(Injector injector) {
+return injector.getInstance(SomeBean.class);
+}
 }
Index: src/main/java/org/apache/camel/example/guice/jms/MyRouteBuilder.java
===
--- 
src/main/java/org/apache/camel/example/guice/jms/MyRouteBuilder.java 
(revision 884351)
+++ 
src/main/java/org/apache/camel/example/guice/jms/MyRouteBuilder.java 
(working copy)

@@ -45,8 +45,7 @@
 to(file://target/routeOutput);

 // set up a listener on the file component
-from(file://target/routeOutput?noop=true).
-bean(new SomeBean());
+from(file://target/routeOutput?noop=true).beanRef(myBean);
 }

 }
\ No newline at end of file


mumbly wrote:

So to make things simple, let's base it on the existing Guice/Camel example.
So in SomeBean.java, let's say I want to include an injected component and
add:

public class SomeBean {
  @Inject
  private OtherBean ob;

  public void someMethod(String body) {
 System.out.println(Received:  + body);
 System.out.println(OtherBean:  + ob);
  }

Define OtherBean as you wish. I'd expect(hope) without any other
configuration that I'd get a non-null result for OtherBean, just using
default binding values. It seems that it should be able to autowire (or
whatever the Guicey version of that term is) ob. But though the
configuration seems to be done via Guice, I don't think once inside the
routing context that Guice is used to build/instantiate the bean from:

from(file://target/routeOutput?noop=true).
bean(new SomeBean());

I can see that it 

Re: Camel: memory management (memory leak)

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 11:43 AM, titexe tit...@yahoo.fr wrote:

 Thank you for your reply :

 I tested this expression and it does not work, it generates me an error that
 not recognize this URI:

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/

 I think we should use this :

 from uri=jms:queue:foo?maxMessagesPerTask=-1/

 What do you think?


Ah my mistake. The example on the wiki page was wrong. I have fixed
that. Well spotted.


 Thank you

 titexe

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/



 Claus Ibsen-2 wrote:

 Hi

 Have you read the warning on top of the JMS wiki page?
 http://camel.apache.org/jms.html


 On Fri, Nov 27, 2009 at 11:10 AM, titexe tit...@yahoo.fr wrote:

 Hello,

 I am analyzing a problem of memory leak,

 each execution for flow camel, memory increases, but there's not
 releasing
 memory after.

 analyzing the problem with jconsole and jvisualvm, there's a lot of
 threads
 (ActiveMQ Session ID: Server-1997-XX) which is still in wait and
 will not release, these threads are added more and more each time you run
 flow camel:

 Name of threads : ActiveMQ Session ID: Server-1997-XX

 Is not that there's a way to release those threads or configuration to
 do?

 VersionJava: 1.6
 Fuse Message Broker Version: V5.3.0.3
 Camel Version: 1.6.1.2


 Thank you in advance

 Best regards.

 titexe
 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540277.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context: 
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540657.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: Camel: memory management (memory leak)

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 12:03 PM, titexe tit...@yahoo.fr wrote:

 bizarre, even by putting maxMessagesPerTask, the problem is not solved, every
 second I have a thread that add, and it :

 ActiveMQ Session ID: Server-1997-XX

 I don't understand anything?


You are probably not caching the session etc. so it may force spring
jms to recreate a new session all the time.



 Thank you in advance,

 titexe


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 11:43 AM, titexe tit...@yahoo.fr wrote:

 Thank you for your reply :

 I tested this expression and it does not work, it generates me an error
 that
 not recognize this URI:

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/

 I think we should use this :

 from uri=jms:queue:foo?maxMessagesPerTask=-1/

 What do you think?


 Yes.
 Its standard URI options so if only have ONE parameter then use ? to
 indicate the first parameter.

 If you have TWO+ parameters then use  to separate those.
 And if you do that in a XML file then you must escape  so it become amp;




 Thank you

 titexe

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/



 Claus Ibsen-2 wrote:

 Hi

 Have you read the warning on top of the JMS wiki page?
 http://camel.apache.org/jms.html


 On Fri, Nov 27, 2009 at 11:10 AM, titexe tit...@yahoo.fr wrote:

 Hello,

 I am analyzing a problem of memory leak,

 each execution for flow camel, memory increases, but there's not
 releasing
 memory after.

 analyzing the problem with jconsole and jvisualvm, there's a lot of
 threads
 (ActiveMQ Session ID: Server-1997-XX) which is still in wait
 and
 will not release, these threads are added more and more each time you
 run
 flow camel:

 Name of threads : ActiveMQ Session ID: Server-1997-XX

 Is not that there's a way to release those threads or configuration to
 do?

 VersionJava: 1.6
 Fuse Message Broker Version: V5.3.0.3
 Camel Version: 1.6.1.2


 Thank you in advance

 Best regards.

 titexe
 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540277.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540657.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context: 
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540897.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread shirazi

Hi,
Please consider the following route:

from(timer://someTrigger?delay=3fixedRate=trueperiod=30).   
pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
1). 
to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

The pollEnrich cast a NullPointerException in camel-2.0, if there is nothing
to fetch from the ftp. I got rid of the exception by a
try-catch(NullpointerExcpetion.class).stop() around the route. Now in
camel-2.1-SNAPSHOT, I get the following exception on the to endpoint:
=
12:37:06,899 INFO  [Tracer]   --
file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
Cannot store file:
/tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
12:37:06,899 INFO  [Tracer]   --
file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
Cannot store file:
/tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
12:37:06,899 ERROR [TimerConsumer] Cannot store file:
/tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
at
org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
at
org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
at
org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
at
org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
at 
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
at
org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
at org.apache.camel.processor.TryProcessor.process(TryProcessor.java:63)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:103)
at
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:50)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: org.apache.camel.InvalidPayloadException: No body available of
type: java.io.InputStream on: Message: [Body is null]. Caused by: No type
converter available to convert from type: null to the required type:
java.io.InputStream with value null on the exchange: Exchange[Message: [Body
is null]]
at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:103)
at
org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelper.java:116)
at
org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:198)
... 29 more
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
converter available to convert from type: null to the required type:
java.io.InputStream with value null
  

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
Hi

Well its a bug in UseLatestAggregationStrategy which is shipped in Camel.
Its used by default for pollEnrich, enrich if you dont specify a
custom AggregationStrategy.

Normally you would enrich your existing message with what you poll,
and hence why an AggregationStrategy is needed where you can do this
merge.

The NPE is fixed on trunk so it will be in the upcoming 2.1 release.

Another workaround is to use your own custom AggregationStrategy and
pass it to pollEnrich.



On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there is nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route. Now in
 camel-2.1-SNAPSHOT, I get the following exception on the to endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
 store file: /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
        at
 org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
        at
 org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
        at
 org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at 
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at 
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at 
 org.apache.camel.processor.TryProcessor.process(TryProcessor.java:63)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
        at
 org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:103)
        at
 org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:50)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)
 Caused by: org.apache.camel.InvalidPayloadException: No body available of
 type: java.io.InputStream on: Message: [Body is null]. Caused by: No type
 converter available to convert from type: 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
Hi

BTW why are you using a timer - ftp when the ftp have a build in timer?



On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there is nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route. Now in
 camel-2.1-SNAPSHOT, I get the following exception on the to endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
 store file: /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
        at
 org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
        at
 org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
        at
 org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at 
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at 
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at 
 org.apache.camel.processor.TryProcessor.process(TryProcessor.java:63)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
        at
 org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:103)
        at
 org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:50)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)
 Caused by: org.apache.camel.InvalidPayloadException: No body available of
 type: java.io.InputStream on: Message: [Body is null]. Caused by: No type
 converter available to convert from type: null to the required type:
 java.io.InputStream with value null on the exchange: Exchange[Message: [Body
 is null]]
        at
 org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:103)
        at
 org.apache.camel.util.ExchangeHelper.getMandatoryInBody(ExchangeHelper.java:116)
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:198)
        

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread shirazi

Hi,
Ok, I guess I should rather provide an AggregationStrategy. 
The reason why I use a timer is that when I use the ftp endpoint, it starts
to fetch everything that is on the ftp in the first call and that's not what
i want, because I'm processing files over 3 Gigs and there are many of them.
Then I figured that by using a timer, i could have ftp to download one file
at a time!!
What I basically need is to somehow tell the ftp, how many files I want to
fetch at a time. This is probably doable now in camel-2.1 by using the
ThrottlingInflightRoutePolicy, which i havn't tried yet.
Do you have any suggestions?

Bests,
Farhad S.



Claus Ibsen-2 wrote:
 
 Hi
 
 BTW why are you using a timer - ftp when the ftp have a build in timer?
 
 
 
 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route. Now in
 camel-2.1-SNAPSHOT, I get the following exception on the to endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot
 store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
        at
 org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
        at
 org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
        at
 org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at
 org.apache.camel.processor.TryProcessor.process(TryProcessor.java:63)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
        at
 org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:103)
        at
 org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:50)
        at 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint, it starts
 to fetch everything that is on the ftp in the first call and that's not what
 i want, because I'm processing files over 3 Gigs and there are many of them.
 Then I figured that by using a timer, i could have ftp to download one file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I want to
 fetch at a time. This is probably doable now in camel-2.1 by using the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?

Yeah the FTP component extends the File component so you got all the
options from the file component as well
http://camel.apache.org/file2.html

And there is a maxMessagesPerPoll you can use to tell how many files
you want at most to poll. For example = 1 in your use.

And that option is avail in 2.0 also.

In fact all these are as they are batch polling consumers
http://camel.apache.org/batch-consumer.html




 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route. Now in
 camel-2.1-SNAPSHOT, I get the following exception on the to endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot
 store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
        at
 org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
        at
 org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
        at
 org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at
 org.apache.camel.processor.TryProcessor.process(TryProcessor.java:63)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread shirazi

Wau... thanks for that. I don't understand how I could miss it, cause i
searched a lot for such a feature.

Another thing that I have experienced in 2.0, is that the file component
is unable to move/copy files larger than 2Gigs, such large files are cut
around 2 Gigs limit. Now, I'm not sure if it has anything to do with the OS
or the filesystems or what. I have seen it both in Linux (debian) and Mac OS
X. And I don't understand either, why the file component does not use the
NIO api or at least we don't have an option to tell it use the NIO api
instead. 
Anyway, for now I've solved the problem by using a smiple component instead
of the file comp. to move/copy files using the NIO api. It is much faster
and it has no problem with very large files.

Bests,
Farhad S.


Claus Ibsen-2 wrote:
 
 On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint, it
 starts
 to fetch everything that is on the ftp in the first call and that's not
 what
 i want, because I'm processing files over 3 Gigs and there are many of
 them.
 Then I figured that by using a timer, i could have ftp to download one
 file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I want
 to
 fetch at a time. This is probably doable now in camel-2.1 by using the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?
 
 Yeah the FTP component extends the File component so you got all the
 options from the file component as well
 http://camel.apache.org/file2.html
 
 And there is a maxMessagesPerPoll you can use to tell how many files
 you want at most to poll. For example = 1 in your use.
 
 And that option is avail in 2.0 also.
 
 In fact all these are as they are batch polling consumers
 http://camel.apache.org/batch-consumer.html
 
 
 

 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route. Now in
 camel-2.1-SNAPSHOT, I get the following exception on the to endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot
 store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
        at
 org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
        at
 org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
        at
 org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 1:37 PM, shirazi m...@farhad.eu wrote:

 Wau... thanks for that. I don't understand how I could miss it, cause i
 searched a lot for such a feature.

 Another thing that I have experienced in 2.0, is that the file component
 is unable to move/copy files larger than 2Gigs, such large files are cut
 around 2 Gigs limit. Now, I'm not sure if it has anything to do with the OS
 or the filesystems or what. I have seen it both in Linux (debian) and Mac OS
 X. And I don't understand either, why the file component does not use the
 NIO api or at least we don't have an option to tell it use the NIO api
 instead.
 Anyway, for now I've solved the problem by using a smiple component instead
 of the file comp. to move/copy files using the NIO api. It is much faster
 and it has no problem with very large files.


For move it uses java.io.File rename and are you saying its not
optimized for the underlying OS?
I would assume that it could move a 2gb file in no time if the file is
on the same share.

Can you share your code that you are using?


 Bests,
 Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint, it
 starts
 to fetch everything that is on the ftp in the first call and that's not
 what
 i want, because I'm processing files over 3 Gigs and there are many of
 them.
 Then I figured that by using a timer, i could have ftp to download one
 file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I want
 to
 fetch at a time. This is probably doable now in camel-2.1 by using the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?

 Yeah the FTP component extends the File component so you got all the
 options from the file component as well
 http://camel.apache.org/file2.html

 And there is a maxMessagesPerPoll you can use to tell how many files
 you want at most to poll. For example = 1 in your use.

 And that option is avail in 2.0 also.

 In fact all these are as they are batch polling consumers
 http://camel.apache.org/batch-consumer.html




 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route. Now in
 camel-2.1-SNAPSHOT, I get the following exception on the to endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot
 store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
        at
 org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
        at
 org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
        at
 org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 

Re: Are sources not published for snapshot builds by design?

2009-11-27 Thread Jon Anstey
Yeah, it should be easy but the deploy is not working in Hudson... source
jars are built fine (see
http://hudson.zones.apache.org/hudson/job/Camel/510/org.apache.camel$camel-core/)
but are then ignored during the Hudson deploy. I've opened a ticket with
infra to see if they have any suggestions:

https://issues.apache.org/jira/browse/INFRA-2352

On Fri, Nov 27, 2009 at 3:13 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 On Wed, Nov 25, 2009 at 1:53 PM, Jon Anstey jans...@gmail.com wrote:
  So I enabled javadoc too yesterday, which does take a long time to
  generate... The build should now only be deploying source jars.
 

 Ah it appears as it only generates one big -src.zip file

 https://repository.apache.org/content/repositories/snapshots/org/apache/camel/apache-camel/2.1-SNAPSHOT/


 I think it should generate -sources.jar for each of the bundles. Then
 its easy for others to debug and learn Camel.

 https://repository.apache.org/content/repositories/snapshots/org/apache/camel/camel-core/2.1-SNAPSHOT/

 So is it possible to generate -sources.jar for all the fine grained
 .jars instead?


  On Tue, Nov 24, 2009 at 9:19 PM, Jon Anstey jans...@gmail.com wrote:
 
  Oh, and it *shouldn't* add too much to the build time... famous last
 words
  ;)
 
 
  On Tue, Nov 24, 2009 at 9:19 PM, Jon Anstey jans...@gmail.com wrote:
 
  Hey guys,
 
  I just updated Hudson to deploy source jars and kicked off a new build.
  Lemme know if it doesn't work.
 
 
  On Tue, Nov 24, 2009 at 4:40 PM, Claus Ibsen claus.ib...@gmail.com
 wrote:
 
  On Tue, Nov 24, 2009 at 8:05 PM, Barry Kaplan grou...@memelet.com
  wrote:
  
   Its a bit painful to have to generate and install the source jars
  everyday.
   Would it be possible to publish them to the repository?
 
  Its Apache Hudson doing the builds and deploys.
  http://hudson.zones.apache.org/hudson/
 
  I dont know if that is possible to do as it takes longer time then and
  its a general server for many of the other Apache projects.
 
  Try to get in touch with Gert V. he knows more about this server and
  what it can do.
 
   --
   View this message in context:
 
 http://old.nabble.com/Are-sources-not-published-for-snapshot-builds-by-design--tp26499928p26499928.html
   Sent from the Camel - Users mailing list archive at Nabble.com.
  
  
 
 
 
  --
  Claus Ibsen
  Apache Camel Committer
 
  Author of Camel in Action: http://www.manning.com/ibsen/
  Open Source Integration: http://fusesource.com
  Blog: http://davsclaus.blogspot.com/
  Twitter: http://twitter.com/davsclaus
 
 
 
 
  --
  Cheers,
  Jon
 
  Camel in Action: http://manning.com/ibsen
  Blog: http://janstey.blogspot.com
 
 
 
 
  --
  Cheers,
  Jon
 
  Camel in Action: http://manning.com/ibsen
  Blog: http://janstey.blogspot.com
 
 
 
 
  --
  Cheers,
  Jon
 
  Camel in Action: http://manning.com/ibsen
  Blog: http://janstey.blogspot.com
 



 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus




-- 
Cheers,
Jon

Camel in Action: http://manning.com/ibsen
Blog: http://janstey.blogspot.com


Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread shirazi

Sure. I have attached the file.
Actually I use from-to components for transfering files and I guess it
copies the file, rather than moving.

Thanks,
Farhad S.
http://old.nabble.com/file/p26542125/Nio.java Nio.java 


Claus Ibsen-2 wrote:
 
 On Fri, Nov 27, 2009 at 1:37 PM, shirazi m...@farhad.eu wrote:

 Wau... thanks for that. I don't understand how I could miss it, cause i
 searched a lot for such a feature.

 Another thing that I have experienced in 2.0, is that the file
 component
 is unable to move/copy files larger than 2Gigs, such large files are cut
 around 2 Gigs limit. Now, I'm not sure if it has anything to do with the
 OS
 or the filesystems or what. I have seen it both in Linux (debian) and Mac
 OS
 X. And I don't understand either, why the file component does not use the
 NIO api or at least we don't have an option to tell it use the NIO api
 instead.
 Anyway, for now I've solved the problem by using a smiple component
 instead
 of the file comp. to move/copy files using the NIO api. It is much
 faster
 and it has no problem with very large files.

 
 For move it uses java.io.File rename and are you saying its not
 optimized for the underlying OS?
 I would assume that it could move a 2gb file in no time if the file is
 on the same share.
 
 Can you share your code that you are using?
 
 
 Bests,
 Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint, it
 starts
 to fetch everything that is on the ftp in the first call and that's not
 what
 i want, because I'm processing files over 3 Gigs and there are many of
 them.
 Then I figured that by using a timer, i could have ftp to download one
 file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I want
 to
 fetch at a time. This is probably doable now in camel-2.1 by using the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?

 Yeah the FTP component extends the File component so you got all the
 options from the file component as well
 http://camel.apache.org/file2.html

 And there is a maxMessagesPerPoll you can use to tell how many files
 you want at most to poll. For example = 1 in your use.

 And that option is avail in 2.0 also.

 In fact all these are as they are batch polling consumers
 http://camel.apache.org/batch-consumer.html




 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in
 timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route. Now
 in
 camel-2.1-SNAPSHOT, I get the following exception on the to
 endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot
 store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
        at
 org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
        at
 org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
        at
 org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at
 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 2:00 PM, shirazi m...@farhad.eu wrote:

 Sure. I have attached the file.
 Actually I use from-to components for transfering files and I guess it
 copies the file, rather than moving.


Ah makes more sense for copying to leverage NIO.

Camel does this also but I can see that it may hit that 2gb limit as
it doesnt transfer in a loop using a lower buffer.

It was doing it in a one liner
in.transferTo(0, in.size(), out);

I wonder if you really must do that in a loop to avoid any 2gb limit
or the likes?


 Thanks,
 Farhad S.
 http://old.nabble.com/file/p26542125/Nio.java Nio.java


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:37 PM, shirazi m...@farhad.eu wrote:

 Wau... thanks for that. I don't understand how I could miss it, cause i
 searched a lot for such a feature.

 Another thing that I have experienced in 2.0, is that the file
 component
 is unable to move/copy files larger than 2Gigs, such large files are cut
 around 2 Gigs limit. Now, I'm not sure if it has anything to do with the
 OS
 or the filesystems or what. I have seen it both in Linux (debian) and Mac
 OS
 X. And I don't understand either, why the file component does not use the
 NIO api or at least we don't have an option to tell it use the NIO api
 instead.
 Anyway, for now I've solved the problem by using a smiple component
 instead
 of the file comp. to move/copy files using the NIO api. It is much
 faster
 and it has no problem with very large files.


 For move it uses java.io.File rename and are you saying its not
 optimized for the underlying OS?
 I would assume that it could move a 2gb file in no time if the file is
 on the same share.

 Can you share your code that you are using?


 Bests,
 Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint, it
 starts
 to fetch everything that is on the ftp in the first call and that's not
 what
 i want, because I'm processing files over 3 Gigs and there are many of
 them.
 Then I figured that by using a timer, i could have ftp to download one
 file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I want
 to
 fetch at a time. This is probably doable now in camel-2.1 by using the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?

 Yeah the FTP component extends the File component so you got all the
 options from the file component as well
 http://camel.apache.org/file2.html

 And there is a maxMessagesPerPoll you can use to tell how many files
 you want at most to poll. For example = 1 in your use.

 And that option is avail in 2.0 also.

 In fact all these are as they are batch polling consumers
 http://camel.apache.org/batch-consumer.html




 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in
 timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route. Now
 in
 camel-2.1-SNAPSHOT, I get the following exception on the to
 endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot
 store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
        at
 org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
        at
 org.apache.camel.component.file.GenericFileProducer.processExchange(GenericFileProducer.java:126)
        at
 org.apache.camel.component.file.GenericFileProducer.process(GenericFileProducer.java:57)
        at
 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
Hi

I have created a ticket about the NIO thingy
https://issues.apache.org/activemq/browse/CAMEL-2234


On Fri, Nov 27, 2009 at 2:14 PM, Claus Ibsen claus.ib...@gmail.com wrote:
 On Fri, Nov 27, 2009 at 2:00 PM, shirazi m...@farhad.eu wrote:

 Sure. I have attached the file.
 Actually I use from-to components for transfering files and I guess it
 copies the file, rather than moving.


 Ah makes more sense for copying to leverage NIO.

 Camel does this also but I can see that it may hit that 2gb limit as
 it doesnt transfer in a loop using a lower buffer.

 It was doing it in a one liner
            in.transferTo(0, in.size(), out);

 I wonder if you really must do that in a loop to avoid any 2gb limit
 or the likes?


 Thanks,
 Farhad S.
 http://old.nabble.com/file/p26542125/Nio.java Nio.java


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:37 PM, shirazi m...@farhad.eu wrote:

 Wau... thanks for that. I don't understand how I could miss it, cause i
 searched a lot for such a feature.

 Another thing that I have experienced in 2.0, is that the file
 component
 is unable to move/copy files larger than 2Gigs, such large files are cut
 around 2 Gigs limit. Now, I'm not sure if it has anything to do with the
 OS
 or the filesystems or what. I have seen it both in Linux (debian) and Mac
 OS
 X. And I don't understand either, why the file component does not use the
 NIO api or at least we don't have an option to tell it use the NIO api
 instead.
 Anyway, for now I've solved the problem by using a smiple component
 instead
 of the file comp. to move/copy files using the NIO api. It is much
 faster
 and it has no problem with very large files.


 For move it uses java.io.File rename and are you saying its not
 optimized for the underlying OS?
 I would assume that it could move a 2gb file in no time if the file is
 on the same share.

 Can you share your code that you are using?


 Bests,
 Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint, it
 starts
 to fetch everything that is on the ftp in the first call and that's not
 what
 i want, because I'm processing files over 3 Gigs and there are many of
 them.
 Then I figured that by using a timer, i could have ftp to download one
 file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I want
 to
 fetch at a time. This is probably doable now in camel-2.1 by using the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?

 Yeah the FTP component extends the File component so you got all the
 options from the file component as well
 http://camel.apache.org/file2.html

 And there is a maxMessagesPerPoll you can use to tell how many files
 you want at most to poll. For example = 1 in your use.

 And that option is avail in 2.0 also.

 In fact all these are as they are batch polling consumers
 http://camel.apache.org/batch-consumer.html




 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in
 timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route. Now
 in
 camel-2.1-SNAPSHOT, I get the following exception on the to
 endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot
 store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:204)
        at
 org.apache.camel.component.file.GenericFileProducer.writeFile(GenericFileProducer.java:184)
        at
 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread shirazi

That's probably the case. I've tried with different buffer sizes (though not
0), from 16 to 128 KB. I got the best performance with buffer of 64KB, on
Linux Debian with 4 Gigs RAM, and files larger than 3 Gigs.
That would be great, if one could specify the buffer-size for the file
component. 

-Farhad S.


Claus Ibsen-2 wrote:
 
 On Fri, Nov 27, 2009 at 2:00 PM, shirazi m...@farhad.eu wrote:

 Sure. I have attached the file.
 Actually I use from-to components for transfering files and I guess it
 copies the file, rather than moving.

 
 Ah makes more sense for copying to leverage NIO.
 
 Camel does this also but I can see that it may hit that 2gb limit as
 it doesnt transfer in a loop using a lower buffer.
 
 It was doing it in a one liner
 in.transferTo(0, in.size(), out);
 
 I wonder if you really must do that in a loop to avoid any 2gb limit
 or the likes?
 
 
 Thanks,
 Farhad S.
 http://old.nabble.com/file/p26542125/Nio.java Nio.java


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:37 PM, shirazi m...@farhad.eu wrote:

 Wau... thanks for that. I don't understand how I could miss it, cause i
 searched a lot for such a feature.

 Another thing that I have experienced in 2.0, is that the file
 component
 is unable to move/copy files larger than 2Gigs, such large files are
 cut
 around 2 Gigs limit. Now, I'm not sure if it has anything to do with
 the
 OS
 or the filesystems or what. I have seen it both in Linux (debian) and
 Mac
 OS
 X. And I don't understand either, why the file component does not use
 the
 NIO api or at least we don't have an option to tell it use the NIO api
 instead.
 Anyway, for now I've solved the problem by using a smiple component
 instead
 of the file comp. to move/copy files using the NIO api. It is much
 faster
 and it has no problem with very large files.


 For move it uses java.io.File rename and are you saying its not
 optimized for the underlying OS?
 I would assume that it could move a 2gb file in no time if the file is
 on the same share.

 Can you share your code that you are using?


 Bests,
 Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint, it
 starts
 to fetch everything that is on the ftp in the first call and that's
 not
 what
 i want, because I'm processing files over 3 Gigs and there are many
 of
 them.
 Then I figured that by using a timer, i could have ftp to download
 one
 file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I
 want
 to
 fetch at a time. This is probably doable now in camel-2.1 by using
 the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?

 Yeah the FTP component extends the File component so you got all the
 options from the file component as well
 http://camel.apache.org/file2.html

 And there is a maxMessagesPerPoll you can use to tell how many files
 you want at most to poll. For example = 1 in your use.

 And that option is avail in 2.0 also.

 In fact all these are as they are batch polling consumers
 http://camel.apache.org/batch-consumer.html




 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in
 timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there
 is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route.
 Now
 in
 camel-2.1-SNAPSHOT, I get the following exception on the to
 endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR [TimerConsumer] Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot
 store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
        at
 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 2:26 PM, shirazi m...@farhad.eu wrote:

 That's probably the case. I've tried with different buffer sizes (though not
 0), from 16 to 128 KB. I got the best performance with buffer of 64KB, on
 Linux Debian with 4 Gigs RAM, and files larger than 3 Gigs.
 That would be great, if one could specify the buffer-size for the file
 component.


You buffer size was 64 * 1024 * 1024 which is 64 K * K = 64 MB. Or is
there something that play tricks on me?

The file component already have a bufferSize option with a default of 128kb
http://camel.apache.org/file2.html

So you can use that to set what you want to use.



 -Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 2:00 PM, shirazi m...@farhad.eu wrote:

 Sure. I have attached the file.
 Actually I use from-to components for transfering files and I guess it
 copies the file, rather than moving.


 Ah makes more sense for copying to leverage NIO.

 Camel does this also but I can see that it may hit that 2gb limit as
 it doesnt transfer in a loop using a lower buffer.

 It was doing it in a one liner
             in.transferTo(0, in.size(), out);

 I wonder if you really must do that in a loop to avoid any 2gb limit
 or the likes?


 Thanks,
 Farhad S.
 http://old.nabble.com/file/p26542125/Nio.java Nio.java


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:37 PM, shirazi m...@farhad.eu wrote:

 Wau... thanks for that. I don't understand how I could miss it, cause i
 searched a lot for such a feature.

 Another thing that I have experienced in 2.0, is that the file
 component
 is unable to move/copy files larger than 2Gigs, such large files are
 cut
 around 2 Gigs limit. Now, I'm not sure if it has anything to do with
 the
 OS
 or the filesystems or what. I have seen it both in Linux (debian) and
 Mac
 OS
 X. And I don't understand either, why the file component does not use
 the
 NIO api or at least we don't have an option to tell it use the NIO api
 instead.
 Anyway, for now I've solved the problem by using a smiple component
 instead
 of the file comp. to move/copy files using the NIO api. It is much
 faster
 and it has no problem with very large files.


 For move it uses java.io.File rename and are you saying its not
 optimized for the underlying OS?
 I would assume that it could move a 2gb file in no time if the file is
 on the same share.

 Can you share your code that you are using?


 Bests,
 Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint, it
 starts
 to fetch everything that is on the ftp in the first call and that's
 not
 what
 i want, because I'm processing files over 3 Gigs and there are many
 of
 them.
 Then I figured that by using a timer, i could have ftp to download
 one
 file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I
 want
 to
 fetch at a time. This is probably doable now in camel-2.1 by using
 the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?

 Yeah the FTP component extends the File component so you got all the
 options from the file component as well
 http://camel.apache.org/file2.html

 And there is a maxMessagesPerPoll you can use to tell how many files
 you want at most to poll. For example = 1 in your use.

 And that option is avail in 2.0 also.

 In fact all these are as they are batch polling consumers
 http://camel.apache.org/batch-consumer.html




 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in
 timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there
 is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route.
 Now
 in
 camel-2.1-SNAPSHOT, I get the following exception on the to
 endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 ERROR 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread shirazi

Oh, sorry. that's right, it is 64 MB. and I tried with 16, 32, 64 and 128 MB.
I will try the buffer size option of the file-comp. to see if it solves the
problem.
 
Thanks, 
Farhad S.


Claus Ibsen-2 wrote:
 
 On Fri, Nov 27, 2009 at 2:26 PM, shirazi m...@farhad.eu wrote:

 That's probably the case. I've tried with different buffer sizes (though
 not
 0), from 16 to 128 KB. I got the best performance with buffer of 64KB, on
 Linux Debian with 4 Gigs RAM, and files larger than 3 Gigs.
 That would be great, if one could specify the buffer-size for the file
 component.

 
 You buffer size was 64 * 1024 * 1024 which is 64 K * K = 64 MB. Or is
 there something that play tricks on me?
 
 The file component already have a bufferSize option with a default of
 128kb
 http://camel.apache.org/file2.html
 
 So you can use that to set what you want to use.
 
 
 
 -Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 2:00 PM, shirazi m...@farhad.eu wrote:

 Sure. I have attached the file.
 Actually I use from-to components for transfering files and I guess it
 copies the file, rather than moving.


 Ah makes more sense for copying to leverage NIO.

 Camel does this also but I can see that it may hit that 2gb limit as
 it doesnt transfer in a loop using a lower buffer.

 It was doing it in a one liner
             in.transferTo(0, in.size(), out);

 I wonder if you really must do that in a loop to avoid any 2gb limit
 or the likes?


 Thanks,
 Farhad S.
 http://old.nabble.com/file/p26542125/Nio.java Nio.java


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:37 PM, shirazi m...@farhad.eu wrote:

 Wau... thanks for that. I don't understand how I could miss it, cause
 i
 searched a lot for such a feature.

 Another thing that I have experienced in 2.0, is that the file
 component
 is unable to move/copy files larger than 2Gigs, such large files are
 cut
 around 2 Gigs limit. Now, I'm not sure if it has anything to do with
 the
 OS
 or the filesystems or what. I have seen it both in Linux (debian) and
 Mac
 OS
 X. And I don't understand either, why the file component does not use
 the
 NIO api or at least we don't have an option to tell it use the NIO
 api
 instead.
 Anyway, for now I've solved the problem by using a smiple component
 instead
 of the file comp. to move/copy files using the NIO api. It is much
 faster
 and it has no problem with very large files.


 For move it uses java.io.File rename and are you saying its not
 optimized for the underlying OS?
 I would assume that it could move a 2gb file in no time if the file is
 on the same share.

 Can you share your code that you are using?


 Bests,
 Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint,
 it
 starts
 to fetch everything that is on the ftp in the first call and that's
 not
 what
 i want, because I'm processing files over 3 Gigs and there are many
 of
 them.
 Then I figured that by using a timer, i could have ftp to download
 one
 file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I
 want
 to
 fetch at a time. This is probably doable now in camel-2.1 by using
 the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?

 Yeah the FTP component extends the File component so you got all the
 options from the file component as well
 http://camel.apache.org/file2.html

 And there is a maxMessagesPerPoll you can use to tell how many files
 you want at most to poll. For example = 1 in your use.

 And that option is avail in 2.0 also.

 In fact all these are as they are batch polling consumers
 http://camel.apache.org/batch-consumer.html




 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in
 timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there
 is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route.
 Now
 in
 camel-2.1-SNAPSHOT, I get the following exception on the to
 endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 Headers:{firedTime=Fri Nov 27 12:36:56 CET 2009},
 Exception:org.apache.camel.component.file.GenericFileOperationFailedException:
 Cannot store file:
 /tmp/vw/cmore/.inprogress_02216f38-8ffc-4aec-b638-27229d857075
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 2:34 PM, shirazi m...@farhad.eu wrote:

 Oh, sorry. that's right, it is 64 MB. and I tried with 16, 32, 64 and 128 MB.
 I will try the buffer size option of the file-comp. to see if it solves the
 problem.


I have just committed the fix to camel trunk.

The old code will still have the 2gb limit bug no matter what
bufferSize you use.
However you should try the latest code in 2.1 to see if that works for you.
http://camel.apache.org/download.html



 Thanks,
 Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 2:26 PM, shirazi m...@farhad.eu wrote:

 That's probably the case. I've tried with different buffer sizes (though
 not
 0), from 16 to 128 KB. I got the best performance with buffer of 64KB, on
 Linux Debian with 4 Gigs RAM, and files larger than 3 Gigs.
 That would be great, if one could specify the buffer-size for the file
 component.


 You buffer size was 64 * 1024 * 1024 which is 64 K * K = 64 MB. Or is
 there something that play tricks on me?

 The file component already have a bufferSize option with a default of
 128kb
 http://camel.apache.org/file2.html

 So you can use that to set what you want to use.



 -Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 2:00 PM, shirazi m...@farhad.eu wrote:

 Sure. I have attached the file.
 Actually I use from-to components for transfering files and I guess it
 copies the file, rather than moving.


 Ah makes more sense for copying to leverage NIO.

 Camel does this also but I can see that it may hit that 2gb limit as
 it doesnt transfer in a loop using a lower buffer.

 It was doing it in a one liner
             in.transferTo(0, in.size(), out);

 I wonder if you really must do that in a loop to avoid any 2gb limit
 or the likes?


 Thanks,
 Farhad S.
 http://old.nabble.com/file/p26542125/Nio.java Nio.java


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:37 PM, shirazi m...@farhad.eu wrote:

 Wau... thanks for that. I don't understand how I could miss it, cause
 i
 searched a lot for such a feature.

 Another thing that I have experienced in 2.0, is that the file
 component
 is unable to move/copy files larger than 2Gigs, such large files are
 cut
 around 2 Gigs limit. Now, I'm not sure if it has anything to do with
 the
 OS
 or the filesystems or what. I have seen it both in Linux (debian) and
 Mac
 OS
 X. And I don't understand either, why the file component does not use
 the
 NIO api or at least we don't have an option to tell it use the NIO
 api
 instead.
 Anyway, for now I've solved the problem by using a smiple component
 instead
 of the file comp. to move/copy files using the NIO api. It is much
 faster
 and it has no problem with very large files.


 For move it uses java.io.File rename and are you saying its not
 optimized for the underlying OS?
 I would assume that it could move a 2gb file in no time if the file is
 on the same share.

 Can you share your code that you are using?


 Bests,
 Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 1:12 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Ok, I guess I should rather provide an AggregationStrategy.
 The reason why I use a timer is that when I use the ftp endpoint,
 it
 starts
 to fetch everything that is on the ftp in the first call and that's
 not
 what
 i want, because I'm processing files over 3 Gigs and there are many
 of
 them.
 Then I figured that by using a timer, i could have ftp to download
 one
 file
 at a time!!
 What I basically need is to somehow tell the ftp, how many files I
 want
 to
 fetch at a time. This is probably doable now in camel-2.1 by using
 the
 ThrottlingInflightRoutePolicy, which i havn't tried yet.
 Do you have any suggestions?

 Yeah the FTP component extends the File component so you got all the
 options from the file component as well
 http://camel.apache.org/file2.html

 And there is a maxMessagesPerPoll you can use to tell how many files
 you want at most to poll. For example = 1 in your use.

 And that option is avail in 2.0 also.

 In fact all these are as they are batch polling consumers
 http://camel.apache.org/batch-consumer.html




 Bests,
 Farhad S.



 Claus Ibsen-2 wrote:

 Hi

 BTW why are you using a timer - ftp when the ftp have a build in
 timer?



 On Fri, Nov 27, 2009 at 12:55 PM, shirazi m...@farhad.eu wrote:

 Hi,
 Please consider the following route:

 from(timer://someTrigger?delay=3fixedRate=trueperiod=30).
 pollEnrich(ftp://cmoreFtp?binary=truelocalWorkDirectory=/tmpidempotent=trueidempotentRepository=#caStreams;,
 1).
 to(file:///tmp/vw/cmore?tempPrefix=.inprogress);

 The pollEnrich cast a NullPointerException in camel-2.0, if there
 is
 nothing
 to fetch from the ftp. I got rid of the exception by a
 try-catch(NullpointerExcpetion.class).stop() around the route.
 Now
 in
 camel-2.1-SNAPSHOT, I get the following exception on the to
 endpoint:
 =
 12:37:06,899 INFO  [Tracer]   --
 file:///tmp/vw/cmore?tempPrefix=.inprogress_, Pattern:InOnly,
 

Re: Camel: memory management (memory leak)

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 3:01 PM, titexe tit...@yahoo.fr wrote:

 thank you claus, it is to help each other,

 I take this opportunity to thank you for the book Camel in Action


Welcome the book is for Camel, not for me. We value community over
code at Apache.
The book is just for much better documentation and help others get
started with Camel and improve the overall community around Camel.


 If not for the problem I will try to remove stream cache


Stream cache?

In terms of the JMS problem, can you maybe write a bit more what you
are using? Sorry if that was in the start of the mail.

Which JMS Broker are you using?
Which Spring .jars are you using?

What does you route look like?

How how you configure the connection to the JMS broker?



 Thank you


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 12:03 PM, titexe tit...@yahoo.fr wrote:

 bizarre, even by putting maxMessagesPerTask, the problem is not solved,
 every
 second I have a thread that add, and it :

 ActiveMQ Session ID: Server-1997-XX

 I don't understand anything?


 You are probably not caching the session etc. so it may force spring
 jms to recreate a new session all the time.



 Thank you in advance,

 titexe


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 11:43 AM, titexe tit...@yahoo.fr wrote:

 Thank you for your reply :

 I tested this expression and it does not work, it generates me an error
 that
 not recognize this URI:

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/

 I think we should use this :

 from uri=jms:queue:foo?maxMessagesPerTask=-1/

 What do you think?


 Yes.
 Its standard URI options so if only have ONE parameter then use ? to
 indicate the first parameter.

 If you have TWO+ parameters then use  to separate those.
 And if you do that in a XML file then you must escape  so it become
 amp;




 Thank you

 titexe

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/



 Claus Ibsen-2 wrote:

 Hi

 Have you read the warning on top of the JMS wiki page?
 http://camel.apache.org/jms.html


 On Fri, Nov 27, 2009 at 11:10 AM, titexe tit...@yahoo.fr wrote:

 Hello,

 I am analyzing a problem of memory leak,

 each execution for flow camel, memory increases, but there's not
 releasing
 memory after.

 analyzing the problem with jconsole and jvisualvm, there's a lot of
 threads
 (ActiveMQ Session ID: Server-1997-XX) which is still in wait
 and
 will not release, these threads are added more and more each time you
 run
 flow camel:

 Name of threads : ActiveMQ Session ID: Server-1997-XX

 Is not that there's a way to release those threads or configuration
 to
 do?

 VersionJava: 1.6
 Fuse Message Broker Version: V5.3.0.3
 Camel Version: 1.6.1.2


 Thank you in advance

 Best regards.

 titexe
 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540277.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540657.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540897.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context: 
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26542792.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: Clarification requested - Camel CXFRS - JAXRS

2009-11-27 Thread Willem Jiang

Hi,

From the stack trace, it looks like the WebClient needs the 
ResourceClass to create the request URL. So I think you need to add the 
serviceClass attribute in the rsClient definition.


Willem
Charles Moulliard wrote:

Willem,

I have adapted the flow (between the HTTP requests) and camel route is
called now. Unfortunately, the calling program receives a HTTP
response 404 and error is raised in the log

A. Spring Camel Config

jaxrs:server id=restService address=/proxy/
staticSubresourceResolution=true
jaxrs:serviceBeans
ref bean=reportIncidentService/
/jaxrs:serviceBeans
/jaxrs:server


bean id=reportIncidentService
class=org.apache.camel.example.reportincident.restful.ReportIncidentService/
bean id=intercept
class=org.apache.camel.example.reportincident.restful.Intercept/

!-- Camel JAX-RS component called from external calling API/Browser --
cxf:rsServer id=rsServer
  address=/camel-rest-example/

serviceClass=org.apache.camel.example.reportincident.restful.ReportIncidentService
/

!-- Internal camel JAX-RS client who will send feedback to the
API calling  --
cxf:rsClient id=rsClient
  address=http://localhost:8181/cxf/proxy/;
/cxf:rsClient

camel:camelContext trace=true 
xmlns=http://camel.apache.org/schema/osgi;

camel:route
camel:from uri=cxfrs:bean:rsServer /
camel:to 
uri=log:org.apache.camel.example.reportIncident?level=DEBUG /
camel:to uri=cxfrs:bean:rsClient /
/camel:route
/camel:camelContext

/beans

B. API sends the following requests :
http://localhost:8181/cxf/camel-rest-example/reportservice/incidents

CamelHttpMethod=POST,
CamelHttpCharacterEncoding=UTF-8,
CamelCxfRsResponseClass=class javax.ws.rs.core.Response,
CamelAcceptContentType=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
Content-Type=application/xml; charset=UTF-8,
operationName=addIncident,
CamelHttpPath=/camel-rest-example/reportservice/incidents,
CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents
Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

C. Error generated :

15:27:35,429 | WARN  | 8980...@qtp1-145 | JAXRSInInterceptor
| s.interceptor.JAXRSInInterceptor  122 | No root resource
matching request path /camel-rest-example/reportservice/incidents has
been found.
15:27:35,429 | WARN  | 8980...@qtp1-145 |
WebApplicationExceptionMapper| pl.WebApplicationExceptionMapper
52 | WebApplicationException has been caught : no cause is available
15:27:35,429 | WARN  | 9787...@qtp1-142 | PhaseInterceptorChain
| ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown
exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at 
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at 
org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:573)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:552)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:206)
at 
org.apache.camel.component.cxf.jaxrs.CxfRsProducer.invokeHttpClient(CxfRsProducer.java:123)
at 
org.apache.camel.component.cxf.jaxrs.CxfRsProducer.process(CxfRsProducer.java:65)
at 
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
at 
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:94)
at 
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
at 
org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at 
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at 
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at 
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at 
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
at 
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
at 
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
at 

Re: Clarification requested - Camel CXFRS - JAXRS

2009-11-27 Thread Charles Moulliard
Does not change if the serviceClass is defined in cxf:rsClient endpoint.

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=gid=2447439trk=anet_ug_hm


On Fri, Nov 27, 2009 at 4:06 PM, Willem Jiang willem.ji...@gmail.comwrote:

 Hi,

 From the stack trace, it looks like the WebClient needs the ResourceClass
 to create the request URL. So I think you need to add the serviceClass
 attribute in the rsClient definition.

 Willem

 Charles Moulliard wrote:

 Willem,

 I have adapted the flow (between the HTTP requests) and camel route is
 called now. Unfortunately, the calling program receives a HTTP
 response 404 and error is raised in the log

 A. Spring Camel Config

jaxrs:server id=restService address=/proxy/
 staticSubresourceResolution=true
jaxrs:serviceBeans
ref bean=reportIncidentService/
/jaxrs:serviceBeans
/jaxrs:server


bean id=reportIncidentService

 class=org.apache.camel.example.reportincident.restful.ReportIncidentService/
bean id=intercept
 class=org.apache.camel.example.reportincident.restful.Intercept/

!-- Camel JAX-RS component called from external calling
 API/Browser --
cxf:rsServer id=rsServer
  address=/camel-rest-example/


 serviceClass=org.apache.camel.example.reportincident.restful.ReportIncidentService
/

!-- Internal camel JAX-RS client who will send feedback to the
 API calling  --
cxf:rsClient id=rsClient
  address=http://localhost:8181/cxf/proxy/;
/cxf:rsClient

camel:camelContext trace=true xmlns=
 http://camel.apache.org/schema/osgi;

camel:route
camel:from uri=cxfrs:bean:rsServer /
camel:to
 uri=log:org.apache.camel.example.reportIncident?level=DEBUG /
camel:to uri=cxfrs:bean:rsClient /
/camel:route
/camel:camelContext

 /beans

 B. API sends the following requests :
 http://localhost:8181/cxf/camel-rest-example/reportservice/incidents

 CamelHttpMethod=POST,
 CamelHttpCharacterEncoding=UTF-8,
 CamelCxfRsResponseClass=class javax.ws.rs.core.Response,

 CamelAcceptContentType=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
 Content-Type=application/xml; charset=UTF-8,
 operationName=addIncident,
 CamelHttpPath=/camel-rest-example/reportservice/incidents,
 CamelHttpUri=/cxf/camel-rest-example/reportservice/incidents
 Charles Moulliard
 Senior Enterprise Architect
 Apache Camel Committer

 C. Error generated :

 15:27:35,429 | WARN  | 8980...@qtp1-145 | JAXRSInInterceptor
| s.interceptor.JAXRSInInterceptor  122 | No root resource
 matching request path /camel-rest-example/reportservice/incidents has
 been found.
 15:27:35,429 | WARN  | 8980...@qtp1-145 |
 WebApplicationExceptionMapper| pl.WebApplicationExceptionMapper
 52 | WebApplicationException has been caught : no cause is available
 15:27:35,429 | WARN  | 9787...@qtp1-142 | PhaseInterceptorChain
| ache.cxf.common.logging.LogUtils  361 | Interceptor has thrown
 exception, unwinding now
 org.apache.cxf.interceptor.Fault: Could not send Message.
at
 org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at
 org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at
 org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:573)
at
 org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:552)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:206)
at
 org.apache.camel.component.cxf.jaxrs.CxfRsProducer.invokeHttpClient(CxfRsProducer.java:123)
at
 org.apache.camel.component.cxf.jaxrs.CxfRsProducer.process(CxfRsProducer.java:65)
at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:94)
at
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
at
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at
 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 4:18 PM, shirazi m...@farhad.eu wrote:

 Thanks Claus,
 I just downloaded the new trunk, and I think there's a new bug in it. I just
 tried the file component with a couple of files around 3-400 MBs and it
 works fine. As soon as I try it with a file around 3 Gigs, i get the
 following exception (??!!):


That is odd as the stacktrace is off by -1.
And you do a full svn up and a mvn clean install -Dtest=false to build
all source from scratch?


If you enable TRACE logging for: org.apache.camel.component.file

You should see this log line when it uses the NIO stuff

if (LOG.isTraceEnabled()) {
LOG.trace(Using FileChannel to transfer from:  + in
+  to:  + out);
}


I have committed a fix for the NPE in that stacktrace. But the was
some other exception thrown that got lost.


commited rev: 884894.



 16:13:48,830 ERROR [workflow] null while processing exchange:
 Exchange[GenericFileMessage with file: GenericFile[/tmp/vw/cmore/tv5.ts]]
 java.lang.NullPointerException
        at
 org.apache.camel.impl.OnExceptionRouteNode.getLabel(OnExceptionRouteNode.java:41)
        at
 org.apache.camel.processor.interceptor.DefaultTraceFormatter.getNodeMessage(DefaultTraceFormatter.java:233)
        at
 org.apache.camel.processor.interceptor.DefaultTraceFormatter.extractBreadCrumb(DefaultTraceFormatter.java:282)
        at
 org.apache.camel.processor.interceptor.DefaultTraceFormatter.format(DefaultTraceFormatter.java:55)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.format(TraceInterceptor.java:232)
        at org.apache.camel.processor.Logger.logMessage(Logger.java:283)
        at org.apache.camel.processor.Logger.process(Logger.java:166)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.logException(TraceInterceptor.java:325)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:171)
        at
 org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:58)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:58)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
        at
 org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:45)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at 
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at 
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:58)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at
 org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:56)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 

Re: Using Camel with Felix (Karaf) without Spring

2009-11-27 Thread Willem Jiang

Just a quick answer for reusing the OSGi service.
Camel 2.x support to use the OSGi service name as the BeanComponent's 
reference.


You can find the code here[1]

[1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-osgi/src/main/java/org/apache/camel/osgi/OsgiServiceRegistry.java 



Willem

Pete Mueller wrote:

Hello Charles,

I should have been more specific.  Yes, I meant without Spring DM.  What I
am attempting  is to create a system that has X number of services
registered, but not all services are running at all times, if a service is
down, the routes that direct messages to it must also be brought down to
stop messages from being accepted and going nowhere. A simple example would
be:

HTTP POST --  Translator Service -- Database

If the translator service is brought offline, the HTTP listener and database
resources should be brought down as well.
 
My first thought was to:
1. Creating a bundle with just an empty camel context. 
2. Registering my service using iPOJO in a separate bundle

3. Creating a separate bundle that has a route written in Java DSL that uses
the context from (1) and the service from (2) 


The idea is to have a central engine that routes can register themselves
to.  Since I'm working with embedded devices, if a particular sub-system
isn't needed, I'd like to shut it down, which means the routes that would
send messages to those services would need to be shut down as well.  I guess
this could also be accomplished by creating an independent camel context for
every route, but this seems like it would incur extra overhead.

My OSGi container is essentially a clean install of Karaf, so I do have
the Spring Deployer at my disposal, but not Spring DM.  It is not clear to
me which features are used by which parts of a camel project  
 
Some questions:

- How do I create the camel content and export it to be picked up by the
routing bundle. Is this done automatically? 
- Do I need Spring DM to use the osgi:service elements?
- Do I need Spring DM to use the .beanRef() camel routing?  
- If I have OSGi services defined with iPOJO, how do I access them from a
camel route?  

If there is a better way to accomplish the goal, I'm open to suggestions. 
-p



cmoulliard wrote:

Hi Peter,

Can you precise what you understand by 'without spring' ? without
spring configuration file, without Spring DM services, ...

Camel routes can be defined using Java DSL language and deployed as a
bundle top of Apache Felix Karaf. There is an example here :
https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-guice-jms

A camel-blueprint component is under construction :
https://svn.apache.org/repos/asf/camel/trunk/components/camel-blueprint

remark : Blueprint = OSGI RI of Spring DM service

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=gid=2447439trk=anet_ug_hm



-
Charles Moulliard
SOA Architect

My Blog : http://cmoulliard.blogspot.com/  







Re: Camel: memory management (memory leak)

2009-11-27 Thread titexe

Good news, the problem is solved:

I used ServerSessionPool in version 1.6.1.2 camel,

from uri=activemq:queue:OUT?consumerType=ServerSessionPool/

the problem session is gone

by cons in version 1.6.2 camel, I do not need to put this option, the
problem of session does not exist.

Thank you for your contribution

Claus Ibsen-2 wrote:
 
 On Fri, Nov 27, 2009 at 3:01 PM, titexe tit...@yahoo.fr wrote:

 thank you claus, it is to help each other,

 I take this opportunity to thank you for the book Camel in Action

 
 Welcome the book is for Camel, not for me. We value community over
 code at Apache.
 The book is just for much better documentation and help others get
 started with Camel and improve the overall community around Camel.
 
 
 If not for the problem I will try to remove stream cache

 
 Stream cache?
 
 In terms of the JMS problem, can you maybe write a bit more what you
 are using? Sorry if that was in the start of the mail.
 
 Which JMS Broker are you using?
 Which Spring .jars are you using?
 
 What does you route look like?
 
 How how you configure the connection to the JMS broker?
 
 
 
 Thank you


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 12:03 PM, titexe tit...@yahoo.fr wrote:

 bizarre, even by putting maxMessagesPerTask, the problem is not solved,
 every
 second I have a thread that add, and it :

 ActiveMQ Session ID: Server-1997-XX

 I don't understand anything?


 You are probably not caching the session etc. so it may force spring
 jms to recreate a new session all the time.



 Thank you in advance,

 titexe


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 11:43 AM, titexe tit...@yahoo.fr wrote:

 Thank you for your reply :

 I tested this expression and it does not work, it generates me an
 error
 that
 not recognize this URI:

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/

 I think we should use this :

 from uri=jms:queue:foo?maxMessagesPerTask=-1/

 What do you think?


 Yes.
 Its standard URI options so if only have ONE parameter then use ? to
 indicate the first parameter.

 If you have TWO+ parameters then use  to separate those.
 And if you do that in a XML file then you must escape  so it become
 amp;




 Thank you

 titexe

 from uri=jms:queue:fooamp;maxMessagesPerTask=-1/



 Claus Ibsen-2 wrote:

 Hi

 Have you read the warning on top of the JMS wiki page?
 http://camel.apache.org/jms.html


 On Fri, Nov 27, 2009 at 11:10 AM, titexe tit...@yahoo.fr wrote:

 Hello,

 I am analyzing a problem of memory leak,

 each execution for flow camel, memory increases, but there's not
 releasing
 memory after.

 analyzing the problem with jconsole and jvisualvm, there's a lot of
 threads
 (ActiveMQ Session ID: Server-1997-XX) which is still in
 wait
 and
 will not release, these threads are added more and more each time
 you
 run
 flow camel:

 Name of threads : ActiveMQ Session ID: Server-1997-XX

 Is not that there's a way to release those threads or configuration
 to
 do?

 VersionJava: 1.6
 Fuse Message Broker Version: V5.3.0.3
 Camel Version: 1.6.1.2


 Thank you in advance

 Best regards.

 titexe
 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540277.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540657.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26540897.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





 --
 Claus Ibsen
 Apache Camel Committer

 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus



 --
 View this message in context:
 http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26542792.html
 Sent from the Camel - Users mailing list archive at Nabble.com.


 
 
 
 -- 
 Claus Ibsen
 Apache Camel Committer
 
 Author of Camel in Action: http://www.manning.com/ibsen/
 Open Source Integration: http://fusesource.com
 Blog: http://davsclaus.blogspot.com/
 Twitter: http://twitter.com/davsclaus
 
 

-- 
View this message in context: 
http://old.nabble.com/Camel%3A-memory-management-%28memory-leak%29-tp26540277p26544131.html
Sent from the Camel - Users mailing list 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread shirazi

Sorry, my mistake. Using the latest build from trunk, it works just fine. I
just tried it with a couple of files of 3 and 4 Gigs size. 

Thanks,
-Farhad S.


Claus Ibsen-2 wrote:
 
 On Fri, Nov 27, 2009 at 4:18 PM, shirazi m...@farhad.eu wrote:

 Thanks Claus,
 I just downloaded the new trunk, and I think there's a new bug in it. I
 just
 tried the file component with a couple of files around 3-400 MBs and it
 works fine. As soon as I try it with a file around 3 Gigs, i get the
 following exception (??!!):

 
 That is odd as the stacktrace is off by -1.
 And you do a full svn up and a mvn clean install -Dtest=false to build
 all source from scratch?
 
 
 If you enable TRACE logging for: org.apache.camel.component.file
 
 You should see this log line when it uses the NIO stuff
 
 if (LOG.isTraceEnabled()) {
 LOG.trace(Using FileChannel to transfer from:  + in
 +  to:  + out);
 }
 
 
 I have committed a fix for the NPE in that stacktrace. But the was
 some other exception thrown that got lost.
 
 
 commited rev: 884894.
 
 
 
 16:13:48,830 ERROR [workflow] null while processing exchange:
 Exchange[GenericFileMessage with file: GenericFile[/tmp/vw/cmore/tv5.ts]]
 java.lang.NullPointerException
        at
 org.apache.camel.impl.OnExceptionRouteNode.getLabel(OnExceptionRouteNode.java:41)
        at
 org.apache.camel.processor.interceptor.DefaultTraceFormatter.getNodeMessage(DefaultTraceFormatter.java:233)
        at
 org.apache.camel.processor.interceptor.DefaultTraceFormatter.extractBreadCrumb(DefaultTraceFormatter.java:282)
        at
 org.apache.camel.processor.interceptor.DefaultTraceFormatter.format(DefaultTraceFormatter.java:55)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.format(TraceInterceptor.java:232)
        at org.apache.camel.processor.Logger.logMessage(Logger.java:283)
        at org.apache.camel.processor.Logger.process(Logger.java:166)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.logException(TraceInterceptor.java:325)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:171)
        at
 org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:58)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:58)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
        at
 org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:45)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:58)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at
 org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:56)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 

Re: camel casts exception when there is nothing to fetch from the ftp endpoint

2009-11-27 Thread Claus Ibsen
On Fri, Nov 27, 2009 at 8:17 PM, shirazi m...@farhad.eu wrote:

 Sorry, my mistake. Using the latest build from trunk, it works just fine. I
 just tried it with a couple of files of 3 and 4 Gigs size.


Fantastic. Glad it worked as the code was inspired by your NIO code so
I thought it was odd if it didnt work.
Glad we got that fixed now and thanks for helping out.


 Thanks,
 -Farhad S.


 Claus Ibsen-2 wrote:

 On Fri, Nov 27, 2009 at 4:18 PM, shirazi m...@farhad.eu wrote:

 Thanks Claus,
 I just downloaded the new trunk, and I think there's a new bug in it. I
 just
 tried the file component with a couple of files around 3-400 MBs and it
 works fine. As soon as I try it with a file around 3 Gigs, i get the
 following exception (??!!):


 That is odd as the stacktrace is off by -1.
 And you do a full svn up and a mvn clean install -Dtest=false to build
 all source from scratch?


 If you enable TRACE logging for: org.apache.camel.component.file

 You should see this log line when it uses the NIO stuff

             if (LOG.isTraceEnabled()) {
                 LOG.trace(Using FileChannel to transfer from:  + in
 +  to:  + out);
             }


 I have committed a fix for the NPE in that stacktrace. But the was
 some other exception thrown that got lost.


 commited rev: 884894.



 16:13:48,830 ERROR [workflow] null while processing exchange:
 Exchange[GenericFileMessage with file: GenericFile[/tmp/vw/cmore/tv5.ts]]
 java.lang.NullPointerException
        at
 org.apache.camel.impl.OnExceptionRouteNode.getLabel(OnExceptionRouteNode.java:41)
        at
 org.apache.camel.processor.interceptor.DefaultTraceFormatter.getNodeMessage(DefaultTraceFormatter.java:233)
        at
 org.apache.camel.processor.interceptor.DefaultTraceFormatter.extractBreadCrumb(DefaultTraceFormatter.java:282)
        at
 org.apache.camel.processor.interceptor.DefaultTraceFormatter.format(DefaultTraceFormatter.java:55)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.format(TraceInterceptor.java:232)
        at org.apache.camel.processor.Logger.logMessage(Logger.java:283)
        at org.apache.camel.processor.Logger.process(Logger.java:166)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.logException(TraceInterceptor.java:325)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:171)
        at
 org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:58)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:58)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at
 org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
        at
 org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
 org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:45)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
        at
 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
        at
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
        at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
        at
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
        at
 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
        at
 org.apache.camel.processor.LoggingErrorHandler.process(LoggingErrorHandler.java:58)
        at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at
 org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:56)
        at