RabbitMQ users are global to the broker instance, but each user can have his/her own set of permissions for each individual vhost.
Different applications can be totally decoupled using independent users and vhosts.
However, the same application can benefit from the usage of user permissions within the same vhost.
We are going to see how to manage users and their permissions and how to use them in the Java example in Chapter03/Recipe02
.
In order to run this recipe, we need to issue some rabbitmqctl
configuration commands and exercise the configurations using the usual Java setup.
Perform the following steps to see how to manage users and their permissions as well as how to use them:
Create some users with their passwords:
rabbitmqctl add_user stat_sender password1 rabbitmqctl add_user stat_receiver password2
Grant some permissions to them:
rabbitmqctl set_permissions stat_sender "stat_exchange.*""stat_.*" "^$" rabbitmqctl set_permissions stat_receiver "stat_...