Description
In what version(s) of Spring Integration are you seeing this issue?
Spring integration SFTP v6.1.3
Describe the bug
If you combine SftpSimplePatternFileListFilter (so you use *.trg files) and SftpPersistentAcceptOnceFileListFilter (so you only accept one file once) by using a ChainFileListFilter, the resulting filter has "supportsSingleFileFiltering" to false.
This causes the filtering to be done and rollback (necessary for SftpPersistentAcceptOnceFileListFilter) in AbstractRemoteFileStreamingMessageSource.listFiles() method.
When you set max fetch size to a number bigger than one (for example 5) and at a certain point it is necessary to "this.toBeReceived.clear()" inside "AbstractRemoteFileStreamingMessageSource.doReceive()", those removed elements from toBeReceived are not rolled back.
To Reproduce
- Use a SftpStreamingMessageSource with a maxFetchSize = 5 and a ChainFileListFilter filter composed by SftpSimplePatternFileListFilter and SftpPersistentAcceptOnceFileListFilter.
- Put 2 files in the folder and invoke SftpStreamingMessageSource.receive() method twice.
- Put 5 files in the folder and invoke SftpStreamingMessageSource.receive() method five times.
- The last two files won't be received.
Expected behavior
All the 7 files should be received.
Sample
See the related pull request.