Skip to content

solutions_backend.publication.manager

Lease-safe at-least-once publication of canonical WorkOrder transitions.

Classes

OutboxDispatcher

Claim a bounded batch, publish independently, and durably acknowledge each row.

Delivery is intentionally at least once: if a publisher loses its acknowledgement, the row is retried with the same immutable event identity. Every downstream consumer must therefore deduplicate by idempotency_key.

dispatch_once

dispatch_once() -> OutboxDispatchResult

Dispatch one bounded slice without letting one bad event block later rows.

OutboxPublisher

Bases: Protocol

Publish one event using event_id as the consumer deduplication key.

publish

publish(topic: str, payload: dict[str, JsonValue], idempotency_key: UUID) -> None

OutboxStore

Bases: Protocol

Exact durable lease/ack boundary owned by Solutions Data.

claim_batch

claim_batch(lease_owner: UUID, now: datetime, lease_expires_at: datetime, limit: int = 100, max_attempts: int = 20) -> tuple[WorkOrderOutboxEvent, ...]

mark_failed

mark_failed(event_id: UUID, lease_owner: UUID, failed_at: datetime, safe_error: str) -> WorkOrderOutboxEvent

mark_published

mark_published(event_id: UUID, lease_owner: UUID, published_at: datetime) -> WorkOrderOutboxEvent