Skip to main content

Streamline your Kafka data processing, this tool aims to standardize streaming data from multiple Kafka clusters. With a pub-sub approach, multiple functions can easily subscribe to incoming messages, serialization can be specified per topic, and data is automatically processed by data sink functions.

Project description

Test Python Package Documentation Status Downloads

Snapstream

Snapstream provides a data-flow model to simplify development of stateful streaming applications.

Installation

pip install snapstream

Usage

We snap iterables to user functions, and process them in parallel when we call stream:

demo

We pass the callable print to print out the return value. Multiple iterables and sinks can be passed.

from snapstream import snap, stream

@snap(range(5), sink=[print])
def handler(msg):
    yield f'Hello {msg}'

stream()
Hello 0
Hello 1
Hello 2
Hello 3
Hello 4

To try it out for yourself, spin up a local kafka broker with docker-compose.yml, using localhost:29091 to connect:

docker compose up broker -d

Use the cli tool to inspect Topic/Cache:

snapstream topic emoji --offset -2
>>> timestamp: 2023-04-28T17:31:51.775000+00:00
>>> offset: 0
>>> key:
🏆

Features

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

snapstream-1.0.0.tar.gz (15.0 kB view hashes)

Uploaded Source

Built Distribution

snapstream-1.0.0-py3-none-any.whl (16.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page