AsyncMQ
Async task queues, workers, retries, scheduling, and operations visibility for Python.
Documentation: https://asyncmq.dymmond.com
Source Code: https://github.com/dymmond/asyncmq
Supported Version: the latest released version is the supported version.
AsyncMQ is a background job runtime for Python services built on asyncio and
anyio. It gives applications a queue API, worker runtime,
retry and dead-letter behavior, repeatable scheduling, flow primitives,
multiple backends, a CLI, and a packaged Lilya/Jinja operations dashboard.
Why AsyncMQ
- Task registration for Python services with
@task,.enqueue(),.delay(), and.send(). - Queue and worker APIs for retries, backoff, delayed jobs, cancellation, pause/resume, cleanup, and DLQ operations.
- Backend options for Redis, PostgreSQL, MongoDB, RabbitMQ, and local memory-backed development.
- A production operations console that is packaged with AsyncMQ and works without Node.js or a frontend build pipeline.
- Clear runtime ownership: workers own execution, backends own durable queue state, and the dashboard consumes that state.
AsyncMQ is not a hosted queue service and does not promise exactly-once execution. Production task handlers should be idempotent and safe to retry.
Install
pip install asyncmq
Optional backend extras:
pip install "asyncmq[postgres]"
pip install "asyncmq[mongo]"
pip install "asyncmq[aio-pika]"
pip install "asyncmq[all]"
Quickstart
Start with the in-memory backend for local development:
# myapp/settings.py
from asyncmq.backends.memory import InMemoryBackend
from asyncmq.conf.global_settings import Settings
class AppSettings(Settings):
backend = InMemoryBackend()
worker_concurrency = 1
export ASYNCMQ_SETTINGS_MODULE=myapp.settings.AppSettings
Define a task:
# myapp/tasks.py
from asyncmq.tasks import task
@task(queue="emails", retries=2, ttl=300)
async def send_welcome(email: str) -> str:
return f"sent welcome email to {email}"
Enqueue work:
# producer.py
import anyio
from asyncmq.queues import Queue
from myapp.tasks import send_welcome
async def main() -> None:
queue = Queue("emails")
job_id = await send_welcome.enqueue("alice@example.com", backend=queue.backend)
print("enqueued", job_id)
anyio.run(main)
Run a worker:
asyncmq worker start emails --concurrency 1
Inspect from the CLI:
asyncmq queue list
asyncmq queue info emails
asyncmq job list --queue emails --state waiting
asyncmq job list --queue emails --state failed
Production Backend Example
Use a shared backend configuration for producers, workers, and the dashboard.
# myapp/settings.py
from asyncmq.backends.redis import RedisBackend
from asyncmq.conf.global_settings import Settings
from asyncmq.core.utils.dashboard import DashboardConfig
class AppSettings(Settings):
secret_key = "replace-with-a-secret-from-your-secret-manager"
backend = RedisBackend("redis://redis:6379/0")
worker_concurrency = 8
scan_interval = 1.0
@property
def dashboard_config(self) -> DashboardConfig:
return DashboardConfig(
secret_key=self.secret_key,
dashboard_url_prefix="/asyncmq",
path="/asyncmq",
https_only=True,
)
Workers and the dashboard can run in different services as long as they use the
same ASYNCMQ_SETTINGS_MODULE and backend credentials.
Operations Dashboard
AsyncMQ includes a native dashboard built with Lilya, Jinja templates rendered by the server, and packaged static assets.
# myapp/dashboard.py
from lilya.apps import Lilya
from asyncmq.contrib.dashboard.admin import AsyncMQAdmin
app = Lilya()
admin = AsyncMQAdmin(
enable_login=True,
backend=auth_backend, # Provide an AuthBackend implementation.
url_prefix="/asyncmq",
)
admin.include_in(app)
The dashboard supports queue inspection, worker health, job lists, failed job
tracebacks, DLQ actions, repeatables, metrics, runtime events, audit history,
and deployments behind reverse proxies at /, /asyncmq/, and nested prefixes such as
/operations/asyncmq/.
Read the Dashboard guide for authentication, separate dashboard/worker services, proxy setup, and Nginx examples.
Runtime Shape
flowchart LR
Producer["Producer service"] --> Task["@task enqueue"]
Task --> Queue["Queue API"]
Queue --> Backend["Backend state"]
Backend --> Worker["Worker runtime"]
Worker --> Handler["Task handler"]
Worker --> Backend
Backend --> Dashboard["Operations dashboard"]
Backend --> CLI["asyncmq CLI"]
Documentation Map
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asyncmq-0.9.1.tar.gz.
File metadata
- Download URL: asyncmq-0.9.1.tar.gz
- Upload date:
- Size: 323.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.10.20"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.10.20","system":{"name":"Linux","release":"6.17.0-1018-azure"}} HTTPX2/2.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44d4adfc799a177545bb35eab927bda085eca9c42caafe665e553ad43d3761b7
|
|
| MD5 |
77dfedc96b3e7d5ac07683101de56fe1
|
|
| BLAKE2b-256 |
1f43177bbdab7229342714d15f897f25c6a5413411232c9d8e55cbbacf7add27
|
File details
Details for the file asyncmq-0.9.1-py3-none-any.whl.
File metadata
- Download URL: asyncmq-0.9.1-py3-none-any.whl
- Upload date:
- Size: 388.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.10.20"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.10.20","system":{"name":"Linux","release":"6.17.0-1018-azure"}} HTTPX2/2.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fa0b739bce52b82d84a901a399fa2781970b58da14dfb983ed34e35ec6e21c5
|
|
| MD5 |
a5996e285040846c78dbe0221ad8fbda
|
|
| BLAKE2b-256 |
10e8a2171a35e6cf44f9f0c2b783903b045cffdc0a2892abb88087da40181c93
|