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:
from rstream import Producer, Consumer
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())
Consuming messages:
async with Consumer('localhost', username='guest', password='guest') as consumer:
async for msg in consumer.iterator('mystream'):
print('Got message:', msg)
if msg.endswith(b'99'):
break
Or with a callback function:
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()
Metadata
Release files for rstream 0.1.3
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.1.3.tar.gz | 13.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rstream-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.3 kB
Release files / rstream-0.1.3.tar.gz
| Download URL | rstream-0.1.3.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3260fc95b4b4e12f01ffd8971bccc95e79e8d6f808390e000d5bed3304d15517
|
|
BLAKE2b-256 checksum How to use checksums |
c3719a5de5783cd2efbaee4e29ec812fbd6418f7832db77623ff997b41191c4a
|
| 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.1.3-py3-none-any.whl
| Download URL | rstream-0.1.3-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f19aee1e0b64ab28b68a8f36aeb6f657441dae0c5e0b42362f57387ed72cc54
|
|
BLAKE2b-256 checksum How to use checksums |
45fe6cd47746a169a36196c801b68ab823d2fad038e888c9a34c072ada632109
|
| 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
|