Messaging Patterns
The Saga Pattern: Distributed Transactions Without 2PC
Coordinate long-running business transactions across services using a sequence of local transactions and compensating actions.
A Saga is a sequence of local transactions where each step publishes an event or sends a message to trigger the next. If a step fails, the saga executes compensating transactions to undo the work already done. There are two coordination styles: choreography (each service reacts to events with no central orchestrator) and orchestration (a central saga orchestrator directs each participant).
Continue reading
- →
Dependency Injection and IoC Containers
Invert control of dependency creation to keep classes decoupled from their collaborators and trivially testable.
- →
The Observer Pattern and Event-Driven Design
Decouple publishers from subscribers by letting objects register interest in events without the producer knowing who is listening.
- →
The Strategy Pattern: Encapsulating Algorithms
Define a family of algorithms, encapsulate each one, and make them interchangeable — open for extension, closed for modification.