boson-backend-redis
Redis QueueBackend for fleet-scale Boson deployments.
Role
Implements QueueBackend using Redis ZSET ready queues and JSON job bodies. Supports single-node and multi-broker fleet routing by logical pool.
This crate is a separate workspace dependency — not enabled via the boson facade features (mem, sqlite, postgres). Depend on it directly when you need Redis persistence.
Compose
Single Redis node:
use Arc;
use ;
use ;
let config = RedisQueueConfig ;
let backend = new;
let boson = builder
.queue_backend
.execution_context_factory
.build?;
Fleet (multiple standalone Redis nodes):
use connect_fleet_from_env;
let backend = connect_fleet_from_env.await?;
Bootstrap
use install_default_redis_backend;
use default_backend_from_global;
let _backend = install_default_redis_backend.await?;
let resolved = default_backend_from_global?;
Environment
Connection
| Variable | Default | Purpose |
|---|---|---|
BOSON_TEST_REDIS_URL |
redis://127.0.0.1:6379 |
Test URL resolution |
BOSON_BENCH_REDIS_URL |
— | Bench URL override |
BOSON_REDIS_KEY_PREFIX |
boson |
Key namespace prefix |
Fleet routing
When connecting a multi-broker fleet, URL resolution follows this precedence (first match wins):
BOSON_REDIS_POOL_ROUTING— explicit pool-to-URL mapping:pool_0=redis://host1:6379,pool_1=redis://host2:6379BOSON_REDIS_URLS— comma-separated broker URLs; pools hash tourls[i % N]
If both are set, BOSON_REDIS_POOL_ROUTING takes precedence over BOSON_REDIS_URLS.
Implementing a backend
See How to implement on QueueBackend for the full adapter contract. This crate is a reference implementation for Redis-backed persistence.
Related crates
boson-core—QueueBackendtrait definitionboson-backend-nats— NATS JetStream alternativeboson— runtime facade (usemem/sqlite/postgresfor simpler setups)