Search code examples
rabbitmqvirtualhostamqp

How to configure RabbitMq so that multiple apps can manage their own queues and bindings to a shared exchange


We have an app that publishing to single exchange (using amqp). Additionally we have a number of apps interested in consuming messages from this exchange. To that end, they create queues and bindings from the queues to the exchange.

We would like to ensure that each app's queues and bindings can only be managed by that app and the user that the app connects with. I envisaged using virtual hosts so that the exchange sat in a /common virtual host which each app's user had read access to and each app's queues and bindings lived in their own /<app> virtual host which the user had full access to.

The documentation, however, suggests that a user cannot access more than one virtual host simultaneously within a channel and the API doesn't provide an option to specify virtual host as part of bindQueue().

Is there a way to achieve this?


Solution

  • I think to achieve what you asked you need to use federation. I have the same domain problem. One exchange and then different application consuming from different queues. If I am right the step are:

    Exchange A => federation To Exchange 1/2/3/4/... these exchange have a different vhost each other.

    create different vhost and user for different applications. Give the access to these vhost to different exchange (Exchange 1/2/3/4/)

    create different queue to bind from the different Exchange 1/2/3/4/

    Is this clear?