Hi

And uploading and downloading at the *same* time from the same JVM may
not be a good idea. You may start to download files while they are
being uploaded. I wonder if the FTP server supports locking the file
during upload process.

You can use tempPrefix to upload the files with a inprogress filename
and filter that name on the download side so you do not pick up files
being uploaded.

The options from file2 is also avail for the FTP
http://camel.apache.org/file2.html
http://camel.apache.org/ftp2.html


On Mon, Dec 28, 2009 at 9:18 AM, Hebert Hu <hoo...@zju.edu.cn> wrote:
>
> Hi,
>
> I've encountered a strange problem when using Camel Sftp component for
> uploading.
>
> Here's my code
>
>    protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>            public void configure() throws Exception {
>                from("file:c:\\uploadfiles?noop=true").to(getFtpUrl());
>                from(getFtpUrl()).to("mock:result");
>            }
>        };
>    }
>
> private String getFtpUrl(){
>        return
> "sftp://usern...@sftpserver/ftpload?password=password&binary=true&knownHostsFile=c://.ssh//known_hosts";;
>        }
>
> The problem is: When I start my upload procedure, for the files in the
> c:\uploadfiles (multiples files), some of them will create a .camellock file
> while others not. As in the remote server, some of the files that have a
> .camellock copy will be uploaded while others not. Noted that not all the
> files that has .camellock copies will be uploaded. And an exception is
> thrown
> SEVERE: Cannot retrieve file: ftpload/a.txt
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> retrieve file: ftpload/a.txt
>        at
> org.apache.camel.component.file.remote.SftpOperations.retrieveFileToStreamInBody(SftpOperations.java:326)
>        at
> org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOperations.java:312)
>        at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:183)
>        at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:120)
>        at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:93)
>        at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:99)
>        at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:432)
>        at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:295)
>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:80)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:157)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:181)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>        at java.lang.Thread.run(Thread.java:799)
> When I run the upload procedure again, more .camellock files appeared, more
> files been uploaded, and the exception is still thrown.
> For example. 10 files in c:\uploadfiles, run the upload for the first time,
> 5 .camellock appeared, 1 file with .camellock uploaded, and an exception.
> Run for the second time, 2 more .camellock appeared, 1 more file uploaded,
> and an exception again.
>
> Can any one shed some light on me?
> --
> View this message in context: 
> http://old.nabble.com/Issue-in-upload-with-Camel-tp26940685p26940685.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

Reply via email to