Asynchronous wrappers for kafka-python, integrating Kafka with Python's asyncio.
Project description
kafkoroutine
This repository offers Python-based asynchronous wrappers around kafka-python
's Producer and Consumer, bridging them
seamlessly with Python's asyncio
.
Prerequisites
- Python 3.7 or later
- A running Kafka instance (for actual message passing)
Getting Started
Follow these instructions to integrate the asynchronous Kafka components in your asyncio-based Python project.
Installation
Install kafkoroutine
using pip:
pip install kafkoroutine
Please note: this project requires Python 3.7 or later and is built upon the kafka-python
library.
Usage
AsyncKafkaConsumer
from kafkoroutine.consumer import AsyncKafkaConsumer
async with AsyncKafkaConsumer(topics=topics, bootstrap_servers='localhost:9092', executor=None) as consumer:
async for message in consumer:
print(f"Received: {message.value.decode('utf-8')}")
AsyncKafkaProducer
from kafkoroutine.producer import AsyncKafkaProducer
async with AsyncKafkaProducer(bootstrap_servers='localhost:9092', executor=None) as producer:
for msg in messages:
await producer.send(topic, msg)
Built With
- Poetry - Packaging and dependency management
- asyncio - Asynchronous I/O, event loop, and coroutines used for the implementation.
- kafka-python - The Python client for Apache Kafka upon which these asynchronous wrappers are built.
License
This project follows the guidelines of the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file kafkoroutine-0.1.4.tar.gz
.
File metadata
- Download URL: kafkoroutine-0.1.4.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-1016-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fd0c2e402178e4d27967c59b0d52e2e03086a36ed38b98f7728ba9c60a6913c |
|
MD5 | 21cc135442b961c3360cfcc6f2194164 |
|
BLAKE2b-256 | c1bd8f9d946e05c6c3b88f37036a35de747581ca05f60452088ca63a12a2b72f |
File details
Details for the file kafkoroutine-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: kafkoroutine-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-1016-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d5f43a892ed52d124fc736e750cca52f2bb31737ee460648a540aabda9d7353 |
|
MD5 | d44944d5f5fb31a57b7efe772b167734 |
|
BLAKE2b-256 | ff9c3b3e47f7a542759e8d00733d0cc536fa6279abd6704246d2a8168c899264 |