Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-4232

AbstractInboundFileSynchronizer drops remote files even if their timestamp have been changed

    XMLWordPrintable

    Details

      Description

      The Reference Manual claims:

      Also, if you configure the filter to use a FtpPersistentAcceptOnceFileListFilter, and the remote file timestamp changes (causing it to be re-fetched), the default local filter will not allow this new file to be processed.

      Use the local-filter attribute to configure the behavior of the local file system filter. To solve these particular use cases, you can use a FileSystemPersistentAcceptOnceFileListFilter as a local filter instead. This filter also stores the accepted file names and modified timestamp in an instance of the MetadataStore strategy (Section 9.5, “Metadata Store”), and will detect the change in the local file modified time.

      But that actually doesn't work because of:

      AbstractInboundFileSynchronizer.java
      protected void copyFileToLocalDirectory(String remoteDirectoryPath, F remoteFile, File localDirectory,
      			Session<F> session) throws IOException {
          ...
          File localFile = new File(localDirectory, localFileName);
          if (!localFile.exists()) {
                ...
          }
      }
      

      where we don't consult the remote file modification and just rely on the fact that the previous version already exists. Therefore we don't go to the local copy logic and the remote modification has been done for nothing.

      Only workaround to remove a local file after processing and rely on the filter logic to skip remote files before downloading.

        Attachments

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            abilan Artem Bilan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: