SFTP using spring integration

跟風遠走 提交于 2019-12-11 10:25:44

问题


I have a use case where a user drop multiple csv files into remote directory and then place a ready.txt to indicate that files are ready to consume. Our applcation when it see a ready.txt file in the remote directory it should start copying all the files into local directory including ready.txt using sftp file inbound channel adapter. Is there a way to make sure readt.txt file is the last file to be copied to local directory?

Because when files are copied from remote directory to local directory, I have another file inbound channel adapter looking for the ready.txt file inside local directory, when found initiate my batch process which depends on all the csv files copied from remote. The thing here is those files has to be executed in a ORDER. Copying ready.txt file last will make sure I have all the files so I can start my batch process.

Pardon with my english, bottom line is I want ready.txt to be last file to be copied to my local directory to make sure all csv files are copied.

Thanks

Mallikarjun


回答1:


You can use a custom FileListFilter on the inbound adapter; the adapter calls filterFiles() and will fetch the files in the order returned. You can return an empty list until ready.txt is found; when it is present, simply re-order the list and put ready.txt at the end.



来源:https://stackoverflow.com/questions/27447460/sftp-using-spring-integration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!