Spring Integration - 參考手冊
參考文件的這部分快速介紹了 Spring Integration 專案中的 AMQP 支援。
簡介
Spring Integration 專案包含了基於 Spring AMQP 專案構建的 AMQP 通道介面卡和閘道器。這些介面卡在 Spring Integration 專案中開發和釋出。在 Spring Integration 中,“通道介面卡”是單向的,“閘道器”是雙向的。我們提供了入站通道介面卡、出站通道介面卡、入站閘道器和出站閘道器。
由於 AMQP 介面卡是 Spring Integration 版本的一部分,文件可在 Spring Integration 分發包中找到。我們在此提供主要功能的快速概述。有關更多詳細資訊,請參閱 Spring Integration 參考指南。
入站通道介面卡
要從佇列接收 AMQP 訊息,您可以配置一個 <inbound-channel-adapter>
。以下示例展示瞭如何配置入站通道介面卡
<amqp:inbound-channel-adapter channel="fromAMQP"
queue-names="some.queue"
connection-factory="rabbitConnectionFactory"/>
出站通道介面卡
要將 AMQP 訊息傳送到交換機,您可以配置一個 <outbound-channel-adapter>
。除了交換機名稱外,您還可以選擇提供一個 'routing-key'。以下示例展示瞭如何定義出站通道介面卡
<amqp:outbound-channel-adapter channel="toAMQP"
exchange-name="some.exchange"
routing-key="foo"
amqp-template="rabbitTemplate"/>