15 releases

✓ Uses Rust 2018 edition

new 0.2.0-alpha.1 Feb 19, 2020
0.2.0-alpha.0 Feb 17, 2020
0.1.1 Feb 12, 2020
0.1.0 Jan 31, 2020

#18 in Science

Download history 25/week @ 2020-01-10 61/week @ 2020-01-17 50/week @ 2020-01-24 39/week @ 2020-01-31 73/week @ 2020-02-07 116/week @ 2020-02-14

119 downloads per month

Apache-2.0

90KB
2K SLoC



Build License Crates Docs Docs

A Rust implementation of Celery for producing and consuming asyncronous tasks with a distributed message queue.

We welcome contributions from everyone regardless of your experience level with Rust. For complete beginners, see HACKING_QUICKSTART.md.

If you already know the basics of Rust, the Rusty Celery Book is the best place to start. If you're coming from Python you may also be interested to know what's different. And if you've never heard of Celery, the official Celery Project is a great source of tutorials and overviews.

Quick start

Define tasks by decorating functions with the task attribute.

#[celery::task]
fn add(x: i32, y: i32) -> i32 {
    x + y
}

Create an app with the app macro and register your tasks with it:

let my_app = celery::app!(
    broker = AMQP { std::env::var("AMQP_ADDR").unwrap() },
    tasks = [add],
    task_routes = [
        "*" => "celery",
    ],
);

Then send tasks to a queue with

my_app.send_task(add::new(1, 2)).await?;

And consume tasks as a worker from a queue with

my_app.consume().await?;

The ./examples directory contains a simple Celery app that is implemented in both Rust (celery_app.rs) and Python (celery_app.py) using an AMQP broker.

If you already have an AMQP broker running you can set the environment variable AMQP_URL to your broker's URL. Otherwise simply run the helper script:

./scripts/brokers/amqp.sh

This will download and run the official RabbitMQ image (RabbitMQ is a popular AMQP broker). Then from a separate terminal run the script:

./examples/python_to_rust.sh

This sends a series of tasks from the Python app to the Rust app. You can also send tasks from Rust to Python by running:

./examples/rust_to_python.sh

Road map and current state

✅ = Supported and mostly stable, although there may be a few incomplete features.
⚠️ = Partially implemented and under active development.
🔴 = Not supported yet but on-deck to be implemented soon.

Core

Status Tracking
Protocol ⚠️
Producers
Consumers
Brokers
Backends 🔴
Beat 🔴
Baskets 🔴

Brokers

Status Tracking
AMQP
Redis 🔴

Backends

Status Tracking
RPC 🔴
Redis 🔴

Team

Rusty Celery is an open source project backed by Structurely. Structurely is a start-up building customizable AI inside sales agents that has been using Celery in production back to circa 2017.

Dependencies

~12MB
~247K SLoC