Skip to main content

High-performance Python client for Rivven distributed streaming platform

Project description

rivven-python

Python bindings for Rivven using PyO3.

Installation

pip install rivven

Usage

Producer

from rivven import Client, ProducerConfig

client = Client.connect("localhost:9092")
producer = client.producer()

# Send a message
producer.send("my-topic", key=b"user-123", value=b'{"event": "login"}')

# Send with headers
producer.send(
    "my-topic",
    key=b"user-123",
    value=b'{"event": "purchase"}',
    headers={"source": "api", "version": "1.0"}
)

# Flush and close
producer.flush()

Consumer

from rivven import Client, ConsumerConfig

client = Client.connect("localhost:9092")
consumer = client.consumer(
    group_id="my-group",
    topics=["my-topic"]
)

# Poll for messages
for record in consumer.poll(timeout_ms=1000):
    print(f"Key: {record.key}, Value: {record.value}")
    consumer.commit(record)

# Or use iterator
for record in consumer:
    process(record)
    consumer.commit(record)

Admin Operations

from rivven import Client

client = Client.connect("localhost:9092")

# Create topic
client.create_topic("new-topic", partitions=3, replication_factor=2)

# List topics
topics = client.list_topics()
for topic in topics:
    print(f"{topic.name}: {topic.partitions} partitions")

# Delete topic
client.delete_topic("old-topic")

Async Support

import asyncio
from rivven import AsyncClient

async def main():
    client = await AsyncClient.connect("localhost:9092")
    producer = await client.producer()
    
    await producer.send("my-topic", key=b"key", value=b"value")
    await producer.flush()

asyncio.run(main())

Configuration

from rivven import ClientConfig

config = ClientConfig(
    bootstrap_servers=["node1:9092", "node2:9092"],
    connection_timeout_ms=10000,
    request_timeout_ms=30000,
)

client = Client.connect_with_config(config)

Building from Source

# Install maturin
pip install maturin

# Build wheel
cd crates/rivven-python
maturin build --release

# Install locally
pip install target/wheels/rivven-*.whl

License

See root LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

rivven-0.0.4-cp312-cp312-manylinux_2_28_aarch64.whl (632.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

rivven-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (653.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rivven-0.0.4-cp312-cp312-macosx_11_0_arm64.whl (594.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file rivven-0.0.4-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for rivven-0.0.4-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 85fda34cde229e3959582f3167c3ea2ab1e40a7542de2fe448dd358b987a0be2
MD5 2f7b787a303c715a8cb33cb59679e956
BLAKE2b-256 6f3de33b8297bbbaa6b3e31f4cacd2c122d7507499f9c1e94f4c2207f985010e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rivven-0.0.4-cp312-cp312-manylinux_2_28_aarch64.whl:

Publisher: release.yml on hupe1980/rivven

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rivven-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rivven-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf2a47e1d2c1dfdb718d8ab0632443f1d55927fc022a9fefaaf7620a72509e77
MD5 965b68e8bb5acd938ccdf03bf81cd137
BLAKE2b-256 18050b10125c71576166b8d194253a1821fd367df05c4626e689beea3e39451d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rivven-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on hupe1980/rivven

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rivven-0.0.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rivven-0.0.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 597166692890879405bffa99be25b8353337792ad6f3ec3c6c17745f289cbd80
MD5 329ff68817d3711bd79e75ba189d6d40
BLAKE2b-256 5728d3e64cdae5205005970437a4d6fe208756ca05eedb8caf5e699d523d9ba5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rivven-0.0.4-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on hupe1980/rivven

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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