https://github.com/taskiq-python/taskiq-aio-kafka
Kafka broker for taskiq
https://github.com/taskiq-python/taskiq-aio-kafka
Last synced: 9 months ago
JSON representation
Kafka broker for taskiq
- Host: GitHub
- URL: https://github.com/taskiq-python/taskiq-aio-kafka
- Owner: taskiq-python
- License: mit
- Created: 2023-04-06T20:50:40.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-17T17:09:28.000Z (over 1 year ago)
- Last Synced: 2025-04-21T01:31:50.410Z (9 months ago)
- Language: Python
- Size: 144 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AioKafka broker for taskiq
This lirary provides you with aiokafka broker for taskiq.
Usage:
```python
from taskiq_aio_kafka import AioKafkaBroker
broker = AioKafkaBroker(bootstrap_servers="localhost")
@broker.task
async def test() -> None:
print("The best task ever!")
```
## Non-obvious things
You can configure kafka producer and consumer with special methods `configure_producer` and `configure_consumer`.
Example:
```python
from taskiq_aio_kafka import AioKafkaBroker
broker = AioKafkaBroker(bootstrap_servers="localhost")
# configure producer, you can set any parameter from
# base AIOKafkaProducer, except `loop` and `bootstrap_servers`
broker.configure_producer(request_timeout_ms=100000)
# configure consumer, you can set any parameter from
# base AIOKafkaConsumer, except `loop` and `bootstrap_servers`
broker.configure_consumer(group_id="the best group ever.")
```
## Configuration
AioKafkaBroker parameters:
* `bootstrap_servers` - url to kafka nodes. Can be either string or list of strings.
* `kafka_topic` - custom topic in kafka.
* `result_backend` - custom result backend.
* `task_id_generator` - custom task_id genertaor.
* `kafka_admin_client` - custom `kafka` admin client.
* `delete_topic_on_shutdown` - flag to delete topic on broker shutdown.