Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default queue binding in RabbitAdmin

Today, our application have a vhost, a ConnectionFactory and a RabbitAdmin followed by multiple queue and exchange declaration. Now we have a requirement where I need a new vhost, hence a ConnectionFactory & RabbitAdmin

After creating the new vhost, the problem I'm facing is, all existing queue and exchange is getting created in both vhost. To address this issue, I used declare-by="RabbitAdminName" property which I can use in both queue and exchange level. As my application is having multiple queue and exchange hence I prefer not to disturb all existing config by adding declare-by in each queue definition.

Is there a way(global config to change the default behavior) to tell rabbit that only the intended new queue will go to the new vhost/ConnectoinFactory/RabbitAdmin and not the already existing queue. Any help is highly appreciable(I'm looking for the xml way of deceleration)

By default, all queues, exchanges, and bindings are declared by all RabbitAdmin instances (that have auto-startup="true") in the application context.

Reference: spring.io

like image 920
lambodar Avatar asked May 13 '26 12:05

lambodar


1 Answers

There is currently no global setting for this; you have to configure each queue etc and set the declare-by property to limit the declaration to an explicit admin.

So you would need to do this for your old queues to only declare those queues on the old vhost.

We could add a flag to the admin to exclude any beans that do not explicitly request declaration by this admin.

Please open a new feature issue.

like image 97
Gary Russell Avatar answered May 15 '26 02:05

Gary Russell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!