Consider you are polling a directory from multiple instances (let's say 4) using a jdbc-metadata-store and the poller maxMessagesPerPoll set to 1 and the interval 5 min and you are consuming this message with a handler method and deleting the file when you are done.
If you receive 100 files, depending on the start time of each instance, let's say the instace-1 got the 100 files meaning that all the files name and modified timestamps are persisted into database.
How can I protect the messages which are not consumed yet when the instance is killed or received a context closed event or return consuming when the istance-1 is up or even other instances can consume? Since they are persisted in metadata store they won't be picked up again and those messages will be lost forever.
Let's see if adding transaction support into your file inbound channel adapter helps somehow:
https://docs.spring.io/spring-integration/reference/transactions.html
https://docs.spring.io/spring-integration/reference/jdbc/metadata-store.html