[][src]Crate celery

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

Examples

Define tasks by decorating functions with the task attribute:

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

Then create a Celery app with the celery_app macro and register your tasks with it:

let my_app = celery_app!(
    broker = AMQPBroker { std::env::var("AMQP_ADDR").unwrap() },
    tasks = [add],
    task_routes = [],
);

The Celery app can be used as either a producer or consumer (worker). To send tasks to a queue for a worker to consume, use the Celery::send_task method:

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

And to act as worker and consume tasks sent to a queue by a producer, use the Celery::consume method:

my_app.consume().await?;

Modules

protocol

Defines the Celery protocol.

Macros

celery_app

A macro for creating a Celery app.

Structs

AMQPBroker

An AMQP broker.

AMQPBrokerBuilder

Builds an AMQP broker with a custom configuration.

Celery

A Celery app is used to produce or consume tasks asynchronously.

CeleryBuilder

Used to create a Celery app with a custom configuration.

Error

Any error that can occur while using celery.

Rule

A rule for routing tasks to a queue based on a glob pattern.

TaskContext

Additional context sent to the on_success and on_failure task callbacks.

TaskOptions

General configuration options pertaining to a task.

TaskSendOptions

Options for sending a task. Used to override the defaults.

TaskSendOptionsBuilder

Used to create custom TaskSendOptions.

Enums

ErrorKind

Error kinds that can occur while using celery.

Traits

Broker

A message Broker is used as the transport for producing or consuming tasks.

BrokerBuilder

A BrokerBuilder is used to create a type of broker with a custom configuration.

ResultExt

Extension methods for Result.

Task

A Task represents a unit of work that a Celery app can produce or consume.

Attribute Macros

task

A procedural macro for generating a Task from a function.