Using Local Work Directory - 6.3

Talend ESB Mediation Developer Guide

Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Design and Development
Talend ESB

Camel supports consuming from remote FTP servers and downloading the files directly into a local work directory. This avoids reading the entire remote file content into memory as it is streamed directly into the local file using FileOutputStream .

Camel will store to a local file with the same name as the remote file, though with .inprogress as extension while the file is being downloaded. Afterwards, the file is renamed to remove the .inprogress suffix. And finally, when the Exchange is complete the local file is deleted.

So if you want to download files from a remote FTP server and store it as files then you need to route to a file endpoint such as:



Renaming the work file facilitates optimization. The route above is ultra efficient as it avoids reading the entire file content into memory. It will download the remote file directly to a local file stream. The handle is then used as the Exchange body. The file producer leverages this fact and can work directly on the work file handle and perform a to the target filename. As Camel knows it is a local work file, it can optimize and use a rename instead of a file copy, as the work file is meant to be deleted anyway.