Fetch files from SFTP server
Camel has the SFTP component (see Camel documentation) that enables fetching files from SFTP server. A simple SFTP route fetching files can look like this:
<routes xmlns="http://camel.apache.org/schema/spring"> <route id="example.sftp.fa"> <from uri="sftp://fa@123.45.67.891/inbox/files?username=fa&password=1234&reconnectDelay=10000&delay=60000&disconnect=true&delete=true" /> <to uri="file:{{back.writable.dir}}/integrations/custom?autoCreate=true" /> </route> </routes>
The above route:
Fetches files from SFTP server "123.45.67.891/inbox/files" directory (authenticating with username and password, polling once every 60 seconds).
Places the file to the
/integrations/custom
FA directory.Deletes the files from SFTP after successful processing.
You might need to apply other SFTP connection parameters as well depending on the requirements of the SFTP server you connect to.