Hi I have a scenario where I get notified through a soap service call to pick file from an remote ftp location.The ftp server details would be same but the folder name and file will be sent dynamically, How can i implement it using apache camel.? Any suggestions or thoughts might be helpful.
Asked
Active
Viewed 1,024 times
1 Answers
3
I think you should use headers for that. So, you will load your dynamic information into headers and use them in the ftp component with toD.
So you can have something like the following
<toD uri="sftp:username:password@ftp.server.com/${header.CamelFolder}?fileName=${header.CamelDownloadFile}"/>
But since you want to get from an FTP in the middle of the route you can try Content Enricher EIP
<route>
<from uri="..."/>
<!-- set your dynamic values as headers -->
<setHeader headerName="CamelFolder">
<simple>...</simple>
</setHeader>
<setHeader headerName="CamelDownloadFile">
<simple>...</simple>
</setHeader>
<pollEnrich>
<simple>sftp:username:password@ftp.server.com/${header.CamelFolder}?fileName=${header.CamelDownloadFile}</simple>
</pollEnrich>
...
</route>

Themis Pyrgiotis
- 876
- 5
- 15
-
Hi Themis,I need to a file from FTP location on demand and not sending file to a FTP location. – Ravi Feb 15 '18 at 11:25
-
Hi, you are right i got confused. But if you use from with dynamic information at headers? Did you try it? – Themis Pyrgiotis Feb 15 '18 at 11:31
-
Hi iam not sure how to retrieve the the file in the middle of the route.Using from uri will always keep polling to the ftp location and to/toD uri is used to send to remote ftp.Is there any EIP pattern that can be used? – Ravi Feb 15 '18 at 14:31
-
I think you need Content enricher Eip. See http://camel.apache.org/content-enricher.html section Using dynamic uris – Themis Pyrgiotis Feb 15 '18 at 15:19