feicipet
feicipet

Reputation: 954

Spring Integration: poll files based on creation date / time

Using Spring Integration, I need to pick up input messages from a directory. This is a CIFS / Samba shared folder that I only have read-only access to, so I need to find a way to pick up only new files while not needing to delete them. Default AcceptOnceFileListFilter behavior only works if I don't restart my container so that's not ideal.

So what I'm thinking is how to get the file poller to only pick up files created X minutes ago. I'd still be picking up repeated files but from a much shorter time span (I can deal with that).

I think what I need to do is to implement my own FileListFilter to only return files that were created X minutes ago. Just would like to ask around if there's already an implementation of that, either inside the default Spring filters or anywhere else. Any better suggestions would be very much welcome too!

Thanks Wong

Upvotes: 1

Views: 764

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121542

There is no such a FileListFilter implementation out-of-the-box, however you can simply implement it yourself. That solution can extends AcceptOnceFileListFilter.

As the better solution we have a persistent implementation, which allows to keep state for picked files during application restart. It is FileSystemPersistentAcceptOnceFileListFilter.

Upvotes: 1

Related Questions