Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A generic interface wrapping multiple backends to provide a consistent pubsub API.

Project description

https://travis-ci.com/theruziev/aio_pubsub.svg?branch=master https://codecov.io/gh/theruziev/aio_pubsub/branch/master/graph/badge.svg

A generic interface wrapping multiple backends to provide a consistent pubsub API.

Installation

pip install aio-pubsub

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
  • redis

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aio-pubsub, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size aio_pubsub-0.2.0-py2.py3-none-any.whl (4.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size aio_pubsub-0.2.0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page