Hi all,
I just noticed an issue related to deleting the target file when writing
using temporary file names and eagerDeleteTargetFile is set to false.

the producer first checks if target file exists, it than writes the
temporary file. Once temporary file is written the target file is deleted in
case the test performed before writing tmp file was positive.

The final file might be deleted while temporary file is written and the
producer would throw an exception in such situation; it is possible for the
target file to be deleted while writing temporary file especially when
writing large files or using FTP component.

I would suggest to check target file existence (and delete it) before
writing temporary file only when eagerDeleteTargetFile is set to true;
when not eagerly deleting target file I would suggest to check target file
existence (and in case delete it) only after temporary file have been
deployed, right before renaming it.



an improvement would be avoiding the target file deletion by simply renaming
temporary file to target once it has been written (this would save a LIST
which might take a long time using FTP). This should be possible when using
FTP producer. This could be a new fileExists option name
'OptimisticOvveride' where target file is not deleted in case it exists
already.


Looking forward for a feedback from the community.
Please let me know if I should open a JIRA ticket (possibly 2 separate
tickets?).


Regards,
Marco



--
View this message in context: 
http://camel.465427.n5.nabble.com/GenericFileProducer-ISSUE-target-deletion-with-eagerdeletefile-set-to-false-tp5725390.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to