Skip to main content

Asynchronous wrappers for kafka-python, integrating Kafka with Python's asyncio.

Project description

codecov GitHub PyPI PyPI - Python Version

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.5.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

kafkoroutine-0.1.5-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kafkoroutine-0.1.5.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.8.0-1014-azure

File hashes

Hashes for kafkoroutine-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c64132ebee1b69e7d2166c4f5abc7106a7fc78f401bc9ca3c5cc639f5dc2ec65
MD5 aa54526397c442ef7ecde97239381fb5
BLAKE2b-256 9a259e6bf4c3518ad9ab35169438af049340ff23c511d9b31e513c488b3067ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kafkoroutine-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.8.0-1014-azure

File hashes

Hashes for kafkoroutine-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5a996866bb091602fc038b400f749bc8a8eedd6f833f03ec6c788db1b663d4d3
MD5 db4845d7fde1cb52d1f92a249e961325
BLAKE2b-256 bb6094ae26130c381c104d6b1541147fabf26482d671fb2cb64f42956814e933

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