Spring integration 不允许Spring集成空关联。也许相关策略失败了?
我得到错误“不允许空相关”。也许相关策略失败了 这个论坛线程似乎解决了它与以下类似的东西,但这种方法是不适合我 我的理解是,入站流通道适配器将FILE_NAME作为头值,我想加入其中Spring integration 不允许Spring集成空关联。也许相关策略失败了?,spring-integration,Spring Integration,我得到错误“不允许空相关”。也许相关策略失败了 这个论坛线程似乎解决了它与以下类似的东西,但这种方法是不适合我 我的理解是,入站流通道适配器将FILE_NAME作为头值,我想加入其中 <int-ftp:inbound-streaming-channel-adapter auto-startup="true" id="ftpListener" channel="ftpChannel" session-factory="ftpSessionFactory" remote
<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>
看,你说的是
headerAttributeCorrelationsStrategy
,一个标题名肯定会得到什么。但同时,将头名称指定为文件名.substring(0,3)
,它看起来更像一个表达式。得到null是因为实际上没有这样的头
如果要计算表达式,请考虑改用expressionevaluationcorrelationstrategy
:
<bean id="correlationStrategy"
class="org.springframework.integration.aggregator.ExpressionEvaluatingCorrelationStrategy">
<constructor-arg value="headers.file_name.substring(0,3)" />
</bean>