Reputation: 40618
I'm using Spring Boot 2.0.1 and the Spring cloud dependencies are imported from:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.RC1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
I believe that the dependencies of interest are these:
<dependencies>
...
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-reactive</artifactId>
</dependency>
...
</dependencies>
In my application.yaml
I've added multiple consumer bindings:
spring:
cloud:
stream:
bindings:
input1:
bindingRoutingKey: key1.#
binder: rabbit
group: group1
destination: dest-group1
transacted: true
input2:
bindingRoutingKey: key2.#
binder: rabbit
group: group2
destination: dest-group2
transacted: true
I've read for example here that one should add requiredGroups
to the producer(s) in order to create the queues and bindings automatically. However my application doesn't produce any messages, it just consumes messages published by other application so I don't have any producers defined. I've tried to modify the application.yaml
file to just add a dummy producer:
spring:
cloud:
stream:
bindings:
dummyProducer:
producer:
requiredGroups: group1,group2
input1:
bindingRoutingKey: key1.#
binder: rabbit
group: group1
destination: dest-group1
transacted: true
input2:
bindingRoutingKey: key2.#
binder: rabbit
group: group2
destination: dest-group2
transacted: true
But this doesn't work. So my question is:
How should I modify my application.yaml
file (and possible the code if required) to make the Spring Cloud stream create the queues and bindings on startup?
Upvotes: 0
Views: 1491
Reputation: 174769
We normally only provision the exchange on the producer side; we don't provision queues unless required-groups
is set.
On the consumer side, we always provision queues (and the exchange).
If that is not happening, something else is wrong; do you have @EnableBinding
?
Show your application code.
Upvotes: 1