TaskIQ-FastAPI provides integration between FastAPI and TaskIQ, allowing you to run background tasks with access to FastAPI's context (e.g., dependency injection, request state). Current version is 0.5.0, compatible with Python >=3.10. Release cadence is irregular, driven by TaskIQ ecosystem updates.
pip install taskiq-fastapiVerified import paths — ran on the pinned version, not inferred.
Minimal setup integrating TaskIQ with FastAPI using InMemoryBroker. Note: In production, use a persistent broker like Redis or RabbitMQ.
Use `from taskiq_fastapi import InitFastAPI, TaskiqFastAPI` instead of `from taskiq_fastapi.broker import ...`.
Ensure `InitFastAPI().init()` is called at startup (e.g., in a lifespan event or by decorating a function with `@taskiq_app.on_app_init`).
Define task functions after the `TaskiqFastAPI` instance is created, or ensure the broker is correctly wired before task definitions.
Remove `middleware` parameter from `TaskiqFastAPI` and add `ResultBackendMiddleware` to the app if needed.