A small event bus with pluggable queue adapters and response stores (e.g. SQS, RabbitMQ, Redis, etc.)
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
DeegzLibs EventBus (Python)
A small event bus with pluggable queue adapters. Define event messages as Pydantic models, register handlers, and execute events in-process or via a queue (e.g. AWS SQS, RabbitMQ, Redis).
Installation
pip install deegzlibs-event-bus
Optional extras: [sqs], [redis], [rabbitmq]. See Installation.
Quick start
from event_bus import EventBus, EventBusRegistry, EventMessage, EventMessageHandler
from event_bus.adapters import InMemoryEventBusAdapter
registry = EventBusRegistry()
adapter = InMemoryEventBusAdapter(queue_name="events")
bus = EventBus(queue_adapter=adapter, event_registry=registry)
@registry.event()
def on_order_created(order_id: str, amount_cents: int):
print(f"Order {order_id}: {amount_cents} cents")
# Fire-and-forget
await bus.execute(on_order_created(order_id="ord-1", amount_cents=1999), wait=False)
# Worker: poll and dispatch
await bus.work()
For full examples (messages, handlers, SQS/Redis, execute-and-wait), see the documentation.
Documentation
| Topic | Description |
|---|---|
| Installation | Package and extras. |
| Quick start | Messages, handlers, register, execute. |
| Handler decorator | @registry.event() and message factory. |
| Message formats and parsers | Repr, JSON, Base64, custom parser. |
| Client and worker | Shared module, producer, consumer. |
| Queue adapters | In-memory, SQS, RabbitMQ, Redis. |
| Execute and wait | Response store, request/response. |
| API reference | Types and methods overview. |
License
MIT
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 deegzlibs_event_bus-1.2.0.tar.gz.
File metadata
- Download URL: deegzlibs_event_bus-1.2.0.tar.gz
- Upload date:
- Size: 25.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a29924460399cc95babc2d96411ddb2986e2de292e2a0d11b3f2a54c4ddc4c9
|
|
| MD5 |
af35bd228da5a616723b3dfe203fa61d
|
|
| BLAKE2b-256 |
f5493a2aa02e71d735b26ecc48be80658d8a3b8cbe50204f3e96fce491f76ec8
|
File details
Details for the file deegzlibs_event_bus-1.2.0-py3-none-any.whl.
File metadata
- Download URL: deegzlibs_event_bus-1.2.0-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dce6ccaea2b542562343827b467d820bd7cd7d4a0e8ae03f24cc3c338a96945
|
|
| MD5 |
51d2eda1da780acd788d18ede5ecf6d8
|
|
| BLAKE2b-256 |
5fb4d73d2c393fb601b0f4941907c75d9e36180a66cc8b7c0949670f3c5ec24f
|