Architecture
This section describes the internal architecture and design rationale of Go Event Bus.
The library is composed of three orthogonal layers:
- Event Definition & Serialization - Events, Registry, Envelopes, Upcasters
- Execution Pipeline (Invoker Chain) - Cross-cutting concerns as composable middleware
- Transport / Delivery Mechanism - LocalBus, NATS Core, JetStream
These layers are intentionally decoupled. You can change your transport without touching your invoker chain, evolve your schema without affecting handlers, and add middleware without modifying events.
This architecture prioritizes correctness, observability, and long-term maintainability over convenience.
In this section
- Execution Pipeline: how the invoker chain wraps a handler.
- Transport Layer: LocalBus, NATS Core and JetStream compared.
- Distributed Safety: idempotency and rate limiting across processes.
- Failure Model: what every error becomes on every transport.
- Adapter Contract: the normative rules a new transport adapter has to meet.