Skip to main content

superstream

Project description

Superstream

Installation

 pip install superstream-py

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

Uploaded Python 3

File details

Details for the file superstream_py-1.0.0.tar.gz.

File metadata

  • Download URL: superstream_py-1.0.0.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_py-1.0.0.tar.gz
Algorithm Hash digest
SHA256 575e9385689fc8b6ca5f2bdc23c0b572cd486dd69a7d0e6a058c1eeb8f1ec01a
MD5 eb7479c7f53fcbe3c435ba1a94d1b9fa
BLAKE2b-256 647839d64edfc81bc9b365150818112997b2a0630e3cd43453ae4dc07855e9b3

See more details on using hashes here.

File details

Details for the file superstream_py-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: superstream_py-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for superstream_py-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 569f8d41209a6452abcca0b52cf2e29fd55047ccbb49a3736d0253d031293449
MD5 c2042b1abe237c894fb76e24bd8283e9
BLAKE2b-256 5ca45afef97ab86835fb3654ed49b2bde673192acc725cf9612414e9e4fb31b2

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