RRQ is a library for creating reliable job queues using Rust, Redis. with language-agnostic producers and workers.
Project description
RRQ: Reliable Redis Queue
RRQ is a distributed job queue that actually works. It combines a Rust-powered orchestrator with language-native workers to give you the reliability of battle-tested infrastructure with the flexibility of writing job handlers in Python, TypeScript, or Rust.
Why RRQ?
Most job queues make you choose: either fight with complex distributed systems concepts, or accept unreliable "good enough" solutions. RRQ takes a different approach:
-
Rust orchestrator, any-language workers - The hard parts (scheduling, retries, locking, timeouts) are handled by a single-binary Rust process. Your job handlers are just normal async functions in your preferred language.
-
Redis as the source of truth - No separate databases to manage. Jobs, queues, locks, and results all live in Redis with atomic operations and predictable semantics.
-
Production-grade features built in - Retry policies, dead letter queues, job timeouts, cron scheduling, distributed tracing, and health checks work out of the box.
-
Fast and lightweight - The Rust orchestrator handles thousands of jobs per second with minimal memory. Workers are isolated processes that can be scaled independently.
How It Works
┌──────────────────────────────┐
│ Your Application │
│ (Python, TypeScript, Rust) │
│ │
│ client.enqueue("job", {...}) │
└───────────────┬──────────────┘
│ enqueue jobs
▼
┌───────────────────────┐
│ Redis │
│ queues, jobs, locks │
└──────────┬────────────┘
│ poll/dispatch
▼
┌──────────────────────────────┐
│ RRQ Orchestrator │
│ (single Rust binary) │
│ • scheduling & retries │
│ • timeouts & deadlines │
│ • dead letter queue │
│ • cron jobs │
└──────────┬───────────────────┘
│ socket protocol
▼
┌─────────────────────────────────────────┐
│ Job Runners │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Python │ │ TypeScript │ │
│ │ Worker │ │ Worker │ │
│ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────┘
This Package
This Python package (rrq) gives you everything you need to work with RRQ from Python:
- Producer client - Enqueue jobs from your Python application
- Runner runtime - Execute job handlers written in Python
- OpenTelemetry integration - Distributed tracing from producer to runner
The Rust orchestrator binary is bundled in the wheel, so there's nothing else to install.
Quick Start
1. Install
pip install rrq
# or
uv pip install rrq
2. Create configuration (rrq.toml)
[rrq]
redis_dsn = "redis://localhost:6379/0"
default_runner_name = "python"
[rrq.runners.python]
type = "socket"
cmd = ["rrq-runner", "--settings", "myapp.runner:settings"]
tcp_socket = "127.0.0.1:9000"
3. Write a job handler
# myapp/handlers.py
from rrq.runner import ExecutionRequest
async def send_welcome_email(request: ExecutionRequest):
user_email = request.params.get("email")
template = request.params.get("template", "welcome")
# Your email sending logic here
await send_email(to=user_email, template=template)
return {"sent": True, "email": user_email}
4. Register handlers
# myapp/runner.py
from rrq.runner_settings import PythonRunnerSettings
from rrq.registry import Registry
from myapp import handlers
registry = Registry()
registry.register("send_welcome_email", handlers.send_welcome_email)
settings = PythonRunnerSettings(registry=registry)
5. Start the system
# Terminal 1: Start the orchestrator (runs runners automatically)
rrq worker run --config rrq.toml
# That's it! The orchestrator spawns and manages your Python runners.
6. Enqueue jobs
import asyncio
from rrq.client import RRQClient
async def main():
client = RRQClient(config_path="rrq.toml")
job_id = await client.enqueue(
"send_welcome_email",
{
"params": {
"email": "user@example.com",
"template": "welcome",
}
},
)
print(f"Enqueued job: {job_id}")
await client.close()
asyncio.run(main())
Features
Scheduled Jobs
Delay job execution:
# Run in 5 minutes
await client.enqueue("cleanup", {"defer_by_seconds": 300})
# Run at a specific time
from datetime import datetime, timezone
await client.enqueue(
"report",
{"defer_until": datetime(2024, 1, 1, 9, 0, tzinfo=timezone.utc)},
)
Unique Jobs (Idempotency)
Prevent duplicate jobs:
# Only one job with this key will be enqueued
await client.enqueue_with_unique_key(
"process_order",
"order-123",
{"params": {"order_id": "123"}},
)
Rate Limiting
Limit how often a job can run:
job_id = await client.enqueue_with_rate_limit(
"sync_user",
{
"params": {"user_id": "456"},
"rate_limit_key": "user-456",
"rate_limit_seconds": 60,
},
)
if job_id is None:
print("Rate limited, try again later")
Debouncing
Delay and deduplicate rapid job submissions:
# Only the last enqueue within the window will execute
await client.enqueue_with_debounce(
"save_document",
{
"params": {"doc_id": "789"},
"debounce_key": "doc-789",
"debounce_seconds": 5,
},
)
Cron Jobs
Schedule recurring jobs in rrq.toml:
[[rrq.cron_jobs]]
function_name = "daily_report"
schedule = "0 0 9 * * *" # 9 AM daily (6-field cron with seconds)
queue_name = "scheduled"
Job Status
Check job progress:
status = await client.get_job_status(job_id)
print(f"Status: {status}")
OpenTelemetry
Enable distributed tracing:
from rrq.integrations import otel
otel.enable(service_name="my-service")
Traces propagate from producer → orchestrator → runner automatically.
Configuration Reference
See docs/CONFIG_REFERENCE.md for the full TOML schema.
Key settings:
[rrq]
redis_dsn = "redis://localhost:6379/0"
default_runner_name = "python"
default_job_timeout_seconds = 300 # 5 minutes
default_max_retries = 3
[rrq.runners.python]
type = "socket"
cmd = ["rrq-runner", "--settings", "myapp.runner:settings"]
tcp_socket = "127.0.0.1:9000"
pool_size = 4 # Number of runner processes
max_in_flight = 10 # Concurrent jobs per runner
Related Packages
| Package | Language | Purpose |
|---|---|---|
| rrq | Python | Producer client + runner (this package) |
| rrq-ts | TypeScript | Producer client + runner |
| rrq | Rust | Orchestrator binary |
| rrq-producer | Rust | Native producer client |
| rrq-runner | Rust | Native runner runtime |
Requirements
- Python 3.11+
- Redis 5.0+
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rrq-0.9.14-py3-none-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: rrq-0.9.14-py3-none-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 7.7 MB
- Tags: Python 3, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fcdb8c5c3d99eda04843f33d06d50eda56722d5ffafbfe354af5af85bb5d71b
|
|
| MD5 |
42c62e8c5be51f6b932be6f625ccdc5d
|
|
| BLAKE2b-256 |
8b1b64152bd131bdcca5e80ddb1f41f4b98228fcb38a06fbd1d7dd7641d40c92
|
Provenance
The following attestation bundles were made for rrq-0.9.14-py3-none-manylinux_2_35_x86_64.whl:
Publisher:
release.yml on GetResQ/rrq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rrq-0.9.14-py3-none-manylinux_2_35_x86_64.whl -
Subject digest:
2fcdb8c5c3d99eda04843f33d06d50eda56722d5ffafbfe354af5af85bb5d71b - Sigstore transparency entry: 913036653
- Sigstore integration time:
-
Permalink:
GetResQ/rrq@815b32b96bb19c8cc66cfd4640a4a824ba14e1a7 -
Branch / Tag:
refs/tags/v0.9.14 - Owner: https://github.com/GetResQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@815b32b96bb19c8cc66cfd4640a4a824ba14e1a7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rrq-0.9.14-py3-none-manylinux_2_35_aarch64.whl.
File metadata
- Download URL: rrq-0.9.14-py3-none-manylinux_2_35_aarch64.whl
- Upload date:
- Size: 7.6 MB
- Tags: Python 3, manylinux: glibc 2.35+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bff4c5a54f3f149eeb9809ab7d41be055ef84e1bcc6fdc0388ed0285e20d152
|
|
| MD5 |
1bb195b671d56c18d4aba86d4fb743ae
|
|
| BLAKE2b-256 |
5526441655c5b26c7588980e63b527b755979376ee144a48820205862496153c
|
Provenance
The following attestation bundles were made for rrq-0.9.14-py3-none-manylinux_2_35_aarch64.whl:
Publisher:
release.yml on GetResQ/rrq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rrq-0.9.14-py3-none-manylinux_2_35_aarch64.whl -
Subject digest:
5bff4c5a54f3f149eeb9809ab7d41be055ef84e1bcc6fdc0388ed0285e20d152 - Sigstore transparency entry: 913036609
- Sigstore integration time:
-
Permalink:
GetResQ/rrq@815b32b96bb19c8cc66cfd4640a4a824ba14e1a7 -
Branch / Tag:
refs/tags/v0.9.14 - Owner: https://github.com/GetResQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@815b32b96bb19c8cc66cfd4640a4a824ba14e1a7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rrq-0.9.14-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: rrq-0.9.14-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 7.5 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4f1e55c8fc6f486719efb893ca7ec5e8ff4cb7f0065071560e6596afd35b403
|
|
| MD5 |
a5f6f5e7b11cdbe58c42c0783db32974
|
|
| BLAKE2b-256 |
b8f8ea44010f318be01fa13d2deb5f831fdb4fdf109af06341da708be55f9c84
|
Provenance
The following attestation bundles were made for rrq-0.9.14-py3-none-macosx_11_0_arm64.whl:
Publisher:
release.yml on GetResQ/rrq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rrq-0.9.14-py3-none-macosx_11_0_arm64.whl -
Subject digest:
f4f1e55c8fc6f486719efb893ca7ec5e8ff4cb7f0065071560e6596afd35b403 - Sigstore transparency entry: 913036708
- Sigstore integration time:
-
Permalink:
GetResQ/rrq@815b32b96bb19c8cc66cfd4640a4a824ba14e1a7 -
Branch / Tag:
refs/tags/v0.9.14 - Owner: https://github.com/GetResQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@815b32b96bb19c8cc66cfd4640a4a824ba14e1a7 -
Trigger Event:
push
-
Statement type: