Skip to main content

Default template for PDM package

Project description

Superstream

Installation

 pip install superstream

Importing

import superstream
from superstream.types import Option

Producer

To use superstream with kafka producer, first define the kafka and superstream configurations:

token = "<superstream-token>"
superstream_host = "<superstream-host>"
brokers = "<kafka-broker>"
topic = "<kafka-topic>"
config = {"bootstrap.servers": brokers}
options = Option(learning_factor=10, servers=brokers)

To initialize superstream, use init function and pass the producer instance as an argument:

producer = Producer(config)
producer = superstream.init(token, superstream_host, config, options, producer=producer)

Finally, to produce messages to kafka, use produce function:

person = {"name": "John Doe", "message": f"Hello, World!"}
producer.produce(
    topic,
    person,
    on_delivery=delivery_callback,
    headers={"key": "value"},
)

Consumer

To use superstream with kafka consumer, first define the consumer configurations:

token = "<superstream-token>"
superstream_host = "<superstream-host>"
group = "<kafka-consumer-group>"
topics = ["<kafka-topic>"]
brokers = "<kafka-broker>"
config = {
    "bootstrap.servers": brokers,
    "group.id": group
}
options = Option(learning_factor=10, servers=brokers)

To initialize superstream, use init function and pass the consumer instance as an argument:

consumer = Consumer(config)
consumer = superstream.init(token, superstream_host, config, options, consumer=consumer)

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

superstream_beta-1.0.4.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

superstream_beta-1.0.4-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file superstream_beta-1.0.4.tar.gz.

File metadata

  • Download URL: superstream_beta-1.0.4.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for superstream_beta-1.0.4.tar.gz
Algorithm Hash digest
SHA256 a529335ba50eb00c6868968949a4531b0e5543608ef834e2b32a28ba59688ff0
MD5 5a1d3718bf4269df958ee670fe9f964e
BLAKE2b-256 e0377d32e299626b3bfd7cdbe7a98df1d565c7172d512d553f95ca9056e12f1b

See more details on using hashes here.

File details

Details for the file superstream_beta-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for superstream_beta-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 145cff8c55521a4bf0c8c291f529267acdac12c53aead0dc934e609759d3e4de
MD5 44de35c6c9d789a706fcda628f9cdaee
BLAKE2b-256 fbaf956588dac0cb91edc8563dcb836964d0e5411eb13918a771fcb177eaf4b4

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