RRQ
The orchestrator for RRQ, a distributed job queue that combines Rust reliability with language-flexible workers.
What is RRQ?
RRQ (Reliable Redis Queue) separates the hard parts of distributed job processing—scheduling, retries, locking, timeouts—into a single Rust binary. Your job handlers can be written in Python, TypeScript, or Rust, running as isolated processes managed by the orchestrator.
Why choose RRQ?
- Write handlers in any language - Python, TypeScript, or Rust workers connect via socket protocol
- Redis-native - Atomic operations, predictable semantics, no separate database to manage
- Battle-tested Rust core - The complex distributed systems logic runs in optimized Rust
- Production features included - Retries, DLQ, timeouts, cron scheduling, health checks, distributed tracing
Installation
Or add to your Cargo.toml:
[]
= "0.9"
Quick Start
1. Create configuration (rrq.toml)
[]
= "redis://localhost:6379/0"
= "python"
[]
= "socket"
= ["rrq-runner", "--settings", "myapp.runner:settings"]
= "127.0.0.1:9000"
= 4
= 10
2. Start the worker
The orchestrator spawns runner processes, polls Redis for jobs, dispatches work, handles retries, and manages the entire lifecycle.
3. Enqueue jobs
Use the rrq-producer crate for Rust, or the Python/TypeScript clients:
use Producer;
let producer = new.await?;
let job_id = producer.enqueue.await?;
CLI Commands
Worker
# Production mode
# Watch mode (restarts on file changes)
# Burst mode (exit when queue empty)
Queues
Jobs
Dead Letter Queue
Health
Configuration Reference
[]
= "redis://localhost:6379/0" # Required
= "python"
= 300
= 3
= 60
= 5.0
= false
[]
= "socket"
= ["rrq-runner", "--settings", "myapp.runner:settings"]
= "127.0.0.1:9000"
= 4 # Runner processes
= 10 # Concurrent jobs per runner
= "/app" # Working directory (optional)
[]
= "/app" # Environment variables (optional)
# Cancellation behavior:
# - Pending jobs: deterministic cancellation (`rrq job cancel`)
# - In-flight jobs: shutdown/timeout enforcement is process lifecycle based
# (Rust orchestrator handles TERM -> grace -> KILL on Unix)
# - Cancel hints to runners are optional and disabled by default
# Cron jobs
[[]]
= "daily_cleanup"
= "0 0 9 * * *" # 6-field cron (with seconds)
= "maintenance"
# Watch mode settings
[]
= "."
= ["*.py", "*.toml"]
= [".venv/**", "dist/**"]
#
# Optional build steps (useful for compiled handlers/runners):
# - Each entry is an argv array.
# - If any command fails, the worker remains stopped until the next change.
= [["cargo", "build"]]
= "."
Architecture
┌─────────────────────────────────────────────────────────────┐
│ RRQ Orchestrator │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Worker │ │ Worker │ │ Cron Scheduler │ │
│ │ Loop │ │ Loop │ │ │ │
│ └──────┬──────┘ └──────┬──────┘ └──────────┬──────────┘ │
│ │ │ │ │
│ └────────────────┼────────────────────┘ │
│ │ │
│ ┌───────▼───────┐ │
│ │ Redis Store │ │
│ └───────┬───────┘ │
│ │ │
│ ┌───────────┴───────────┐ │
│ │ │ │
│ ┌───────▼───────┐ ┌───────▼───────┐ │
│ │ Runner Pool │ │ Runner Pool │ │
│ │ (Python) │ │ (Node) │ │
│ └───────────────┘ └───────────────┘ │
└─────────────────────────────────────────────────────────────┘
Environment Variables
| Variable | Description |
|---|---|
RRQ_CONFIG |
Path to configuration file |
RRQ_REDIS_DSN |
Redis connection (overrides config) |
RUST_LOG |
Log filter/level (e.g. info, debug) |
RUST_LOG_FORMAT |
Log output format: json (default) or pretty |
Related Crates
| Crate | Purpose |
|---|---|
rrq-producer |
Enqueue jobs from Rust |
rrq-runner |
Build Rust job handlers |
rrq-protocol |
Wire protocol types |
rrq-config |
Configuration types |
Cross-Language Compatibility
The orchestrator works seamlessly with:
- Python workers via rrq
- TypeScript workers via rrq-ts
- Rust workers via rrq-runner
All use the same Redis schema and socket protocol.
License
Apache-2.0