30 releases

new 8.0.0 Feb 3, 2026
0.8.0 Feb 3, 2026
0.7.2 Jan 23, 2026
0.7.1 Feb 3, 2025
0.1.7 Dec 20, 2023

#644 in Asynchronous

MIT/Apache

115KB
2.5K SLoC

aj

ci status

AJ is a simple, customizable, and feature-rich background job processing library for Rust. It runs on pure Tokio runtime using the Kameo actor framework.

Install

aj = "0.8.0"
serde = { version = "1.0.64", features = ["derive"] } # Serialize and deserialize the job
tokio = { version = "1", features = ["rt-multi-thread", "macros"] } # Async runtime

Quick start

use aj::job;

#[job]
async fn hello(name: String) {
    println!("Hello {name}");
}

#[tokio::main]
async fn main() {
    // AJ will be backed by in-memory backend.
    // If you wish to use redis as the backend for aj:
    // AJ::start(aj::Redis::new("redis://localhost:6379"));
    AJ::quick_start();
    // Fire and forget the job. No guarantee job is queued
    hello::just_run("Rodgers".into());
    // Or wait for job to be queued
    hello::run("AJ".into()).await;

    // Sleep 1 sec to view the result from job (if you want to wait for the job to run)
    // tokio::time::sleep(std::time::Duration::from_secs(1)).await;
}

More examples

LICENSE

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in aj by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~13–19MB
~251K SLoC