On Sun, May 24, 2009 at 7:07 PM, Rodrigo Valerio <[email protected]> wrote: > > Hello Claus. > > I have used version 2.0-M1. > > I will try to use body().tokenize("\n") and see how this: > http://camel.apache.org/tracer.html works with logs. Hi
Just to let you know that you found a bug in Camel 2.0M1. I have fixed it but you have to use the 2.0-SNAPSHOT or wait for 2.0M2 version to be released with this fix. If you use Maven you can change to -SNAPSHOT. Details on this page: http://camel.apache.org/download.html > > Thank you again!!! > > Rodrigo Valerio > > > Claus Ibsen-2 wrote: >> >> On Sun, May 24, 2009 at 10:18 AM, Claus Ibsen <[email protected]> >> wrote: >>> Hi >>> >>> I found a bug in Camel 2.0 where we did not properly detect the >>> java.io.File as payload type to leverage this with the Scanner. I have >>> created a ticket and will commit fix later: >>> https://issues.apache.org/activemq/browse/CAMEL-1642 >>> >>> With this fix you can use body() or body(File.class) and either one >>> will support the streaming mode and thus the scanner will work >>> directly on the java.io.File so the file content will not be loaded >>> into memory. >>> >>> I will backport the unit test to Camel 1.6.x to see if the problem is >>> also there. >> I have backported the unit test and the bug was not present in Camel >> 1.6.x. >> The bug is only in Camel 2.0. >> >> >>> >>> BTW: Have you noticed that we have a tracer that can be used to log >>> how messages is routed in Camel. >>> http://camel.apache.org/tracer.html >>> >>> It can be easier to use than doing system out in processors >>> >>> >>> On Sun, May 24, 2009 at 8:50 AM, Claus Ibsen <[email protected]> >>> wrote: >>>> On Sun, May 24, 2009 at 1:14 AM, Rodrigo Valerio <[email protected]> >>>> wrote: >>>>> >>>>> Hello people. >>>>> Please help me, i try to use choice after a split, tokenize and stream >>>>> a >>>>> file. >>>>> But the code never goes to .choice, when i use body(File.class) to >>>>> split/tokenize. >>>>> If i use body(String.class) goes, but put all file in memory. >>>> Basically you dont have to pass in the body type, so it should be: >>>> >>>> split(body().tokenize("\n")).streaming() >>>> >>>> I created an unit test based on your route: >>>> https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/FileSplitStreamingWithChoiceTest.java >>>> >>>> BTW: Which version of Camel are you using. That information is crucial >>>> for us to know to be able to better help you. >>>> >>>> >>>>> >>>>> public class RoteadorVisa extends RouteBuilder { >>>>> �...@override >>>>> public void configure() throws Exception { >>>>> >>>>> from("file:///tmp/files/?recursive=true&autoCreate=true&noop=true") >>>>> //This runs ok. If i put body(String.class) instead of >>>>> body(File.class) >>>>> .split(body(File.class).tokenize("\n")).streaming() >>>>> .process(new Processor(){ >>>>> public void process(Exchange exchange) throws >>>>> Exception { >>>>> >>>>> System.out.println(exchange.getIn().getBody()); >>>>> } >>>>> }) >>>>> //NEVER GOES HERE >>>>> .choice() >>>>> .when( body(String.class).isNotNull() ) >>>>> .process(new Processor(){ >>>>> public void process(Exchange exchange) >>>>> throws Exception { >>>>> >>>>> System.out.println(exchange.getIn().getBody()); >>>>> } >>>>> }) >>>>> .otherwise() >>>>> .process(new Processor(){ >>>>> public void process(Exchange exchange) >>>>> throws Exception { >>>>> >>>>> System.out.println(exchange.getIn().getBody()); >>>>> } >>>>> }) >>>>> .end(); >>>>> } >>>>> } >>>>> -- >>>>> View this message in context: >>>>> http://www.nabble.com/split-%2B-stream-%2B-choice%2C-what-wrong--tp23689175p23689175.html >>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>> >>>> >>>> >>>> >>>> -- >>>> Claus Ibsen >>>> Apache Camel Committer >>>> >>>> Open Source Integration: http://fusesource.com >>>> Blog: http://davsclaus.blogspot.com/ >>>> Twitter: http://twitter.com/davsclaus >>>> >>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: > http://www.nabble.com/split-%2B-stream-%2B-choice%2C-what-wrong--tp23689175p23695786.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
