Dramatiq is a Python library for reliable background jobs with actors, workers, and message brokers such as RabbitMQ or Redis, focused on simple APIs and retries.
Overview
Dramatiq is a background task processing library for Python 3.10 and later. You define actor functions decorated with @dramatiq.actor, enqueue work with .send, and run separate worker processes that consume messages from a broker.
Install extras pull in RabbitMQ or Redis broker support plus optional watch tooling for development. Workers are started with a dramatiq module path, while client code enqueues messages from your application process.
The user guide covers workers, error handling, retries, message age and time limits, scheduling, priorities, middleware customization, rate limiting, results backends, asyncio actors, workflows, and unit testing patterns. LGPL licensing applies to the project.
Documentation compares design choices to other Python task systems in a motivation section and catalogs API references for brokers, messages, middleware, and workers.
Key features
- Actor-based background tasks
- RabbitMQ and Redis brokers
- Retries and time limits
- Schedulable and prioritized messages
- Middleware and rate limit hooks
- Workflow and result extensions
Use cases
- Async jobs in Python web apps
- Distributed workers with Redis or RabbitMQ
- Reliable retries for background work