kegaretail / react-native-rabbitmq

29 stars 56 forks source link

Bind to exchange without configure permissions on the server #37

Closed sators closed 3 years ago

sators commented 3 years ago

I'm having difficulties creating a queue/exchange/bind in that I do not want the client to have the capabilities of configuring the exchange. Following the documentation, I'm getting an error of ACCESS_REFUSED - access to exchange refused unless I grant config permissions to the user account on the server, which I do not want to do.

Therefore, is it possible to use new Exchange() in a way that just asserts the exchange but doesn't attempt to create or change the config of it if it already exists on the server so that it can be bound to the queue for read/write? In other words, could queue.bind() be used with an exchange that is already configured on the server and not requiring new Exchange()?

sators commented 3 years ago

For future reference, the config object on new Exchange() allows for a passive boolean property which when set to true does not require configure permissions on the server.

Thanks to the permissions grid on https://www.rabbitmq.com/access-control.html to help that out.

Example:

    let exchange = new Exchange(connection, {
        name: 'exchange_name',
        type: 'direct',
        durable: true,
        autoDelete: false,
        internal: false,
        passive: true // <--- Missing from README documentation
    });