How to read and process multiple files concurrently in spring?

陌路散爱 提交于 2019-12-07 14:28:00

问题


I am new to Spring framework and I am doing one simple project using spring and got stuck in between. In my project I am reading the file from directory using spring poller. And then processing that file through various channels and sending it to the queue. But problem is that "file-inbound-channel-adapter" (which I'm using ) is reading only one file at a time. So I need a solution which will read and process multiple files at a time. Is there any way to implement multithreading in spring integration. Thank you.


回答1:


Add a task-executor to the poller; see the documentation.

You can control the concurrency with max-messages-per-poll and the task executor's pool size. See the complete poller configuration details for more information.



来源:https://stackoverflow.com/questions/28712782/how-to-read-and-process-multiple-files-concurrently-in-spring

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