Hi,
I undig an old point (
http://camel.465427.n5.nabble.com/Camel-File-Discard-empty-file-td472234.html
)
My camel application wait file send from a tierce application ( which is
generate from a file:stream by an other application) and has to process it
and delete it after.
The file can be empty or big (more than 1Go). The big size of the file
required that the from wait for the end of the write before to process it
and I have to manage in the same time empty file.
I have started with a :
from("file://C:/Temp/camel2/in/?filter=#lockFilter&delay=2000&delete=true")
.log("start process file => ${file:name}")
.to("file://C:/Temp/camel2/out/?fileName=out.csv")
.log("end process file => ${file:name}")
.end();
With a lockFilter :
public class LockFilter<T> implements GenericFileFilter<T> {
@Override
public boolean accept(GenericFile<T> genericFile) {
File currentFile = (File) genericFile.getFile();
// try to rename the current file
if (currentFile.renameTo(currentFile)) {
return true;
} else {
return false;
}
}
}
I am a little suprised that camel doesn't manage it " natively " , is there
a other solution ?
Thanks !
Jeff