Skip to main content

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

kafkoroutine-0.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

kafkoroutine-0.1.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file kafkoroutine-0.1.2.tar.gz.

File metadata

  • Download URL: kafkoroutine-0.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.0 Linux/5.15.0-1042-azure

File hashes

Hashes for kafkoroutine-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b8c4f97ee0923b51c1e33beb48cbdc4b8d80a10cd56d08dddf37139f6ea41800
MD5 a0aa2b006c72b1a24ffb079b7eb7814d
BLAKE2b-256 31f9a862232a3c59038922fd762903343674b1bcade2837ff84e991b18f93bee

See more details on using hashes here.

File details

Details for the file kafkoroutine-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: kafkoroutine-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.0 Linux/5.15.0-1042-azure

File hashes

Hashes for kafkoroutine-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9be6d7cd3a611111707244acb39ecba0b47f4556c06676881f7d693142b8f325
MD5 4ec5c552cdd0c22f35b2474fa96660c5
BLAKE2b-256 9e1855b4ce91de4bdfdd9d33873b3dcc41076ee59e057525218d60b79a1975a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page