Hi,
I have a requirement to bind my queues to exchanges with multiple routing keys. Currently I have defined binding as spring bean, like :
Code:@Bean public Binding testBinding() { return BindingBuilder.bind(testQueue()).to(testExchange()).with("testRoutingKey1"); }
Question 1: How can I bind my exchange and queue with multiple routing keys? Like I want to add testRoutingKey2, testRoutingKey3 and testRoutingKey4
Question 2: How can I create bindings dynamically? For example I have 4 routing keys that binds my exchange and queue, and now I want to add 2 more routing keys between this exchange and queue dynamically.
If I am not wrong it can be achieved by AmqpAdmin/RabbitAdmin but I am not sure how to do it, any example?
I saw the logic of initialize() method of RabbitAdmin class and found that it looks for AMQP entities (Exchanges, Queues and Bindings) in ApplicationContext and then creates them on broker. This initialize() method gets called every time a connection is created. It makes me think that my bindings (dynamically created bindings) should be present in ApplicationContext for the logic under initialize() to create them on broker.
Thanks


Reply With Quote