superstream
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
Release history Release notifications | RSS feed
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_beta-1.0.0.tar.gz
(14.3 kB
view hashes)
Built Distribution
Close
Hashes for superstream_py_beta-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f76d921de467000cde08246e663c7813d35e8670766838dea3855bc28e204f8f |
|
MD5 | 574aff413454aabdadc380f25c54be18 |
|
BLAKE2b-256 | 59dde32abcc81928bbf704536f84493224085021b01b4a35f9a0c006bd0922b5 |
Close
Hashes for superstream_py_beta-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1240acd58af5620526f9c9b9cdf1a325ad4f7ac62e39453920e0e9588c4de69b |
|
MD5 | 9a27d98d8b832020e95554bbc930cb1c |
|
BLAKE2b-256 | 6b886ed0997baa80bece8459015f676af2d31567079ca1a0f7ac8aa915029d68 |