taskiq
Package: z4j-taskiq - taskiq 0.11+.
Install
Section titled “Install”pip install z4j-taskiqWiring
Section titled “Wiring”taskiq’s extensibility is middleware-based:
from taskiq_redis import RedisAsyncResultBackend, ListQueueBrokerfrom z4j_taskiq import Z4JMiddleware
broker = ListQueueBroker("redis://localhost:6379")broker = broker.with_result_backend(RedisAsyncResultBackend("redis://..."))broker = broker.with_middlewares(Z4JMiddleware())The framework adapters do this automatically. For bare usage, add it yourself.
What it captures
Section titled “What it captures”| taskiq hook | z4j event |
|---|---|
pre_send | task_sent |
pre_execute | task_started |
post_execute (no exception) | task_succeeded |
post_execute (exception) | task_failed |
| retries (via retry middleware) | task_retry |
Actions
Section titled “Actions”| Verb | How |
|---|---|
retry | task.kiq(*args, **kwargs) with original payload |
cancel | await broker.cancel_task(task_id) where backend supports it |
purge_queue | backend-specific; Redis: FLUSHDB-scoped |
Multi-broker
Section titled “Multi-broker”taskiq supports multiple brokers in one process. Each broker appears separately in the dashboard.
Schedules
Section titled “Schedules”taskiq-scheduler is writable: schedules stored in Redis / Postgres / file backends can be created and modified from the UI. See scheduler: taskiq-scheduler.
Caveats
Section titled “Caveats”ZeroMQBroker- in-memory distribution between processes. Works with z4j but each process is a separate agent.AioPikaBroker(RabbitMQ) - queue length via RabbitMQ management API.- InMemoryBroker - local-only, useful for tests; z4j captures events but there’s no cross-process visibility.
Config
Section titled “Config”# envZ4J_TASKIQ_BROKERS = "myapp.brokers.redis_broker,myapp.brokers.rabbit_broker"The agent resolves each broker path and registers it.