I have one listener method annotated with @RabbitListener
currently its configured to listen from 1 rabbit cluster. Now i have another rabbit cluster(cluster2) having the same queue/exchange/routing key defined and can possibly publish message.
Is there a way to use the same listener method to listen from both clusters? As a listener i dont care from which cluster the message came from and i would like to do the same processing for both.
// Config
@Bean
@ConfigurationProperties("cluster1.rabbitmq")
public RabbitProperties rabbitProps() {
return new RabbitProperties();
}
// Listener code
@RabbitListener(id = "My App", bindings = @QueueBinding(value = @Queue(value = "Some_Queue_Name"),
exchange = @Exchange(value = "Some_Exchange_Name"),
key = "Some_Routing_Key"))
public void onMessage(final Message message) {
// ....
}
My application.yml
has the below configs defined
cluster1.rabbitmq.host
cluster1.rabbitmq.username
cluster1.rabbitmq.password