python_outbox_core.publisher.interface ====================================== .. py:module:: python_outbox_core.publisher.interface .. autoapi-nested-parse:: Event publisher interface. Best Practices Applied: 1. Interface Segregation Principle (single responsibility) 2. Broker-agnostic (Kafka, RabbitMQ, etc.) 3. Async/await for non-blocking I/O 4. Simple contract for easy testing References: - ISP: https://en.wikipedia.org/wiki/Interface_segregation_principle Classes ------- .. autoapisummary:: python_outbox_core.publisher.interface.IEventPublisher Module Contents --------------- .. py:class:: IEventPublisher Bases: :py:obj:`abc.ABC` Interface for event publishing (Kafka, RabbitMQ, etc.). Projects implement this for their specific message broker. Keeps outbox library broker-agnostic. Example implementations: - KafkaPublisher (via FastStream) - RabbitMQPublisher (via aio-pika) - SQSPublisher (via aiobotocore) .. py:method:: publish(message: dict[str, Any]) -> None :abstractmethod: :async: Publish event to message broker. Implementation must handle: - Connection management - Serialization (if needed beyond JSON) - Retry logic (or delegate to Tenacity) - Topic/exchange routing Args: message: JSON-serializable event payload Raises: PublishError: On transient/permanent publish failures