Pegasus Logo
跳转到主体内容
PegasusDocs
KAFKA EVENT BUS

OutboxBus

Sovereign Physical Distribution Platform · Cluster Node

v4.2.0
·
Last updated September 2026
·
9 min read

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

100% Atomic

Zero Phantom Events

Events are never emitted if a database transaction aborts or rolls back.

FIFO Keyed

Partition Ordering

Events keyed by supplier_id and order_id guarantee strict per-entity causal ordering in Kafka partitions.

<40ms Lag

Sub-40ms Propagation

High-performance poller and changefeed streaming pushes events to WebSocket hubs in under 40 milliseconds.

Standard Operating Procedure

01

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.

02

Go Outbox Publisher Polling

Stateless Go background workers query un-published outbox records with row-level locks, publishing to corresponding Kafka topics.

03

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.