Expand description
§BullMQ - Rust Port
A powerful, fast, and robust job queue backed by Redis.
This crate provides a Rust implementation of the BullMQ job queue system, fully compatible with the Node.js and Elixir implementations.
§Architecture
Queue- Add jobs to a queue and manage queue state.Worker- Process jobs from a queue with configurable concurrency.Job- Represents a unit of work in the queue.
§Example
use bullmq::{Queue, Worker, Job, QueueOptions, WorkerOptions};
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), bullmq::Error> {
let queue = Queue::new("my-queue", QueueOptions::default()).await?;
queue.add("my-job", serde_json::json!({"foo": "bar"}), None).await?;
let worker = Worker::new("my-queue", Arc::new(|job: Job, _token| Box::pin(async move {
println!("Processing job: {}", job.id());
Ok(serde_json::Value::Null)
})), WorkerOptions::default()).await?;
Ok(())
}Re-exports§
pub use error::Error;pub use flow_producer::FlowJob;pub use flow_producer::FlowOpts;pub use flow_producer::FlowProducer;pub use flow_producer::FlowProducerOptions;pub use flow_producer::FlowQueueOptions;pub use flow_producer::GetFlowOpts;pub use flow_producer::JobNode;pub use job::Job;pub use keys::QueueKeys;pub use options::BackoffStrategyFn;pub use options::DeduplicationOptions;pub use options::JobOptions;pub use options::MetricsOptions;pub use options::ParentOpts;pub use options::QueueOptions;pub use options::RateLimiterOptions;pub use options::WorkerOptions;pub use queue::JobCountRecorder;pub use queue::Queue;pub use queue_events::QueueEvent;pub use queue_events::QueueEventEntry;pub use queue_events::QueueEvents;pub use queue_events::QueueEventsOptions;pub use types::DependenciesCount;pub use types::DependenciesResult;pub use types::JobProgress;pub use types::JobState;pub use types::Metrics;pub use types::MetricsMeta;pub use types::QueueMeta;pub use types::RetryOptions;pub use worker::Worker;
Modules§
- error
- Error types for BullMQ operations.
- flow_
producer - FlowProducer — atomically add trees of dependent jobs (flows). FlowProducer — atomically add trees of dependent jobs (flows).
- job
- Job representation and lifecycle management.
- job_
scheduler - Job Scheduler — repeatable/cron-based job scheduling. Job Scheduler — repeatable/cron-based job scheduling.
- keys
- Redis key generation for queue data structures. Redis key generation for BullMQ queues.
- options
- Configuration options for queues, workers, and jobs.
- queue
- Queue management and job submission.
- queue_
events - Cross-process queue event listener (stream-based). Cross-process queue event listener.
- redis_
connection - Redis connection handling.
- scripts
- Lua script registry and execution.
- types
- Shared types: job state, progress, backoff strategies.
- worker
- Worker implementation for processing jobs…
Type Aliases§
- Result
- Result type alias for BullMQ operations.