如何使用 Spring XDRabbit 源自动创建 rabbitmq 队列

How to auto create rabbit queue using Spring XD Rabbit source

我的流定义中有 Spring XD Rabbit 源,但是当它正在侦听的队列尚未创建时它将失败。当我使用 Spring Integration Boot 时,我可以在我的 JavaConfig 中执行此操作。

我的流定义: 流创建 --name HOLA_Q --definition "rabbit --requeue=false | my-own-processor | null" --deploy

我尝试在我自己的处理器中的 spring-module.xml 中使用 rabbit admin,但在流部署期间不起作用或被触发。

或者这个rabbit队列自动创建功能还不支持?

非常感谢

目前不支持源自动创建队列。

根据文档:

The queue(s) must exist before the stream is deployed. We do not create the queue(s) automatically. However, you can easily create a Queue using the RabbitMQ web UI. Then, using that same UI, you can navigate to the "rabbittest" Queue and publish test messages to it.

您可以创建一个自定义 rabbit 源来添加队列(以及一个可选的交换和绑定),以及一个 RabbitAdmin bean 到应用程序上下文,并且 queue/exchange/binding 将被声明。