简体   繁体   中英

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. 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.

Here's a screenshot of the message sent from Wireshark:

Wireshark screenshot

My main class is annotated with the @EnableBindings(Sink.class) annotation.

Here's the relevant part of my 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

Note: I do NOT want to use the RabbitMQ specific implementations of Spring, but rather the Spring cloud stream solutions instead.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM