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.1.0.tar.gz (24.7 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.1.0-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deegzlibs_event_bus-1.1.0.tar.gz
  • Upload date:
  • Size: 24.7 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.1.0.tar.gz
Algorithm Hash digest
SHA256 8e8bd0771f8a73b1346c6913f9f75e1f4b0dac06a8cb60e554680376a40b9035
MD5 673c9d2319c13b9b3ab275642064d72b
BLAKE2b-256 1100d21fa1469cf161f7d32e92cce3189789686cdb49461efc4ccd2985c7d9f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deegzlibs_event_bus-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 038f6ea5faa7ed0b6a3fb5926389ee1f38773c30ad12af72d82a10017c73d33c
MD5 6c11abc5dc5155f16adaeffe2362ee8d
BLAKE2b-256 7bda85ad9886e33bba6d29bd9aa3a0e3bf693de4207d00fda22aabfb808d72d7

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