我有以下 XML 有效负载,我正在尝试将其用于 Spring Integration 和 Spring Integration AMQP:
<?xml version="1.0" encoding="UTF-8"?>
<order>
<items>
<item_name>Item1</item_name>
</items>
<items>
<item_name>Item2</item_name>
</items>
<items>
<item_name>Item3</item_name>
</items>
</order>
我正在使用 xpath-splitter 拆分消息:
<int-xml:xpath-splitter input-channel="amqpInboundChannel" output-channel="aggregateChannel">
<int-xml:xpath-expression expression="//items"></int-xml:xpath-expression>
</int-xml:xpath-splitter>
我工作正常,消息被拆分为 3 条新消息,例如使用此有效负载:
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item_name>Item1</item_name>
</items>
在此步骤之后,将使用此设置聚合消息:
<int:aggregator input-channel="aggregateChannel" output-channel="channelSJ" message-store="messageStore">
</int:aggregator>
<bean id="messageStore" class="org.springframework.integration.store.SimpleMessageStore" />
作为最后一步,使用此出站通道适配器将消息发送到交换:
<amqp:outbound-channel-adapter channel="channelSJ" exchange-name="ex_store" routing-key="sj" amqp-template="rabbitTemplate" header-mapper="myHeaderMapper"/>
<int:channel id="channelSJ">
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
不幸的是,出了点问题,因为我最终得到了类似这个有效载荷的东西。我需要它保持 XML 格式。