27 releases (6 breaking)

0.7.0 Oct 30, 2024
0.5.1 Jun 22, 2024
0.5.0 Mar 29, 2024
0.1.7 Dec 20, 2023

#252 in Asynchronous

Download history 17/week @ 2024-07-22 20/week @ 2024-07-29 14/week @ 2024-08-05 6/week @ 2024-08-12 25/week @ 2024-09-23 3/week @ 2024-09-30 384/week @ 2024-10-07 453/week @ 2024-10-14 368/week @ 2024-10-21 190/week @ 2024-10-28 21/week @ 2024-11-04

1,204 downloads per month

MIT/Apache

98KB
2K SLoC

aj

ci status

Aj is a simple, customize-able, and feature-rich background job processing library for Rust, backed by Actix (Actor Model).

Usage

use aj::job;

#[job]
fn hello(number: i32, number2: i32) {
    println!("Hello {} {number2}", number);
}

#[job]
async fn async_hello(number: i32, number2: i32) {
    // We support async fn as well
    println!("Hello {} {number2}", number);
}

#[main]
async fn main() {
    // Start AJ engine
    AJ::quick_start();

    // Wait the job is registered in AJ
    let _ = hello::run(1, 2).await;

    // Or fire and forget it
    let _ = async_hello::just_run(3, 4);

    // Sleep 1 ms to view the result from job
    sleep(Duration::from_secs(1)).await;
}

More examples

Features

Job Types:

  • Instant Jobs
  • Scheduled Jobs,
  • Cron Jobs

Manage Job:

  • Update Jobs
  • Cancel Jobs
  • Get Job Information

Retry

  • Manual Retry
  • Maximum Retries
  • Retry Strategy:
    • Interval Strategy
    • Exponential Strategy
    • Custom Strategy: Control when the job retries by adjusting the should_retry logic.

Backend (Broker + Storage)

  • Backend Trait: AJ can work with any database or storage that implements the Backend trait. In memory Example
  • Native Support:
    • In-memory
    • Redis

Processing Speed Customization

  • Job Scan Period (tick)
  • Number of Jobs can run at same time

DAG

  • DAG (Directed Acyclic Graph)

Distributed

  • Distributed Mode

Dashboard & Other

  • Monitorting
  • APIs

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

~12–22MB
~304K SLoC