Skip to content

soapun/taskiq-kombu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

taskiq-kombu

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.

CI PyPI - Version Python

GitHub License MyPy Ruff codecov


Installation

To use this project you must have installed core taskiq library:

pip install taskiq

This project can be installed using pip:

pip install taskiq-kombu

Or using uv:

uv add taskiq-kombu

Usage

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())

Run example

shell 1: start a worker

$ taskiq worker example:broker

shell 2: run the example script

$ python example.py

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages