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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: kafkoroutine-0.1.6.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.1 Linux/6.5.0-1025-azure

File hashes

Hashes for kafkoroutine-0.1.6.tar.gz
Algorithm Hash digest
SHA256 a045ea5ea80c4a985bbd1e8000d8e66a55dbf911dccec530d1146d9d66b228fa
MD5 a39d05197f25f35e4bcdc734cd66c376
BLAKE2b-256 ddbb91534b216cb6afff0614ee6dd8f5b39305c62a16e8d2a2d394c43aa03fbb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for kafkoroutine-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b91eac1a6e9820669894fb219c17f7096412118f4897f877be9b0f090bcd9d75
MD5 01f6efe26821c1dafb3f5f33c2b331d1
BLAKE2b-256 b6b60956ad4d55fb2bc73e79aaeaa454f46346beb0778647281f255e1d13fc87

See more details on using hashes here.

Supported by

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