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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.22.2, 2.24.2, 3.0.1
    • 2.25.2, 3.4.3, 3.5.0
    • camel-ftp
    • None
    • Unknown

    Description

      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:

      from("timer://loltimer?delay=5000&period=5000")
       .setHeader("CamelFileName", constant("foo.txt"))
       .setBody(constant("Davs"))
       .to("sftp://mysftpserver:22/fileappendtest?username=myusername&password=mypassword&fileExist=Append&tempPrefix=.uploading");

      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.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            kalusn Claus Skou Nielsen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: