OutboxBus
Sovereign Physical Distribution Platform · Cluster Node
Guaranteed at-least-once event delivery pairing atomic database mutations with Apache Kafka topic distribution.
Distributed systems cannot safely write to a database and publish to a message broker in two uncoordinated steps. Pegasus implements an atomic Transactional Outbox pattern: state mutations and outbox event rows are committed in the same database transaction. Dedicated Go worker pools tail the outbox and stream events to Kafka with zero data loss.
Architecture & Performance Highlights
Zero Phantom Events
Events are never emitted if a database transaction aborts or rolls back.
Partition Ordering
Events keyed by supplier_id and order_id guarantee strict per-entity causal ordering in Kafka partitions.
Sub-40ms Propagation
High-performance poller and changefeed streaming pushes events to WebSocket hubs in under 40 milliseconds.
Standard Operating Procedure
Atomic Read-Write Transaction Write
Inside a Spanner read-write transaction (or Postgres Serializable block), write the domain entity mutation and insert an OutboxEvent row.
Go Outbox Publisher Polling
Stateless Go background workers query un-published outbox records with row-level locks, publishing to corresponding Kafka topics.
Consumer Acknowledgment & De-duplication
Downstream services consume events and use idempotent deduplication tables to handle at-least-once message delivery safely.
No Direct Broker Emits in Handlers
HTTP/gRPC request handlers are strictly forbidden from publishing directly to Kafka. All state emissions must pass through the atomic outbox table.
Keep Exploring Pegasus Architecture & Operations
Based on the invariants, physical actors, and data flows of this module, explore these recommended companion guides and operational playbooks.
WebSocket Event Hub
Kafka events published by the outbox worker are fanned out to active user interfaces via the WebSocket hub.
Kafka Schema Contracts
View the strict Protobuf and JSON Schema event envelopes published by the outbox engine.
