Hi
I'm trying to import files from a directory. First I used a simple file adapter such as:
This seems to work fine. However only one thread seems to be used for processing all the files. So I played around with the poller element and found an option to add a task-executor reference.Code:<file:inbound-channel-adapter channel="FILE_IMPORT_CHANNEL" directory="${import.dir}" prevent-duplicates="false"/>
When using the configuration above the thread pool is indeed used and processing files will be much faster. However, I noticed that in some cases multiple messages will be created for the same file during one poll interval, which is not what I expected.Code:<file:inbound-channel-adapter channel="FILE_IMPORT_CHANNEL" directory="${import.dir}" prevent-duplicates="false"> <int:poller fixed-rate="${import.polldelay}" max-messages-per-poll="100" task-executor="taskExecutor"/> </file:inbound-channel-adapter>
I took a look at the source code but wasn't able to find out what could have happened. So my question is if theres something wrong with the configuration above? Is it intended to be used that way? Also, I tried to use the nio-locker but it seems to be not allowed together with the poller. I'm wondering why.Code:INFO [taskExecutor-25] - 2011-02-01 01:18:39 org.springframework.integration.file.FileReadingMessageSource: Created message: [[Payload=/home/import/report_1122345_20110130-20110131.xml.gz][Headers={timestamp=1296519519690, id=2e5b2565-7d7f-4f30-8ff8-5f53acb8b5fa}]] ... INFO [taskExecutor-17] - 2011-02-01 01:18:39 org.springframework.integration.file.FileReadingMessageSource: Created message: [[Payload=/home/import/report_1122345_20110130-20110131.xml.gz][Headers={timestamp=1296519519690, id=b2f29747-538f-42bd-8a18-8bc0084b88a5}]] ... INFO [taskExecutor-21] - 2011-02-01 01:18:39 org.springframework.integration.file.FileReadingMessageSource: Created message: [[Payload=/home/import/report_1122345_20110130-20110131.xml.gz][Headers={timestamp=1296519519690, id=095a0cbd-936c-4ad4-90cb-d9038ec98bea}]]
Thanks!
Edit: I forgot to mention that the very next thing I'm doing with each message emitted through the inbound-channel-adapter is to move it to a different directory, therefor the prevent-duplicates="false" option.


Reply With Quote