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.
Asked
Active
Viewed 2,333 times
3
-
hope [this](http://stackoverflow.com/a/25742319/1910582) helps – Bond - Java Bond Feb 25 '15 at 08:48
1 Answers
4
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.

Gary Russell
- 166,535
- 14
- 146
- 179
-
@Garry Russell...thank you, With task-executor i'm able to poll multiple files but is there any way of polling multiple directories at a time or I've to create inbound-channel for each directory I'm going to poll ? – Zebronix_777 Jun 18 '15 at 05:11
-
You currently need an inbound adapter for each directory. In 4.2, we introduced [conditional pollers](https://spring.io/blog/2015/05/28/spring-integration-4-2-milestone-1-is-available) which would enable you to change the directory on each poll (auto-create directory won't work for that, though). – Gary Russell Jun 18 '15 at 20:32
-
..I have to use separate inbound-channel-adapter for each directory as we are not planning to upgrade to 4.2 but thank you very much will be looking ahead of using it in my further projects. – Zebronix_777 Jun 19 '15 at 05:45