A generic interface wrapping multiple backends to provide a consistent pubsub API.
Project description
A generic interface wrapping multiple backends to provide a consistent pubsub API.
Usage
To use it, you need to implement your pubsub implementation from interfaces or use backends from aio_pubsub.backends package:
from aio_pubsub.backends.memory import MemoryPubSub
pubsub = MemoryPubSub()
# Create subscriber
subscriber = await pubsub.subscribe("a_chan")
# Push message
await pubsub.publish("a_chan", "hello world!")
await pubsub.publish("a_chan", "hello universe!")
# And listening channel
try:
async for message in subscriber:
print(message, flush=True)
except KeyboardInterrupt:
print("Finish listening")
Supported backends
Disclaimer: I would not advise you to use this backend, because it is shown only for testing purposes. Better develop your own implementation.
memory
mongodb
redis
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aio_pubsub-0.1.0.tar.gz.
File metadata
- Download URL: aio_pubsub-0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83b08935be3730b16821c69791a42230df7df3bc9f90af521c60aa3449176c7a
|
|
| MD5 |
3a68976c1f56d33a2531b0fa96b736a6
|
|
| BLAKE2b-256 |
d11d8cb948b521831227af17254c61ed30a32c893cee0f4f8ff3c2878b76c05f
|
File details
Details for the file aio_pubsub-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: aio_pubsub-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1ca45e5e6e6f7d543885d46c30edc4dba66eb7ad07cd3147ea78f4b270ac6d8
|
|
| MD5 |
0f550cccae0398edb6be67c386f9de48
|
|
| BLAKE2b-256 |
d03895b26b0e29092d21f5d520f5656396aac21961caad86028db0c59b5037d2
|