跳到主要内容

AMQP 示例

QWen Plus 中英对照 AMQP Samples

要试验 AMQP 适配器,可以查看位于 https://github.com/spring-projects/spring-integration-samples 的 Spring Integration 示例 git 仓库中的示例。

目前,一个示例通过使用 outbound channel adapter 和 inbound channel adapter 展示了 Spring Integration AMQP 适配器的基本功能。作为 AMQP 经纪人实现,示例中使用了 RabbitMQ

备注

为了运行示例,你需要一个正在运行的 RabbitMQ 实例。仅具有基本默认设置的本地安装就足够了。有关详细的 RabbitMQ 安装步骤,请参阅 https://www.rabbitmq.com/install.html

一旦示例应用程序启动,在命令提示符下输入一些文本,包含所输入文本的消息将被发送到 AMQP 队列。作为响应,该消息由 Spring Integration 检索并打印到控制台。

下图说明了本示例中使用的基本 Spring Integration 组件:

spring integration amqp sample graph

图 1. AMQP 示例的 Spring Integration 图