RabbitMQ Stream Python Client
A Python asyncio-based client for RabbitMQ Streams
This is a work in progress
Install
pip install rstream
Quick start
Publishing messages:
import asyncio
from rstream import Producer
async def publish():
async with Producer('localhost', username='guest', password='guest') as producer:
await producer.create_stream('mystream')
for i in range(100):
await producer.publish('mystream', f'msg: {i}'.encode())
asyncio.run(publish())
Consuming messages:
import asyncio
import signal
from rstream import Consumer
async def consume():
consumer = Consumer(
host='localhost',
port=5552,
vhost='/',
username='guest',
password='guest',
)
loop = asyncio.get_event_loop()
loop.add_signal_handler(signal.SIGINT, lambda: asyncio.create_task(consumer.close()))
def on_message(msg):
print('Got message:', msg)
await consumer.start()
await consumer.subscribe('mystream', on_message)
await consumer.run()
asyncio.run(consume())
TODO
- Documentation
- Handle
MetadataUpdateand reconnect to another broker on stream configuration changes - AsyncIterator protocol for consumer
- Add frame size validation
Metadata
Release files for rstream 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rstream-0.3.0.tar.gz | 14.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rstream-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.9 kB
Release files / rstream-0.3.0.tar.gz
| Download URL | rstream-0.3.0.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
195f96898691e7fcf4b05b74ad25cc898419d49bea5f5153195078aa507f1d3f
|
|
BLAKE2b-256 checksum How to use checksums |
9bbfe8d2c198f09710e927b3a461225dbceb76096d06c32e29d7d553ca670ba0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.7 CPython/3.9.5 Linux/5.11.0-25-generic
|
Release files / rstream-0.3.0-py3-none-any.whl
| Download URL | rstream-0.3.0-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b9aa1fd8ba19e56b0ae17c6b1ba14689acb9e14cd9c5ea7a508af3c7b945bb9
|
|
BLAKE2b-256 checksum How to use checksums |
90168c75cd5ab711cb44bd90606d9a471a3a890e2159f1c64f438b14b282beb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.7 CPython/3.9.5 Linux/5.11.0-25-generic
|