Mind that Camel also has a number of other features
for detecting if a file is ready,
which you can read about the readLock option.
For example if write a file with the name yyyyMMdd-report.txt and want to write a done file using the syntax file name .done, then you can do as follows:
.to("file:reports?fileName=${date:now:yyyMMdd}-report.txt&doneFileName=${file:name}.done");
Notice the new doneFileName option where we define the pattern of done file. It supports two dynamic placeholders which is ${file:name} and ${file:name.noext}. The latter is the file name without the extension.
The "done file" must be located in the same directory as the target file.
On the consumer side we can do as follows:
from("file:reports?doneFileName=${file:name}.done")
.to("bean:fileService");
Which tells Camel to only pickup files if a done file exists with that given name pattern.
And all this works as well with the FTP components.
7 comments:
Hello.
Does it possible to not remove "done" file after exchange?
Hello.
Does it possible to not remove done file after exchange?
Does it possible to not remove done file after exchange?
No the done file is automatic deleted AFAIR. Fell free to request for an enhancement at the Apache Camel project. Read more here: http://camel.apache.org/support
Thank you for your answer.
Hi
I am trying to set the doneFileName using the below
file:{{etlOutdirectory}}?fileName=tdice_etl_email_sms_status_$simple{date:now:yyyymmdd_hh24mmss}.dat&doneFileName=${file:name}.done&fileExist={{etlFileWriter}}
in spring dsl , all I get is name.done file , can anyone help me here
Regards
Sundar M R
This solution works pretty fine when there is a single output file created, I have a scenario where I need to create 3 output files from a single input file based on some transformation on the data. In such a scenario how do I identify the file processing is DONE?
Thanks,
Ganga
Post a Comment