Skip to main content

Relaybus Kafka publisher and subscriber

Project description

relaybus-kafka (Python)

Kafka publisher and subscriber utilities for Relaybus.

Install

pip install relaybus-kafka

Example

Publisher will attempt to create the topic on first publish (requires broker permissions).

from relaybus_core import OutgoingMessage
from relaybus_kafka import (
    KafkaPublisher,
    KafkaPublisherConnectConfig,
    KafkaSubscriber,
    KafkaSubscriberConnectConfig,
)

publisher = KafkaPublisher.connect(
    KafkaPublisherConnectConfig(brokers="localhost:29092")
)
publisher.publish("relaybus.demo", OutgoingMessage(topic="relaybus.demo", payload=b"hello"))
publisher.close()

subscriber = KafkaSubscriber.connect(
    KafkaSubscriberConnectConfig(
        brokers="localhost:29092",
        group_id="relaybus",
        on_message=lambda msg: print(msg.topic, msg.payload),
    )
)
subscriber.start("relaybus.demo")

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

relaybus_kafka-0.0.8.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

relaybus_kafka-0.0.8-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file relaybus_kafka-0.0.8.tar.gz.

File metadata

  • Download URL: relaybus_kafka-0.0.8.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for relaybus_kafka-0.0.8.tar.gz
Algorithm Hash digest
SHA256 758dae31c523185c8ada0c34e83f965864b8d7af0f7ce331fc97512901e2ef2c
MD5 e0752ad8749aa129ad46676e8c510150
BLAKE2b-256 0647445b46a90ffb1f6f4da45e7266590aff8135ae3bade8b02ca7a92494907c

See more details on using hashes here.

File details

Details for the file relaybus_kafka-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: relaybus_kafka-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for relaybus_kafka-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 27638553abe0563fe984dc90cf5b0af836b4b0a67b67c0721a28f89673e25f96
MD5 500fe47f62b8da8fb29034d500e34c31
BLAKE2b-256 1a5b5bab607fbeedcbf4ced53ce93bea3d7f21c36167be73df2bd77eb7a4b9d3

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