【发布时间】:2014-10-08 10:20:15
【问题描述】:
我正在尝试通过一个简单的任务对 Spring Integration 进行实验。我有一个文件夹,我可以在其中获取传入文件。这些文件以组 ID 命名。 我希望按顺序处理同一 groupId 中的所有文件,但可以并行处理具有不同 groupId 的文件。
我开始整理这样的配置:
<int:service-activator input-channel="filesInChannel"
output-channel="outputChannelAdapter">
<bean class="com.ingestion.FileProcessor" />
</int:service-activator>
<int:channel id="filesInChannel" />
<int-file:inbound-channel-adapter id="inputChannelAdapter"
channel="filesInChannel" directory="${in.file.path}" prevent-duplicates="true"
filename-pattern="${file.pattern}">
<int:poller id="poller" fixed-rate="1" task-executor="executor"/>
</int-file:inbound-channel-adapter>
<int-file:outbound-channel-adapter id="outputChannelAdapter" directory="${ok.file.path}" delete-source-files="true"/>
<task:executor id="executor" pool-size="10"/>
这是用 10 个线程处理所有传入的文件。我需要哪些步骤来按 groupId 拆分文件并让它们为每个 groupId 处理一个线程?
谢谢。
【问题讨论】: