title: File Inbound Channel unable to read file
body: <p>I use Spring Integration to process CSV files manually added to a folder.</p>
  
  <p>The beginning of my integration is :</p>
  
  <pre><code>&lt;bean id="recursiveScanner" class="org.springframework.integration.file.RecursiveLeafOnlyDirectoryScanner" /&gt;
  &lt;int-file:inbound-channel-adapter channel="filesIn" directory="file:${integration.directory}" scanner="recursiveScanner"&gt;
      &lt;int:poller id="poller" fixed-delay="${integration.delay}" /&gt;
  &lt;/int-file:inbound-channel-adapter&gt;
  </code></pre>
  
  <p>Followed by custom service activators.</p>
  
  <p>When I move a small file (few megs) in the scanned directory it works perfectly, but when it's a big file (93 Mio) I get an exception :</p>
  
  <pre><code>org.springframework.batch.item.ItemStreamException: Failed to initialize the reader
  ..........
  Caused by: java.io.FileNotFoundException: D:\nreco-import-batch-2014\.\home\entries.csv (Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus)
  </code></pre>
  
  <p>It says the file can't be read because already openned by another process.</p>
  
  <p>My guess is that the Spring channel is triggered at the begining of the file transfer, when the file is still being copied by the operating system, thus is not yet readable.</p>
  
  <p><strong>So my question is:</strong> is there a way to configure the file inbound channel to be triggered only when the file copy is complete ?</p>
  
  <p>For now I test in local, with very good transfer rates between by two HDD, but the app will be deployed on a server where the scanned directory will be accessed by FTP, I am sure it will fail for much smaller files then...</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <p>edit: forgot to explain one part</p>
  
  <p>one of my service activators (the final one) is a Spring Batch job which parses the newly added file, process the data and insert them in a MongoDB database</p>
  
  <p>it's the Batch step actually reading the file which throws the Exception</p>