Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Integration: FTP files after specified dates

We used to FTP files manually from remote site. Now I implementing Spring Integration to FTP them automatically. When this solution is put in production I do not want to again process files that were downloaded manually from FTP site and already processed. So if my solution goes to production today 10/13/2015 I only want to process files from 10/12/2013 onward. Is there out of the box filter to do this? I am searching through documentation and on Internet but cannot find anything. If there no such filter what would be the easiest way to implement my own filter. I would like the filter to keep track of files that are already downloaded even if my integration goes down.

Thanks, David

like image 963
David Avatar asked Dec 27 '25 18:12

David


1 Answers

If your files names contains the data, you can use a FtpRegexPatternFileListFilter

Otherwise, you should have a inbound-channel-adapter, where you can plug a filter ( in your case, you will have to write it ), then use FtpFileInfo.getModified()

To implement your own filter for Spring Integration implement FileListFilter, as you see, it's only one methods to implements. In that filter, you will be able to access the date of creation and write your custom logic to return only the File you want to integrate.

like image 175
Antoine Claval Avatar answered Dec 31 '25 00:12

Antoine Claval



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!