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.

Reply via email to