aj

Crates.ioaj
lib.rsaj
version0.7.0
sourcesrc
created_at2023-12-10 09:48:59.537778
updated_at2024-10-30 12:39:57.836279
descriptionBackground Job based on Actix
homepage
repositoryhttps://github.com/cptrodgers/aj
max_upload_size
id1064109
size39,769
Hien Nguyen (Rodgers) (cptrodgers)

documentation

README

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.
Commit count: 132

cargo fmt