I have an exchange (exchange1
) and it can be routed to n
different queues based on routing-key-expression.
and in future, the queue number can be increased like (all video and mp4 extensions should go to queue4
)
How we can create and bind queues dynamically to one particular exchange and should use only one stream Listener?
It can't be done directly with Spring Cloud Stream via properties.
You would have to declare Exchange
, Queue
and Binding
@Bean
s with the required routing keys and then configure the consumer binding to not declare the queue and binding) and then set s.c.s.consumer.multiplex=true
and s.c.s.destination=queue1,queue2,queue3
.
See Using Existing Queues/Exhanges for how to disable binder provisioning.