[英]Use an existing queue with Spring AMQP
I'm trying to write a Java Spring Boot application using AMQP to talk to a RabbitMQ server. 我正在尝试使用AMQP编写Java Spring Boot应用程序以与RabbitMQ服务器通信。 I have to use existing queues and exchanges and do not have the rights to declare them myself (nor do I want to).
我必须使用现有的队列和交换,无权自己声明它们(我也不想)。 The problem is that I cannot keep the Spring Integrations from trying to declare the queue in RabbitMQ, which returns an error.
问题是我无法阻止Spring Integrations尝试在RabbitMQ中声明队列,这会返回错误。
Here's a screenshot of the message sent from Wireshark: 这是Wireshark发送的消息的屏幕截图:
Wireshark screenshot Wireshark屏幕截图
My main class is annotated with the @EnableBindings(Sink.class) annotation. 我的主类带有@EnableBindings(Sink.class)批注。
Here's the relevant part of my application.properties: 这是我的application.properties的相关部分:
spring.cloud.stream.bindings.input.group=********************.instana.test spring.cloud.stream.rabbit.bindings.input.consumer.bind-queue=false spring.cloud.stream.rabbit.bindings.input.consumer.queue-name-group-only=true spring.cloud.stream.rabbit.bindings.input.consumer.declare-exchange=false spring.cloud.stream.rabbit.bindings.input.consumer.durable-subscription=false spring.cloud.stream.rabbit.bindings.input.consumer.exclusive=true
spring.cloud.stream.bindings.input.group = ********************。instana.test spring.cloud.stream.rabbit.bindings.input.consumer。 bind-queue = false spring.cloud.stream.rabbit.bindings.input.consumer.queue-name-group-only = true spring.cloud.stream.rabbit.bindings.input.consumer.declare-exchange = false spring.cloud .stream.rabbit.bindings.input.consumer.durable-subscription = false spring.cloud.stream.rabbit.bindings.input.consumer.exclusive = true
Note: I do NOT want to use the RabbitMQ specific implementations of Spring, but rather the Spring cloud stream solutions instead. 注意:我不想使用Spring的RabbitMQ特定实现,而是使用Spring云流解决方案。
There's currently no way to prevent the attempt to declare the queue; 当前无法阻止声明队列的尝试。 but you can simply ignore the error.
但您可以简单地忽略该错误。
https://github.com/spring-cloud/spring-cloud-stream-binder-rabbit/issues/184 https://github.com/spring-cloud/spring-cloud-stream-binder-rabbit/issues/184
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.