Expand description
Redis result backend for CeleRS
This crate provides Redis-based storage for task results, workflow state, and real-time event transport.
§Features
- Task result storage
- Task progress tracking for long-running tasks
- Chord state management (barrier synchronization)
- Result expiration (TTL)
- Atomic operations for counter-based workflows
- Batch operations for high throughput
- Real-time event transport via Redis pub/sub
§Progress Tracking Example
use celers_backend_redis::{RedisResultBackend, ResultBackend, ProgressInfo};
use uuid::Uuid;
let mut backend = RedisResultBackend::new("redis://localhost")?;
let task_id = Uuid::new_v4();
// Report progress during task execution
let progress = ProgressInfo::new(50, 100)
.with_message("Processing items...".to_string());
backend.set_progress(task_id, progress).await?;
// Query progress from client
if let Some(progress) = backend.get_progress(task_id).await? {
println!("Task {}% complete", progress.percent);
}§Event Transport Example
use celers_backend_redis::event_transport::{RedisEventEmitter, RedisEventReceiver};
use celers_core::event::{EventEmitter, WorkerEventBuilder};
// Publishing events
let emitter = RedisEventEmitter::new("redis://localhost")?;
let event = WorkerEventBuilder::new("worker-1").online();
emitter.emit(event).await?;
// Receiving events
let receiver = RedisEventReceiver::new("redis://localhost")?;
// Subscribe and process events...Re-exports§
pub use types::BackendError;pub use types::ChordState;pub use types::ProgressInfo;pub use types::Result;pub use types::TaskMeta;pub use types::TaskResult;pub use types::TaskTtlConfig;pub use result_backend_trait::LazyTaskResult;pub use result_backend_trait::ResultBackend;pub use result_backend_trait::ResultStream;pub use backend::RedisResultBackend;pub use query::TaskQuery;pub use stats::batch_size;pub use stats::ttl;pub use stats::BackendStats;pub use stats::BatchOperationResult;pub use stats::PoolStats;pub use stats::StateCount;pub use stats::StatePercentages;pub use stats::TaskSummary;
Modules§
- backend
- Redis result backend implementation
- batch_
stream - Batch operation streaming utilities
- cache
- In-memory result cache for Redis backend
- chunking
- Result chunking for large payloads
- compression
- Result compression for large payloads
- encryption
- Result encryption for sensitive task data
- event_
transport - Redis event transport for real-time event publishing
- metrics
- Metrics and monitoring for Redis backend
- monitoring
- Monitoring and diagnostics utilities for Redis backend
- pipeline
- Redis pipeline optimization utilities
- profiler
- Performance profiling utilities for Redis backend
- query
- Task query criteria for filtering and searching tasks
- result_
backend_ trait - Result backend trait definition
- result_
store - ResultStore implementation for Redis backend
- retry
- Connection retry and exponential backoff utilities
- stats
- Statistics, batch operation results, and constant configurations
- telemetry
- Telemetry and observability hooks for Redis backend
- trait_
impl - ResultBackend trait implementation for RedisResultBackend
- types
- Core types for the Redis result backend
- utilities
- Utility functions and helpers for Redis backend