Hi,
I am using camel 2.8.3 and have a simple camel flow in which I want to move
(and not copy) a file from one folder to another. here is my flow:-

        
from("file:C:\\ifm3.3\\ifmautomation\\landingzone_001?move=C:\\ifm3.3\\ifmautomation\\proczone_001&initialDelay=5000&delay=4000&readLock=changed&readLockCheckInterval=5000")
                  .log("Moving file from landing zone to processing zone :
${header.CamelFileName}")
                 .onException(Exception.class).continued(true)
                 .end();

The file in the landingzone_001 could be pretty big (several million
records) and I don't want to set the delay to a long time (say 30 min) since
files would be coming in throughout the day and some of them may be large
while others small and I dont want an unnecessary delay in processing them.

The problem I am facing is that when I copy a large file into
landinezone_001, even before the file is fully copied, camel tries to pick
it up and then gives an exception trace like this:-

2012-05-02 06:45:39,743 INFO  [Camel (camel-1) thread #0 -
file://C:ifm3.3ifmautomationlandingzone_001] route1 - Moving file from
landing zone to processing zone : ME20080919.dat
2012-05-02 06:45:41,764 ERROR [Camel (camel-1) thread #0 -
file://C:ifm3.3ifmautomationlandingzone_001]
org.apache.camel.component.file.GenericFileOnCompletion - Caused by:
[org.apache.camel.component.file.GenericFileOperationFailedException - Error
renaming file from C:\ifm3.3\ifmautomation\landing
zone_001\ME20080919.dat to
C:\ifm3.3\ifmautomation\proczone_001\ME20080919.dat]org.apache.camel.component.file.GenericFileOperationFailedException:
Error renaming file from
C:\ifm3.3\ifmautomation\landingzone_001\ME20080919.dat to
C:\ifm3.3\ifmautomation\proczone_001\ME20080919.dat
        at
org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:68)
~[na:na]
        at
org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:96)
~[na:na]
        at
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
~[na:na]
        at
org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:133)
~[na:na]
        at
org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:83)
~[na:na]
        at
org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:54)
~[na:na]
        at
org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:56)
~[na:na]
        at
org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:208)
~[bundlefile:2.8.3]
        at
org.apache.camel.processor.UnitOfWorkProcessor.doneUow(UnitOfWorkProcessor.java:188)
~[na:na]
        at
org.apache.camel.processor.UnitOfWorkProcessor.access$000(UnitOfWorkProcessor.java:37)
~[na:na]
        at
org.apache.camel.processor.UnitOfWorkProcessor$1.done(UnitOfWorkProcessor.java:146)
~[na:na]
        at
org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:317)
~[na:na]
        at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:349)
~[na:na]
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
~[na:na]
        at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)
~[na:na]
        at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)
~[na:na]
        at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)
~[na:na]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
~[na:na]
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
~[na:na]
        at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:353)
~[na:na]
        at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:176)
~[na:na]
        at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:137)
~[na:na]
        at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:138)
~[bundlefile:2.8.3]
        at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:90)
~[bundlefile:2.8.3]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source) ~[na:1.6.0_30]
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown
Source) ~[na:1.6.0_30]
        at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
~[na:1.6.0_30]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
Source) ~[na:1.6.0_30]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
Source) ~[na:1.6.0_30]
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source) ~[na:1.6.0_30]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source) ~[na:1.6.0_30]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source) ~[na:1.6.0_30]
        at java.lang.Thread.run(Unknown Source) ~[na:1.6.0_30]
Caused by: java.io.FileNotFoundException:
C:\ifm3.3\ifmautomation\landingzone_001\ME20080919.dat (The process cannot
access the file because it is being used by another process)
        at java.io.FileInputStream.open(Native Method) ~[na:1.6.0_30]
        at java.io.FileInputStream.<init>(Unknown Source) ~[na:1.6.0_30]
        at org.apache.camel.util.FileUtil.copyFile(FileUtil.java:380)
~[na:na]
        at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:365)
~[na:na]
        at
org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:66)
~[na:na]
        ... 34 common frames omitted

Though the route continues after this and eventually moves the file, I don't
want users to see this exception (and get confused if something is wrong)
and so I am using onException(Exception.class).continued(true) to eat this
exception, but I am still seeing the exception trace in the console.

So kindly help me out with how I can eat this exception so that no exception
trace comes up in the console 
(it would be good if I can just print a log message in the interim saying
"Waiting for the file to copy fully...")

Thanks,
Aashish


--
View this message in context: 
http://camel.465427.n5.nabble.com/onException-continued-true-not-working-for-camel-2-8-3-tp5680301.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to