spring-cloud / spring-cloud/spring-cloud-stream
RabbitMQ: Queue not getting declared for one of the fanout queues
@olegz is already working on this.
Since Apr 16, 2025.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 646
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 8
Description
Hi there, I am facing an issue with consumer declaration in the rabbitMQ fanout design, please take a look below details and let me know if there is any fix for this, thanks in advance.
I have the following configs for a fanout implementation:
Producer
spring.cloud.stream.bindings.sendUpdate-out-0.destination: update.v1.send-event
spring.cloud.stream.rabbit.bindings.sendUpdate-out-0.producer.exchange-type: fanout
consumer in service A
spring.cloud.stream.bindings.onABCUpdate-in-0.destination: update.v1.send-event
spring.cloud.stream.bindings.onABCUpdate-in-0.group: mail
spring.cloud.stream.rabbit.bindings.onABCUpdate-in-0.consumer.exchange-type: fanout
spring.cloud.stream.rabbit.bindings.onABCUpdate-in-0.consumer.dlqName: update.v1.send-event.mail.dlq
spring.cloud.stream.rabbit.bindings.onABCUpdate-in-0.consumer.auto-bind-dlq: true
spring.cloud.stream.rabbit.bindings.onABCUpdate-in-0.consumer.republishToDlq: true
#consumer in service B
spring.cloud.stream.bindings.onXYZUpdate-in-0.destination: update.v1.send-event
spring.cloud.stream.bindings.onXYZUpdate-in-0.group: sms
spring.cloud.stream.rabbit.bindings.onXYZUpdate-in-0.consumer.exchange-type: fanout
spring.cloud.stream.rabbit.bindings.onXYZUpdate-in-0.consumer.dlqName: .update.v1.send-event.sms.dlq
spring.cloud.stream.rabbit.bindings.onXYZUpdate-in-0.consumer.auto-bind-dlq: true
spring.cloud.stream.rabbit.bindings.onXYZUpdate-in-0.consumer.republishToDlq: true
`
The consumer in service A is working fine and it is the only consumer in that service. However, the consumer in B is not working and exists with two other consumers related to different functionality. To add service-B's queue to the fanout exchange I had to add the following config, which was is required in any other consumers we are having.
spring.cloud.stream.input-bindings:onXYZUpdate;
The consumer declaration is as follows:
@Bean public Consumer<TestMessage> onXYZUpdate(Strategy strategy) { return message -> { try { strategy.execute(message); } catch (Exception e) { LOG.error(e.getMessage(), e); } }; }
All the consumer declarations and the configs are similar, but an inbound queue is not getting declared for this consumer. I know that because the other two consumers in the service are logging the below log lines, but this one doesn't.
20:46:23.352 [main] [MEMBER_ID: ] [USER_ID: ] [] INFO RabbitExchangeQueueProvisioner.doProvisionConsumerDestination: [line:243] - declaring queue for inbound: <bindingName>.<group name>, bound to: <destination>
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.