Skip to main content

Crate azums

Crate azums 

Source
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:

BackendConnection URLFeature FlagIdeal Use Case
PostgreSQLpostgres://user:pass@localhost/dbpostgres (default)Multi-node Kubernetes microservices & production DBs
SQLitesqlite://jobs.db?mode=rwcsqlite (default)Single-binary web apps, desktop tools, IoT edge devices
Redisredis://127.0.0.1:6379redis (default)Ultra-low latency memory queue & native streams
In-MemorymemoryCoreFast 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_attempts before moving to the Dead-Letter Queue (status = "dlq").

§Deployment

  • Single-Binary Service: Use azums inside your Axum, Actix, Poem, or Rocket application binary.
  • Separate Worker Nodes: Run background workers independently using the worker crate or azumsctl.
  • Monitoring Dashboard: The optional web dashboard is available as a separate package (azums-dashboard).

Re-exports§

pub use backend::PostgresBackend;postgres
pub use backend::make_sqlite_pool;sqlite
pub use backend::SqliteBackend;sqlite
pub 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§

ConsumerGroupStatus
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.
JobListItem
Lightweight job summary model returned when listing jobs in Admin UI or APIs.
MemoryBackend
Thread-safe in-memory implementation of StorageBackend.
MockBackend
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.
QueueConfig
Configuration options for a job queue.
RedisBackendredis
Production-grade Redis implementation of StorageBackend and StreamBackend.

Enums§

CallRecord
Log record representing a single call executed against a MockBackend.
Error
Primary error enum for azums job queue operations.
JobStatus
Enumeration of possible job lifecycle states.
QueueOrdering
Per-queue job execution ordering policy.

Traits§

JobProcessor
Trait-based job processor interface for structured background workers.
StorageBackend
Async, backend-agnostic storage interface for job queue operations.
StreamBackend
Interface for append-only, replayable event streams with consumer groups and acknowledgments.

Type Aliases§

JobHandler
Asynchronous job handler closure type alias.
NotificationStream
Type alias for asynchronous notification event streams produced by StorageBackend::subscribe.
QueueError
Type alias for backward compatibility.