Skip to content

Repository files navigation

Go-Backend

Getting Started

  1. Start RabbitMQ server from the docker-compose repo:

    git clone https://github.com/DistCodeP7/docker-compose.git docker-compose
    cd docker-compose
    docker-compose up -d
  2. Run go application with the database URL environment variable:

    DB_URL="..." go run main.go
  3. Test the message queue using Python:

Linux

cd python_testing
python3 -m venv venv
source venv/bin/activate
pip install pika
python producer.py

Windows

cd python_testing
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install pika
python producer.py

Run the Go application

  1. Run go application with the database URL environment variable:
DB_URL="..." go run main.go
  1. Run tests:

    go test ./...

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 monitor messages:

    python consumer.py
  3. Run the script to publish messages:

    python producer.py

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages