I'm wondering how to prevent that multiple instances of a particular DSL integration flow will consume the same files concurrently. I'm using FileReadingMessageSource in the beginning of the the flow so it is my "file watcher" in this case... Would be one of those Metadatastore an option? If so, how can I attach it into the flow? I have a GenericSelector after reading the files in order to filter out some unwanted file names.
The FileReadingMessageSource
uses an AcceptOnceFileListFilter
by default to prevent reading duplicates. But it is in-memory. So, if you'd like to survive an application restart and don't want to see already processed files, you are free to configure that FileReadingMessageSource
with a FileSystemPersistentAcceptOnceFileListFilter
supplied with some shared ConcurrentMetadataStore
implementation.
You also can compose this filter with others like RegexPatternFileListFilter
.
See more info in docs about ChainFileListFilter
: https://docs.spring.io/spring-integration/reference/html/file.html#file-reading