A distributed task queue system built with Go, using Redis and Asynq for reliable background job processing.
- RESTful API - HTTP API for task management (create, query, cancel, delete)
- Distributed Workers - Scalable worker pool with configurable concurrency
- Priority Queues - Support for critical, high, default, and low priority queues
- Scheduled Tasks - Schedule tasks for future execution
- Task Deduplication - Unique task constraints to prevent duplicate processing
- Retry Mechanism - Automatic retry with configurable max retries
- Observability - Built-in Prometheus metrics and structured logging
- Health Checks - Health, readiness, and liveness endpoints
- Go 1.21+
- Redis 6.0+
- Docker (optional)
# Clone the repository
git clone https://github.com/Aixtrade/TaskFlow.git
cd TaskFlow
# Install dependencies
make deps
# Build binaries
make build# Start Redis
make redis-up
# Or use Docker Compose for full stack
make docker-up- Start Redis:
make redis-up- Start the API server:
make run-api- Start the Worker server (in another terminal):
make run-servercurl -X POST http://localhost:8080/api/v1/tasks \
-H "Content-Type: application/json" \
-d '{
"type": "demo",
"payload": {
"message": "Hello, TaskFlow!",
"count": 3
}
}'TaskFlow/
├── cmd/
│ ├── api/ # API server entry point
│ └── server/ # Worker server entry point
├── configs/ # Configuration files
├── deployments/ # Docker and deployment files
├── docs/ # Documentation
├── internal/
│ ├── application/ # Application services (CQRS)
│ ├── config/ # Configuration loading
│ ├── domain/ # Domain entities and interfaces
│ ├── infrastructure/# External dependencies (Redis, Asynq)
│ ├── interfaces/ # HTTP handlers and DTOs
│ └── worker/ # Task handlers and registry
└── pkg/
├── errors/ # Common error types
├── payload/ # Task payload definitions
└── tasktype/ # Task type constants
TaskFlow uses YAML configuration with environment variable overrides:
app:
name: taskflow
env: production
server:
http:
host: 0.0.0.0
port: 8080
worker:
concurrency: 10
redis:
addr: localhost:6379
password: ""
db: 0
queues:
critical: 10
high: 5
default: 3
low: 1Environment variables use the TASKFLOW_ prefix:
TASKFLOW_REDIS_ADDRTASKFLOW_SERVER_HTTP_PORT- etc.
- Architecture - System design and components
- API Reference - REST API documentation
- Creating Tasks - Guide to creating custom tasks
# Run tests
make test
# Run tests with coverage
make test-coverage
# Run linter
make lint
# Clean build artifacts
make clean- Metrics: Available at
/metrics(Prometheus format) - Health Check:
GET /health - Readiness Check:
GET /ready - Liveness Check:
GET /live - Asynqmon UI:
make asynqmonto start the web dashboard
MIT License