1

I am trying to use the camel-ftp endpoint (specifically the sftp module) to upload a newly produced CSV file.

The relevant portion of my route is as follows:

...
<marshal>
    <csv></csv>
</marshal>
<to uri="file:incoming?tempPrefix=.&amp;fileName=feed.csv" />
<to uri="sftp://username@linuxserver/home/username/file.csv?password=password" />
...

Note: the "file" at

incoming/feed.csv

is created successfully, camel's last few lines of output read:

[DefaultQuartzScheduler-camel_Worker-1] INFO org.apache.camel.component.file.remote.SftpOperations - JSCH -> Authentication succeeded (password). 
[DefaultQuartzScheduler-camel_Worker-1] INFO org.apache.camel.component.file.remote.SftpOperations - Connected to sftp://username@linuxserver:22 
[DefaultQuartzScheduler-camel_Worker-1] INFO org.apache.camel.component.file.remote.RemoteFileProducer - Connected and logged in to: Endpoint[sftp://username@linuxserver/home/username/file.csv?password=xxxxxx]

But there is no

/home/username/file.csv

on linuxserver.

Note:

I have the same results when I configure my sftp rout as either of the following:

<to uri="sftp://username@linuxserver/home/username/?password=password" />

or

<to uri="sftp://username@linuxserver/home/username?password=password" />

What am I missing?

5
  • Try without the <to file> first so it goes straight to your FTP server. Commented Nov 22, 2013 at 16:16
  • Thanks. I just tried this with the same outcome.
    – JSK NS
    Commented Nov 22, 2013 at 16:36
  • Set DEBUG/TRACE logging and see what is being logged at that level. Commented Nov 22, 2013 at 19:35
  • The last line is still "[DefaultQuartzScheduler-camel_Worker-1] INFO org.apache.camel.component.file.remote.RemoteFileProducer - Connected and logged in to: Endpoint[sftp://username@linuxserver/home/username/file.csv?password=xxxxxx]"
    – JSK NS
    Commented Nov 22, 2013 at 19:41
  • 1
    check the logs on the ftp server side, what it says. Also you can enable logging on SFTP library as well (jcraft) Commented Nov 27, 2013 at 9:21

2 Answers 2

2

When the directory part of the URI is present, like in:

<to uri="sftp://username@linuxserver/home/username/?password=password" />
a file is placed in a directory relative to user home dir (~username/home/username in this case) - so when you want to place a file in the user home dir directly do not specify directory at all - use:
<to uri="sftp://username@linuxserver?password=password" />

When you want to place a file outside the home directory use double slash to separate hostname from directory:
<to uri="sftp://username@linuxserver//home/username/?password=password" />

Checked using camel 2.10.7. Set trace for logger org.apache.camel.component.file.remote.SftpOperations to verify behaviour.

@Olivier.Roger - ftps != sftp

0

The sftp endpoint should be specified as

ftps://[username@]hostname[:port]/directoryname[?options]

So the filename should ne be specified in the URI. You can choose a filename using the CamelFileName header.

You can find additonal information in the FTP Component documentation.

2
  • That was my previous configuration, and I got the same result.
    – JSK NS
    Commented Nov 22, 2013 at 14:06
  • I apologize for the confusion. I updated my question to reflect this.
    – JSK NS
    Commented Nov 22, 2013 at 14:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.