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>"
broker = "<kafka-broker>"
topic = "<kafka-topic>"
config = {"bootstrap.servers": broker}
options = Option(host=superstream_host, learning_factor=10, servers=broker)

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>"]
broker = "<kafka-broker>"
config = {
    "bootstrap.servers": broker,
    "group.id": group
}
options = Option(host=superstream_host, learning_factor=10, servers=broker)

Too 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.0.tar.gz (14.7 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.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: superstream_beta-1.0.0.tar.gz
  • Upload date:
  • Size: 14.7 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.0.tar.gz
Algorithm Hash digest
SHA256 4c10f40e048024192209846cab6f7ce116adece0f6d404444dc905f922787c14
MD5 20e1336f8d2bd891ba8e248e449cf85c
BLAKE2b-256 89bff191462c3d2c2f0857106f54c466e63257cf640400c8d777604a640aa5b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for superstream_beta-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fa6cdef9caaa2e5bb030255e196acc441fb836b5ebcedbc7c40a72c9f50578d
MD5 6572e68e115ec5fb4286fed3cae71a49
BLAKE2b-256 4d9d06fee9f5b023376a35c6ec6e14844f2647bae2cbfaa353139acc63569f8d

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