If you both have fileExist=Append and tempPrefix=<something> options on a sftp to-endpoint, the de facto behaviour of the route is as if it was configured with fileExist=Override.
When you think about how fileExist and tempPrefix works, this bug actually makes sense. The temporary prefix makes it so that a "new" file is written every time, and therefore fileExist=Append is just working like it does when there isn't an existing file to append to.
I think there are a couple of possible solutions to this problem:
- Document this behaviour in the camel documentation, and let the user be responsible for knowing that these two options are incompatible
- Throw an exception when building the route if these two mutually exclusive options are used on the same route
- Make fileExist=Append and tempPrefix=<something> be compatible, by making the 'mv' operation after writing the temporary file merge the two files, instead of replacing it
- Some other brilliant solution that the camel maintainers will see, that has escaped me
Recreate the issue
Define and start up the following route:
Then you can observe the folder on the sftp-server, and see that the file size never increases, but the files Last-Modified timestamp gets renewed every five seconds.
If you remove the "tempPrefix=.uploading" option from the sftp uri it works like it should, and the file size increases every 5 seconds.