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
  • I should be able to specify the routing key in the consumer just like we do it in AMQP where we can pass the exchange queue and routing key to create the binding
  • I should be able to set the routing key when sending the message in producer end using MessageBuilder


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.

1 Answers

Gary Russell On Best Solutions

See the Rabbit binder documentation.

  • On the consumer side, set the bindingRoutingKey consumer binding property.
  • On the producer side, the the routingKeyExpression producer binding property (e.g. headers['routingKey'] and set that header as needed).

Also see Using Existing Queues/Exchanges.