SurfSense/surfsense_backend/app/event_bus/__init__.py
CREDO23 d6dfe53d62 feat(event_bus): add in-process domain event bus
A standalone, domain-agnostic pub/sub seam: an EventBus that owns its
subscriber registry and streams Event values from producers to listeners
in process. Boundary-crossing (Celery/DB/workers) is left to subscribers,
keeping the bus single-responsibility. Includes the immutable Event value
object and full unit coverage.
2026-05-29 15:26:12 +02:00

20 lines
479 B
Python

"""In-process domain event bus.
Domain-agnostic pub/sub. Producers ``await bus.publish(...)``; subscribers
``bus.subscribe(...)``. Domain modules depend on it, never the reverse.
from app.event_bus import bus
await bus.publish("document.indexed", {"document_id": 42}, search_space_id=7)
"""
from __future__ import annotations
from .bus import EventBus, Subscriber, bus
from .event import Event
__all__ = [
"Event",
"EventBus",
"Subscriber",
"bus",
]