- Start RabbitMQ server:
docker run -d --name rabbitmq \
-p 5672:5672 -p 15672:15672 \
rabbitmq:management
- Run go application:
go run main.go
- Test the message queue using Python:
cd python_testing
python3 -m venv venv
source venv/bin/activate
pip install pika
python producer.py
- Run the application run:
go run main.go
- Run tests:
go test ./...
To set up a RabbitMQ server using Docker, you can use the following command to pull and run the RabbitMQ image with the management plugin:
docker run -d --name rabbitmq \
-p 5672:5672 -p 15672:15672 \
rabbitmq:management
In order to test the worker you can publish some code messages to the RabbitMQ queue using the provided Python script. Make sure you have Python and the pika
library installed.
-
Setup venv and install dependencies: From the python_testing directory run:
python3 -m venv venv source venv/bin/activate pip install pika
-
Run the script to publish messages:
python producer.py