aj 0.6.2

Background Job based on Actix
Documentation

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 std::time::Duration;

use aj::{
    export::core::actix_rt::time::sleep,
    main, AJ,
};
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