RabbitMq Tutorials

RabbitMq Tutorials

RabbitMQ is publish-subscribe tool which is effectively used in microservices for their inter communications. RabbitMQ is an open-source message-broker software that originally implemented the Advanced Message Queuing Protocol and has since been extended with a plug-in architecture to support Streaming Text Oriented Messaging Protocol, Message Queuing Telemetry Transport, and other protocols.

1. How to install RabbitMQ in Docker Container ?

1.1 RabbitMQ – Docker pull:

docker pull rabbitmq

1.2 RabbiMQ – Docker Run:

sudo docker run --restart=always -e RABBITMQ_DEFAULT_USER='rabbitadmin' -e RABBITMQ_DEFAULT_PASS='rabbitpass' -d --name ngrabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
  • rabbitadmin is username and rabbitpass is rabbitmq password, the same should be configured wherever you need to connect to rabbitmq.
  • ngrabbitmq is the docker container name, you can debug ngrabbitmq container using
sudo docker logs ngrabbitmq

Read other useful docker comments here.

2. RabbitMQ Docker Commands:

2.1 Start Command

rabbitmqctl start

2.2 Stop Command

rabbitmqctl stop

2.3 Create a new user

rabbitmqctl add_user ngdevuser ngdevpass

ngdevuser – username and ngdevpass – password

2.4 Deleting an existing user

rabbitmqctl delete_user ngdevuser

this removes ngdevuser from rabbitmq.

2.5 Change the user password

rabbitmqctl change_password ngdevuser ngnewpass

this sets the password for ngdevuser from ngdevpass to ngnewpass

2.6 Password authentication/Login authentication command

rabbitmqctl authenticate_user ngdevuser ngnewpass

this command test whether the userid and password is correct or not.

2.7 Adding / Setting administrator access to user

rabbitmqctl set_user_tags ngdevuser administrator

2.8 Resetting / clearing administor access to user

rabbitmqctl set_user_tags ngdevuser

this resets the access to ngdevuser.

2.9 List down the users

rabbitmqctl list_users

2.9 List the queues:

rabbitmqctl list_queues

2.10 List the exchanges

rabbitmqctl list_exchanges

2.11 List the bindings

rabbitmqctl list_bindings

2.12 List the consumers

rabbitmqctl list_consumers

3. How to start rabbitmq in windows ?

Rabbitmq can be started as service by the following ways,

Generally rabbitmq is installed in the below paths,

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.17\sbin
rabbitmqctl stop
rabbitmq-server -detached
rabbitmq-plugins enable rabbitmq_management

Start and stop sometimes can be done using,

rabbitmqctl.bat start (or) rabbitmq-service.bat start

260 total views, 2 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.