event-bus
EventBus implementation in python
Examples
sync
from multi_event_bus import EventBus
eb = EventBus(redis_host="127.0.0.1", redis_port=6379)
eb.dispatch("event-name", payload={"num": 1})
eb.subscribe_to("event-name", consumer_id="consumer-1", offset=0)
event, topic = eb.get(consumer_id="consumer-1") # Blocking
print(event.payload) # -> {"num": 1}
async
from multi_event_bus import AsyncEventBus
eb = AsyncEventBus(redis_host="127.0.0.1", redis_port=6379)
eb.dispatch("event-name", payload={"num": 1})
eb.subscribe_to("event-name", consumer_id="consumer-2", offset=0)
event, topic = await eb.get(consumer_id="consumer-2")
print(event.payload) # -> {"num": 1}
register event schema
from multi_event_bus import EventBus
eb = EventBus(redis_host="127.0.0.1", redis_port=6379)
# Enforce json schema of event
json_schema = {
"type": "object",
"properties": {"num": {"type": "string"}}
}
eb.register_event_schema("event-name", schema=json_schema)
eb.dispatch("event-name", payload={"num": "7854"})
eb.subscribe_to("event-name", consumer_id="consumer-3", offset=0)
event, topic = eb.get(consumer_id="consumer-3") # Blocking
print(event.payload) # -> {"num": "7854"}
Development
scripts
poetry run run_pytest
poetry run run_flake8
poetry run run_mypy
poetry run run_black
run tests
poetry run test
run all (test and black)
poetry run all
Metadata
Release files for multi-event-bus 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 | Provenance | Actions |
|---|---|---|---|---|
| multi_event_bus-0.2.0.tar.gz | 4.2 kB | Without provenance | Details for multi_event_bus-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| multi_event_bus-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for multi_event_bus-0.2.0-py3-none-any.whl |
Total release size: 9.0 kB
Release files / multi_event_bus-0.2.0.tar.gz
| Download URL | multi_event_bus-0.2.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
504caf6ffa4d51294bab93c644c68ef46a8164fd92f4da2c385ee38b8e22e8bc
|
|
BLAKE2b-256 checksum How to use checksums |
9814b86413f5248e8e5400fa0b7ada0563b2ca6adeb4c6ff2c7a8eb669c82024
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-39-generic
|
Release files / multi_event_bus-0.2.0-py3-none-any.whl
| Download URL | multi_event_bus-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a55ae9a7dcdaf294f3f26eb93bf526ed6ef1f76956879a59e79390817c42739
|
|
BLAKE2b-256 checksum How to use checksums |
b3300923f0bdc90d27f2e59254563cda53b340d08c9b42c5375b99ac261ae30c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.10 Linux/5.13.0-39-generic
|
Security for multi-event-bus 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.