This repo is for educational purposes to explore RabbitMQ, Redis, and distributed task queues. Not production-ready.
- Docker and Docker Compose
- Python 3.8+
-
Clone the repository
git clone https://github.com/HzaRashid/DTQ.git cd DTQ -
Start the services
docker-compose up -d
This starts RabbitMQ and Redis services.
-
Install dependencies
pip install -r requirements.txt
-
Run the test script
python test_docker.py
from dtq.app import DTQ
# Initialize DTQ
dtq = DTQ(
broker_url="amqp://guest:guest@localhost:5672/%2F",
backend_url="redis://localhost:6379/0"
)
# Define a task
@dtq.task()
def add_numbers(a, b):
return a + b
# Enqueue a job
job_id = dtq.enqueue(add_numbers, 5, 3)
# Check status
status = dtq.get_status(job_id)
# Get result
result = dtq.get_result(job_id)