rrq-runner
Rust runtime for building RRQ job handlers. Write your job handlers in Rust and let this crate handle the socket protocol, connection management, and job dispatching.
What is RRQ?
RRQ (Reliable Redis Queue) is a distributed job queue with a Rust orchestrator and language-flexible workers. This crate lets you build high-performance job handlers in Rust that connect to the RRQ orchestrator.
Why Rust runners?
- Maximum performance - Native code for CPU-intensive tasks
- Memory safety - No GC pauses, predictable latency
- Async native - Built on Tokio for efficient concurrency
- Same ecosystem - Use Rust crates in your job handlers
Installation
[]
= "0.9"
With OpenTelemetry:
[]
= { = "0.9", = ["otel"] }
Quick Start
use ;
use json;
Handler Functions
Handlers receive an ExecutionRequest and return an ExecutionOutcome:
registry.register;
Outcome Types
// Success
success
// Failure (may be retried)
failure
// Retry after delay
retry_after
// Timeout
timeout
// Cancelled
cancelled
OpenTelemetry
use ;
use ;
Configure via:
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT- Traces endpoint (highest precedence)OTEL_EXPORTER_OTLP_METRICS_ENDPOINT- Metrics endpoint (highest precedence)OTEL_EXPORTER_OTLP_LOGS_ENDPOINT- Logs endpoint (highest precedence)OTEL_EXPORTER_OTLP_ENDPOINT- Fallback base OTLP/HTTP endpoint (for examplehttp://127.0.0.1:4318)OTEL_EXPORTER_OTLP_HEADERSandOTEL_EXPORTER_OTLP_{TRACES|METRICS|LOGS}_HEADERS- Comma-separatedkey=valueheadersOTEL_SERVICE_NAME- Service name
Endpoint resolution rules:
- Signal-specific endpoint vars take precedence over
OTEL_EXPORTER_OTLP_ENDPOINT - If a signal-specific endpoint is unset, RRQ falls back to
OTEL_EXPORTER_OTLP_ENDPOINTand appends/v1/{traces|metrics|logs} - If a signal-specific endpoint is explicitly set to an empty value, that signal is disabled (no fallback)
Configuration
Add your runner to rrq.toml:
[]
= "socket"
= ["./target/release/my-runner"]
= "127.0.0.1:9000"
= 4
= 10
Related Crates
| Crate | Purpose |
|---|---|
rrq |
Orchestrator |
rrq-producer |
Enqueue jobs |
rrq-protocol |
Wire protocol |
License
Apache-2.0