camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel calling commit too early when using split+seda+file endpoint
Date Thu, 09 Sep 2010 19:43:56 GMT
What are you trying to do with the seda stuff?

You should consider removing that.

On Thu, Sep 9, 2010 at 7:46 PM, camel_el <eric.ladouceur@cse-cst.gc.ca> wrote:
>
> Hi,
>
>  I am not sure if this is a bug, or if there is a way around it, but either
> way, I wrote a small sample to reproduce the problem I am facing in my
> application.
>
> Setup
> - camel 2.4.0
> - running on Windows 32 bits
> - Sun jdk 1.6.0_03
>
> input
> 2 x .csv files where each one contains 4 tokens separated by commas
>
> code
> from("file:e:/test")
>  .split(body().tokenize(","))
>    .to("seda:queue")
>    .process(new Processor()
>    {
>      public void process(Exchange e) throws Exception
>      { Thread.sleep(2000); } // Simulates long processing happening in my
> real application
>    })
>  .end()
>  .log("End of file ${file:name}");
>
> from("seda:queue)
>  .log("Token: ${body}");
>
> Problem
> When this code gets executed, it will throw 2 exceptions about Camel cannot
> rename the input file.  Camel is trying to rename the input file even though
> it hasn't finished tokenizing the file.  As soon as the first "splitted
> token" gets passed the sleep processor, the commitRenamer of the
> FileStrategy is called and Camel tries to rename the file.  "tokenize(",")"
> still has a hold on the file as an input stream I guess, so the file cannot
> be renamed.
>
> Is there a way to delay that rename until the very end of the file (when
> tokenize() has been through all the elements inside the file), or is this a
> bug?
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-calling-commit-too-early-when-using-split-seda-file-endpoint-tp2830894p2830894.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

Mime
View raw message