Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14533

camel-ftp: fileExist=Append and tempPrefix options do not work together

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.22.2, 2.24.2, 3.0.1
    • Fix Version/s: 2.25.2, 3.4.3, 3.5.0
    • Component/s: camel-ftp
    • Labels:
    • Estimated Complexity:


      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:

       .setHeader("CamelFileName", constant("foo.txt"))

      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.




            • Assignee:
              davsclaus Claus Ibsen
              kalusn Claus Skou Nielsen


              • Created:

                Issue deployment