Expand description
§Azums
High-performance job queue & streaming engine for Rust — from embedded to cloud.
azums delivers enterprise background job processing with ACID guarantees,
row-level FOR UPDATE SKIP LOCKED leasing, dead-letter queues (DLQ), exponential backoff retries,
and time-partitioned storage tables.
All backends benchmarked on every commit to main. Zero idle CPU, sub-millisecond wake-up, up to 380k jobs/sec. See Live Benchmark Dashboard.
§Quickstart
Add azums to your Cargo.toml:
[dependencies]
azums = "0.2"
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }Run zero-config background job processing:
use azums::{quickstart, Job};
use serde::Deserialize;
#[derive(Deserialize)]
struct GreetPayload {
name: String,
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = quickstart("memory").await?;
client.enqueue(Job::new("greet", serde_json::json!({"name": "World"}))).await?;
client.register_handler("greet", |job| async move {
let payload: GreetPayload = job.payload_typed()?;
println!("Hello, {}!", payload.name);
Ok(())
}).await;
client.run_until_empty().await?;
Ok(())
}§Storage Backend Compatibility
azums supports four storage backends under a unified StorageBackend interface:
| Backend | Connection URL | Feature Flag | Ideal Use Case |
|---|---|---|---|
| PostgreSQL | postgres://user:pass@localhost/db | postgres (default) | Multi-node Kubernetes microservices & production DBs |
| SQLite | sqlite://jobs.db?mode=rwc | sqlite (default) | Single-binary web apps, desktop tools, IoT edge devices |
| Redis | redis://127.0.0.1:6379 | redis (default) | Ultra-low latency memory queue & native streams |
| In-Memory | memory | Core | Fast unit tests, CI test pipelines, zero disk I/O |
§Error Handling
All queue operations return Error (aliased as QueueError):
- Use
job.payload_typed::<T>()to automatically parse JSON payloads into strongly-typed structs. - Unhandled failures automatically trigger retries up to
job.max_attemptsbefore moving to the Dead-Letter Queue (status = "dlq").
§Deployment
- Single-Binary Service: Use
azumsinside your Axum, Actix, Poem, or Rocket application binary. - Separate Worker Nodes: Run background workers independently using the
workercrate orazumsctl. - Monitoring Dashboard: The optional web dashboard is available as a separate package (
azums-dashboard).
Re-exports§
pub use backend::PostgresBackend;postgrespub use backend::make_sqlite_pool;sqlitepub use backend::SqliteBackend;sqlitepub use config::Config;pub use db::make_pool;pub use db::run_migrations;pub use jobs::attempts::AttemptsRepo;pub use jobs::enqueue_guard::EnqueueGuard;pub use jobs::enqueue_guard::EnqueueGuardConfig;pub use jobs::ingest_decisions::IngestDecisionsRepo;pub use jobs::maintenance::MaintenanceRepo;pub use jobs::maintenance::TableMaintenanceInfo;pub use jobs::metrics::MetricsRepo;pub use jobs::policies::PoliciesRepo;pub use jobs::policies::QueuePolicy;pub use jobs::policy_decisions::PolicyDecisionRow;pub use jobs::policy_decisions::PolicyDecisionsRepo;pub use jobs::repo::JobsRepo;pub use jobs::retry::RetryConfig;pub use jobs::runner::JobRunner;pub use quickstart::quickstart;pub use quickstart::Client;pub use quickstart::QuickstartFlow;pub use stream_handle::StreamHandle;
Modules§
- backend
- config
- db
- jobs
- Job queue core: models, repository, retry logic, and execution runner.
- quickstart
- stream_
handle
Structs§
- Consumer
Group Status - Status and offset information for a consumer group registered on a stream log.
- Event
- Represents an immutable event stored within a durable stream log.
- Job
- Primary job entity representing a unit of work stored in a storage backend.
- JobList
Item - Lightweight job summary model returned when listing jobs in Admin UI or APIs.
- Memory
Backend - Thread-safe in-memory implementation of
StorageBackend. - Mock
Backend - Recording mock storage backend wrapper for assertion-driven integration testing.
- NewEvent
- Input model for publishing a new event into a stream log.
- NewJob
- Specification for enqueueing a new job into a storage backend.
- Queue
Config - Configuration options for a job queue.
- Redis
Backend redis - Production-grade Redis implementation of
StorageBackendandStreamBackend.
Enums§
- Call
Record - Log record representing a single call executed against a
MockBackend. - Error
- Primary error enum for
azumsjob queue operations. - JobStatus
- Enumeration of possible job lifecycle states.
- Queue
Ordering - Per-queue job execution ordering policy.
Traits§
- JobProcessor
- Trait-based job processor interface for structured background workers.
- Storage
Backend - Async, backend-agnostic storage interface for job queue operations.
- Stream
Backend - Interface for append-only, replayable event streams with consumer groups and acknowledgments.
Type Aliases§
- JobHandler
- Asynchronous job handler closure type alias.
- Notification
Stream - Type alias for asynchronous notification event streams produced by
StorageBackend::subscribe. - Queue
Error - Type alias for backward compatibility.