【发布时间】:2017-09-09 04:02:29
【问题描述】:
我收到错误“不允许空关联”。也许 CorrelationStrategy 失败了?
这个论坛帖子似乎用下面的方法解决了这个问题,但是这种方法对我不起作用,http://forum.spring.io/forum/spring-projects/integration/102054-aggregator-correlation-strategy-failing。
我的理解是 inbound-streaming-channel-adapter 将 FILE_NAME 作为标头值,我想加入。
<int-ftp:inbound-streaming-channel-adapter
auto-startup="true" id="ftpListener" channel="ftpChannel"
session-factory="ftpSessionFactory" remote-directory="/export/home/udyj"
filename-pattern="test1.txt">
<integration:poller fixed-rate="5000"
max-messages-per-poll="-1" />
</int-ftp:inbound-streaming-channel-adapter>
<int-ftp:inbound-streaming-channel-adapter
auto-startup="true" id="ftpListener2" channel="ftpChannel"
session-factory="ftpSessionFactory" remote-directory="/export/home/udyj"
filename-pattern="test2.txt">
<integration:poller fixed-rate="5000"
max-messages-per-poll="-1" />
</int-ftp:inbound-streaming-channel-adapter>
<bean id="correlationStrategy"
class="org.springframework.integration.aggregator.HeaderAttributeCorrelationStrategy">
<constructor-arg value="FILE_NAME.substring(0,3)" />
</bean>
<integration:aggregator id="nuggetAggregator"
input-channel="ftpChannel" output-channel="sendMQDistributionChannel"
correlation-strategy="correlationStrategy">
</integration:aggregator>
【问题讨论】: