Spring Integration と Spring Integration AMQP は初めてです。
次のコードがあります。
<bean id="enricher" class="soft.Enricher"/>
<amqp:inbound-channel-adapter queue-names="QUEUE1" channel="amqpInboundChannel"/>
<int:channel id="amqpInboundChannel">
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:header-enricher input-channel="amqpInboundChannel" output-channel="routingChannel">
<int:header name="store" value="sj" />
</int:header-enricher>
<int:channel id="routingChannel" />
<int:header-value-router input-channel="routingChannel" header-name="store">
<int:mapping value="sj" channel="channelSJ" />
<int:mapping value="jy" channel="channelJY" />
</int:header-value-router>
<amqp:outbound-channel-adapter channel="channelSJ" exchange-name="ex_store" routing-key="sj" amqp-template="rabbitTemplate"/>
<amqp:outbound-channel-adapter channel="channelJY" exchange-name="ex_store" routing-key="jy" amqp-template="rabbitTemplate"/>
<int:channel id="channelSJ" />
<int:channel id="channelJY" />
<int:logging-channel-adapter id="logger" level="ERROR" />
セットアップは次のとおりです。
メッセージが inbound-channel-adapter によって取得されたときにヘッダーが失われることを除いて、すべてが正常に機能しています。
同様に、メッセージが outbound-channel-adapter を使用して取引所に送信されると、「ストア」と呼ばれる強化されたヘッダーも失われます。
これは、inbound-channel-adapter によって取得される前のメッセージの外観です。
これは、同じメッセージがプロセス全体を処理する方法です (ヘッダーがないことに注意してください)。