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
aio_pubsub-0.1.0.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for aio_pubsub-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1ca45e5e6e6f7d543885d46c30edc4dba66eb7ad07cd3147ea78f4b270ac6d8 |
|
MD5 | 0f550cccae0398edb6be67c386f9de48 |
|
BLAKE2b-256 | d03895b26b0e29092d21f5d520f5656396aac21961caad86028db0c59b5037d2 |