Skip to main content

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


Download files

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

Source Distribution

deegzlibs_event_bus-1.0.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deegzlibs_event_bus-1.0.0-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file deegzlibs_event_bus-1.0.0.tar.gz.

File metadata

  • Download URL: deegzlibs_event_bus-1.0.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.16

File hashes

Hashes for deegzlibs_event_bus-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6d3c0ac2d53222cda66a6815346726d08fb2dfa9f1655dcb040acd4d40b04b08
MD5 716f799997f38019d56d85ea95a2ba3f
BLAKE2b-256 4393ace83be82080f4e6ca71d6095c545159aea917da673c8e080d212d31c9ac

See more details on using hashes here.

File details

Details for the file deegzlibs_event_bus-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for deegzlibs_event_bus-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4b3c0e8f3885ff049a9fc3808d0a6d0dfaee5739076f14c706672f940339f99
MD5 ecb5713a85a640dbe889ad23c28d9364
BLAKE2b-256 3522c3c36c52d7995cb9642494dc6283ddd86dec57777be4beed44787361aff9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page