Skip to content

Basic example to use RabbitMQ in Python and deploy via Docker

Notifications You must be signed in to change notification settings

deepshig/rabbitmq-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RabbitMQ implementation in Python using Docker

This is a basic example to implement RabbitMQ in Python, and deploy using Docker.

It uses pika in python to connect to RabbitMQ.

Producer producer a 100 messages of text Hello World to the queue

Consumer consumes these messages, prints them and sleeps for 2 seconds before acking each of them.

We have used docker to run the program. Docker Compose has been used to spawn the multiple containers needed. We spawn one container each for RabbitMQ and producer, while 2 containers for consumer. This to exhibit parallel consumption from the same queue.

Dependencies

Run the program

  • To run docker-compose up

  • To clean up docker-compose down -v --rmi all --remove-orphans

  • We can run separate container by docker-compose up producer and so on

  • While the containers are running, we can monitor the queue on the dashboard http://localhost:15672/ with [Username/Password] as [guest/guest]

Releases

No releases published

Packages

No packages published