问题:spring集成聚合器将聚合消息发布为数组列表。如何将聚合响应作为单个jms消息发送?我需要先使用变压器吗?
聚合器:
<aggregator
id="myAgg"
input-channel="jmsInChannel"
output-channel="outputChannel"
discard-channel="discardChannel"
ref="myAggBean"
method="combineRespones"
expire-groups-upon-completion="true"
correlation-strategy-expression="#xpath(payload, '/test/name')"
release-strategy="myAggBean"
release-strategy-method="canRelease"
send-partial-result-on-expiry="false"
send-timeout="5000"
group-timeout="20000"/>
输出通道:
<channel id="outputChannel">
<int:queue/>
</channel>
出站适配器:
<jms:outbound-channel-adapter channel="outputChannel"
id="jmsOut"
destination="outboundQueue"/>
UPDATE 1:-最初这篇文章有以下错误,但这是由于我的配置将消息释放到错误的队列。
错误:由:org.springframework.messaging.MessagingException引起:不受支持的负载类型[java.util.ArrayList]
您的问题不清楚
- 如果希望将发布的消息作为单独的文本消息发送到JMS,请在聚合器和出站通道适配器之间添加
<splitter/>
- 如果您想将列表作为一条消息发送,则需要某种转换器来按您想要的方式对其进行格式化