Skip to content

DistCodeP7/distcode_worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Backend

Quick Start

  1. Start RabbitMQ server:
docker run -d --name rabbitmq \
  -p 5672:5672 -p 15672:15672 \
  rabbitmq:management
  1. Run go application:
go run main.go
  1. 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 Go application

  1. Run the application run:
go run main.go
  1. Run tests:
go test ./...

Setup docker environment with RabbitMQ

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

Python Message Queue script

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.

  1. Setup venv and install dependencies: From the python_testing directory run:

    python3 -m venv venv
    source venv/bin/activate
    pip install pika
  2. Run the script to publish messages:

    python producer.py