I'm trying to connect a small Spring Cloud Stream application to two different RabbitMQ systems. For both systems, I want to bind a stream input to an existing exchange, specifying a routing key. Spring Cloud Stream can manage an anonymous queue for me to route the messages through. However, the routing keys I try to specify are ignored.
When connecting to a single system, this works as intended, an anonymous queue is created and bound to the existing exchange using the routing key I specified. But as soon as I try to connect to two systems (as per the docs), the routing keys are ignored: anonymous queues are created and bound to the exchanges, but the routing key is simply '#'.
This is my application.yaml
file:
spring:
cloud:
stream:
bindings:
function1-in-0:
binder: rabbit1
destination: existing-exchange
function2-in-0:
binder: rabbit2
destination: existing-exchange
binders:
rabbit1:
type: rabbit
default-candidate: false
inherit-environment: false
environment:
spring:
rabbitmq:
host: host1
username: ...
password: ...
virtual-host: ...
rabbit2:
type: rabbit
default-candidate: false
inherit-environment: false
environment:
spring:
rabbitmq:
host: host2
username: ...
password: ...
virtual-host: .
rabbit:
bindings:
function1-in-0:
consumer:
binding-routing-key: routing.key.1
declare-exchange: false
function2-in-0:
consumer:
binding-routing-key: routing.key.2
declare-exchange: false
function:
definition: function1;function2
I'm probably overlooking something obvious, but I don't find documentation on customising the RabbitConsumerProperties when working with multiple systems.