Reputation: 389
Configuring multiple queues with a topic exchange and using routing key to direct the message specific queue with spring cloud streams
My requirement is example I have the queues and exchange defined as below in consumer end
spring.cloud.stream.bindings.inputA.destination=Common-Exchange
spring.cloud.stream.bindings.inputA.group=A-Queue
spring.cloud.stream.bindings.inputB.destination=Common-Exchange
spring.cloud.stream.bindings.inputB.group=B-Queue
I should be able to set the routing key when sending the message in producer end using MessageBuilder
channel.send(MessageBuilder.withPayload(message).build())
Of course we can use one queue and use headers to direct different type of messages but I need to know how multiple queue connected to a single exchange work with streams.
Upvotes: 0
Views: 1941
Reputation: 174554
See the Rabbit binder documentation.
bindingRoutingKey
consumer binding property.routingKeyExpression
producer binding property (e.g. headers['routingKey']
and set that header as needed).Also see Using Existing Queues/Exchanges.
Upvotes: 3