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.7.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.7-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: relaybus_kafka-0.0.7.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.7.tar.gz
Algorithm Hash digest
SHA256 6b193af815192cd3f059593de5496bb7731303c778c805f513de9147e99b46b1
MD5 013693fbc2a976ceacaabd140c9c14a0
BLAKE2b-256 f8f311275546cfc6a6021f5f6d756aefea88391ecf5dbf665101eecb1eadaff6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: relaybus_kafka-0.0.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 518c1eeb601eed3db3089aaec1525e91036e544288da121c2425b5cb0533abed
MD5 6891cb1fe006c1524b777a3e3c51cfcf
BLAKE2b-256 31bd97d077e81b2764ef287238122d0885b9b5e3c019ce5dfb93157ae24db165

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