My understanding of what is going on behind the scenes is:

It downloads the file. When the context.stop is executed, it tries to to do
graceful shutdown, but I get the following message:

INFO: Route: route1 suspended and shutdown deferred, was consuming from:
Endpoint[sftp://usern...@server/data/inbox?password=******]


The graceful shutdown procedure tries disconnecting from the SFTP server and
is successful:

INFO: JSCH -> Disconnecting from <server> port 22

But the route still continues to try reading from the server, for which the
input stream is closed now as its disconnected. 

I believe it has to do more with the working of camel than with the Jcraft
sftp operations. Will have to dig deeper in the route execution process I
think!

In the meanwhile, i have a workaround to this problem. I try downloading the
file from the SFTP server using the 'localWorkDirectory' URI option. Here is
how I specify it:
from("sftp://<account>@<sftp
server>/<dir>?password=<passwd>&localWorkDirectory=/tmp").to("file:data/outbox");

Note: The directory you specify for localWorkDirectory needs to be from your
machine's root, else you have to deal with file permissions when you specify
the relative path .. atleast I had to!

Thanks,
Mansi Kanani



-- 
View this message in context: 
http://camel.465427.n5.nabble.com/SFTP-operation-raises-an-exception-but-the-file-is-transferred-tp3303905p3305515.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to