| Crates.io | apalis |
| lib.rs | apalis |
| version | 1.0.0-rc.2 |
| created_at | 2021-05-14 15:35:04.16062+00 |
| updated_at | 2026-01-07 05:48:07.783427+00 |
| description | Simple, extensible and multithreaded background task processing for Rust |
| homepage | |
| repository | https://github.com/apalis-dev/apalis |
| max_upload_size | |
| id | 397435 |
| size | 132,821 |
actix and axumtower ecosystem of services and utilities| Source | Crate | Examples |
|---|---|---|
apalis-cron |
||
apalis-redis |
||
apalis-sqlite |
||
apalis-postgres |
||
apalis-mysql |
||
apalis-amqp |
||
apalis-core |
||
apalis-workflow |
||
apalis-board |
||
apalis-board-api |
To get started, just add to Cargo.toml
[dependencies]
apalis = { version = "1.0.0-rc.2" }
# apalis-redis = { version = "1.0.0-alpha.1" } # Use redis/sqlite/postgres etc
use apalis::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Clone)]
struct Email {
to: String,
}
/// A function called for every task
async fn send_email(task: Email, data: Data<usize>) {
// execute task
}
#[tokio::main]
async fn main() {
let mut storage = MemoryStorage::new();
storage
.push(Email {
to: "test@example.com".to_string(),
})
.await
.expect("Could not add tasks");
WorkerBuilder::new("email-worker")
.backend(storage)
.concurrency(2)
.parallelize(tokio::spawn)
.data(0usize)
.build(send_email)
.run()
.await;
}
apalis has first class support for sequential, dag and conditional workflows.use apalis::prelude::*;
use apalis_workflow::*;
use std::time::Duration;
use apalis_file_storage::JsonStorage;;
#[tokio::main]
async fn main() {
let workflow = Workflow::new("odd-numbers-workflow")
.delay_for(Duration::from_millis(1000))
.and_then(|a: usize| async move { Ok::<_, BoxDynError>((0..a).collect::<Vec<_>>()) })
.filter_map(|x| async move { if x % 2 != 0 { Some(x) } else { None } })
.and_then(|a: Vec<usize>| async move {
println!("Sum: {}", a.iter().sum::<usize>());
Ok::<_, BoxDynError>(())
});
let mut in_memory = JsonStorage::new_temp().unwrap();
in_memory.push_start(10).await.unwrap();
let worker = WorkerBuilder::new("rango-tango")
.backend(in_memory)
.on_event(|ctx, ev| {
println!("On Event = {:?}", ev);
})
.build(workflow);
worker.run().await.unwrap();
}
For more functionality like fold, filter_map and other combinators checkout the docs
Here is a basic example of how the core parts integrate
sequenceDiagram
participant App
participant Worker
participant Backend
App->>+Backend: Add task to queue
Backend-->>+Worker: Job data
Worker->>+Backend: Update task status to 'Running'
Worker->>+App: Started task
loop task execution
Worker-->>-App: Report task progress
end
Worker->>+Backend: Update task status to 'completed'
With the web UI, you can manage your jobs through a simple interface. Check out this working example to see how it works.

tower - Tower is a library of modular and reusable components for building robust networking clients and servers.redis-rs - Redis library for rustsqlx - The Rust SQL Toolkitcron - A cron expression parser and schedule explorerPlease read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details