Move files from one directory to another when request coming from another system

∥☆過路亽.° 提交于 2019-12-01 12:08:06

问题


I want to use read files in one directory and move to another directory, I am using spring-integration for this. I want to execute the task(move files to output directory) when request coming from another system. I do not want to run file mover repeatedly, Is there a way to do this in Spring Integration?

Thank you in advance, Udeshika


回答1:


There are some tricks you can do with pollers, such as the FireOnceTrigger I mentioned in this answer. But in this case, probably the simplest solution is, instead of using an inbound adapter, define a <bean/> of type FileReadingMessageSource in your context; get a reference to it in your main() (context.getBean(FileReadingMessagesource.class)). Keep calling receive() and send the message received to the first channel in your flow (or use a <gateway/>.

When receive() returns null, exit.



来源:https://stackoverflow.com/questions/17063311/move-files-from-one-directory-to-another-when-request-coming-from-another-system

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