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.2.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.2.0.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rstream-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.3 kB
Release files / rstream-0.2.0.tar.gz
| Download URL | rstream-0.2.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2d6eb4d8567731578889874b27c154eca33e6b63636bf44360b8c0bfff0ca58
|
|
BLAKE2b-256 checksum How to use checksums |
9d5a143869673a20ca5be26ca62abd91f313200ec7feef53ae50b0fda671c95f
|
| 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.2.0-py3-none-any.whl
| Download URL | rstream-0.2.0-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a17c54e4880e5be0dc040904d8742492ddde46c05f3b6b5474733910ec56b002
|
|
BLAKE2b-256 checksum How to use checksums |
6f70def720a004d619e5724b44e17eaf2927ff533c8852676585d3ea41c08b93
|
| 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
|