Catalog PyPI
Back to packageRELEASE DETAILS

1.0.6

PyPI

aiobus

An event-bus application layer, supports redis

aiobusaioredisasynciobusdistributedredis
Published18 Jun 2022
Direct dependencies1
Transitive dependenciesNot calculated

README

Version 1.0.6 documentation

An event-bus application layer, support redis

Simply ASYNC framework to integrate DISTRIBUTED message bus to your application:

  • utilize redis pub/sub features in backend
  • fast to start and simply configure
  • thread-safe and python async-friendly thanks to coroutines contexts
  • fault tolerance if some redis instances down for a little time
  • scalable thanks to consistent hashing for mapping topic to instance without cluster setup

Install

pip install aiobus

Usage

    import json
    import asyncio
    import datetime
    from aiobus.redis import RedisBus
    ...
    bus = RedisBus(
        servers=['192.168.100.1', '192.168.100.2:6380'],
        max_pool_size=1000
    )
    ...
    # Publisher Coroutine
    async def publisher():
        while True:
            await bus.publish('my-topic', {'stamp': str(datetime.datetime.now())})
            await asyncio.sleep(0.1)
    ...
    # Subscriber Coroutine
    async def subscriber():
        await bus.subscribe('my-topic')
        async for msg in await bus.listen():
            print(json.dumps(msg, indent=2, sort_keys=True))
    ...

Demo

  1. Setup redis instances on localhost docker-compose up -d for demo purposes
  2. Run/Debug Demo script

Running tests

Before to run tests you should

  • install dependencies: pip install -r requirements.txt
  • start the dependent services with command: docker-compose up -d

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
aioredis
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.5",
  "evaluation": "NOT_EVALUATED"
}
aioredis (>=1.3.1)runtime

Distribution files

2 collected
aiobus-1.0.6-py3-none-any.whl

bdist_wheel · 11.32 KB · Python py3

Source file
aiobus-1.0.6.tar.gz

sdist · 11.09 KB · Python source

Source file

Repository

PENDING
sirius-social/aiobus

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:42 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:088c2def83e2a7fc6f44fa2ba9806dc92af72bfb61390306c25ac8e94daa9be7

Other collected versions

View all collected versions →