This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is Rusty Celery, a Rust implementation of the Celery distributed task queue system. The project provides both producer and consumer capabilities, supporting AMQP and Redis brokers. Key components include:
- Core App (
src/app/mod.rs): The mainCelerystruct andCeleryBuilderfor creating apps - Brokers (
src/broker/): AMQP and Redis broker implementations - Tasks (
src/task/): Task definitions, signatures, async results, and execution - Protocol (
src/protocol/): Message serialization and Celery protocol implementation - Beat (
src/beat/): Periodic task scheduling (cron-like functionality) - Codegen: Procedural macros for the
#[celery::task]attribute
# Build the project
cargo build
# or
make build
# Run tests (excludes broker integration tests)
make test
# Run all tests including broker integration tests
make run-all-tests
# Run specific broker tests
make broker-tests# Format code
make format
# Lint (format check + clippy)
make lint
# Individual checks
make check-fmt
make check-clippy# Build documentation
make build-docs# Run Rust celery app as consumer
cargo run --example celery_app consume
# Run Rust celery app as producer
cargo run --example celery_app produce [task_name]
# Available tasks: add, buggy_task, long_running_task, bound_task
# Run Beat scheduler
cargo run --example beat_appTasks are defined using the #[celery::task] procedural macro which generates a Task struct and implementation. The macro supports options like name, max_retries, time_limit, bind, etc.
Apps are created using the celery::app! macro which configures brokers, registers tasks, and sets up routing rules.
- AMQP Broker: Uses
lapincrate for RabbitMQ/AMQP connections - Redis Broker: Uses
rediscrate with connection manager - Brokers implement the
Brokertrait for sending/receiving messages
- Supports multiple content types: JSON (default), MessagePack, YAML, Pickle
- Compatible with Python Celery message format
- Handles task routing, delivery, and acknowledgments
Built on Tokio async runtime with:
- Async task execution
- Stream-based message consumption
- Configurable prefetch counts for concurrency control
The project maintains compatibility with Python Celery:
- Same message format and protocol
- Can consume tasks produced by Python Celery
- Can produce tasks for Python Celery workers
- Example Python app in
examples/celery_app.py
Requires AMQP_ADDR environment variable for broker connection:
export AMQP_ADDR="amqp://localhost:5672//"For Redis:
export REDIS_ADDR="redis://localhost:6379/"Use provided broker setup script:
./scripts/brokers/amqp.sh