I have a Spring Cloud Stream application what using the RabbitMQ binder to consume messages (it doesn't produce any). The application.yaml
file looks like this:
spring:
cloud:
stream:
rabbit:
bindings:
x:
consumer:
bindingRoutingKey: x.z.#
queueNameGroupOnly: true
y:
consumer:
bindingRoutingKey: y.z.#
queueNameGroupOnly: true
bindings:
x:
binder: rabbit
group: q1
destination: x
y:
binder: rabbit
group: q2
destination: y
This will create two queues in RabbitMQ:
q1
that is bound to exchangex
with routing keyx.z.#
q2
that is bound to exchangey
with routing keyy.z.#
I'd like to create a single queue that consumes from multiple exchanges and routing keys. I know that I can't bind an exchange to multiple routing keys from application.yaml
(see this SO question) and thus I suspect that I can't configure Spring Cloud Stream to use multiple destinations (exchanges) for a single binding.
So my question is, can I programmatically declare so that one binding
consumes from multiple exchanges? Is there anything that is required to be retained in the application.yaml
file if doing this?
How should I go about?