taskiq-kombu is a plugin for taskiq that adds a new broker based on kombu.
The broker makes use of kombu Consumer and Producer so you can use any kombu transport as taskiq broker.
To use this project you must have installed core taskiq library:
pip install taskiqThis project can be installed using pip:
pip install taskiq-kombuOr using uv:
uv add taskiq-kombu
An example with the broker
# example.py
import asyncio
from kombu import Connection, Queue
from taskiq_kombu import KombuBroker
broker = KombuBroker(
connection=Connection("sqla+sqlite:///tasks.db"),
queues=[
Queue("my_queue", exchange="", routing_key="my_queue"),
],
)
@broker.task("my_task")
async def my_task(a: int, b: int) -> None:
print("AB", a + b)
async def main():
await broker.startup()
await my_task.kiq(1, 2)
await broker.shutdown()
if __name__ == "__main__":
asyncio.run(main())shell 1: start a worker
$ taskiq worker example:brokershell 2: run the example script
$ python example.py