To set up RabbitMQ on your local machine, the easiest way is to run it using the official Docker image.
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.12-management- Port 5672: Enables AMQP connections.
- Port 15672: Hosts the Admin UI and management UI.
Use RabbitMQCLI to create a new user. The command syntax is add_user [username] [password].
docker exec rabbitmq rabbitmqctl add_user srrathi 12345678For admin access, add the administrator tag to the new user.
docker exec rabbitmq rabbitmqctl set_user_tags srrathi administratorRemove the default guest user for security.
docker exec rabbitmq rabbitmqctl delete_user guestCreate a virtual host (vhost) using the add_vhost command.
docker exec rabbitmq rabbitmqctl add_vhost jobsAdd permissions to the user for the created vhost using the set_permissions command.
docker exec rabbitmq rabbitmqctl set_permissions -p jobs srrathi ".*" ".*" ".*"Create an exchange named jobs_events within the vhost. Specify the vhost, username, and password of the administrator. Use the durable=true flag to persist restarts.
docker exec rabbitmq rabbitmqadmin declare exchange --vhost=jobs name=jobs_events type=topic -u srrathi -p 12345678 durable=trueGive the user permission to send on this exchange. Set permissions on a specific topic using the set_topic_permissions command.
docker exec rabbitmq rabbitmqctl set_topic_permissions -p jobs srrathi jobs_events "^jobs.*" "^jobs.*"
Restart RabbitMQ to apply changes.
docker restart rabbitmqThis completes the setup of RabbitMQ with user creation, virtual host, and exchange configuration. Move on to the next steps for setting up PostgreSQL, dumping CSV data, configuring endpoints, and Postman requests.