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>。除了交換器名稱外,您還可以選擇提供“路由鍵”。以下示例展示瞭如何定義出站通道介面卡

<amqp:outbound-channel-adapter channel="toAMQP"
                               exchange-name="some.exchange"
                               routing-key="foo"
                               amqp-template="rabbitTemplate"/>

入站閘道器

要從佇列接收 AMQP 訊息並回復其“reply-to”地址,您可以配置一個<inbound-gateway>。以下示例展示瞭如何定義入站閘道器

<amqp:inbound-gateway request-channel="fromAMQP"
                      reply-channel="toAMQP"
                      queue-names="some.queue"
                      connection-factory="rabbitConnectionFactory"/>

出站閘道器

要向交換器傳送 AMQP 訊息並從遠端客戶端接收響應,您可以配置一個<outbound-gateway>。除了交換器名稱外,您還可以選擇提供“路由鍵”。以下示例展示瞭如何定義出站閘道器

<amqp:outbound-gateway request-channel="toAMQP"
                       reply-channel="fromAMQP"
                       exchange-name="some.exchange"
                       routing-key="foo"
                       amqp-template="rabbitTemplate"/>
© . This site is unofficial and not affiliated with VMware.