Software Engineering

What is the Saga Microservices Pattern?

Java Guides · 7/16/2026 · 1 min read · source


Key Technical Concepts:
- Saga pattern for distributed systems transaction handling
- Local transactions vs distributed transactions
- Compensating transactions for rollback
- Choreography vs orchestration coordination
- Event-driven & command-driven coordination

Architecture Decisions:
- Breaking long-running transaction into smaller local transactions
- Each service handles own database & logic
- No global lock or distributed transaction
- Orchestrator role: order service in example

Flow:
1. Order service creates order in pending state
2. Call inventory service: reserve items
3. Call payment service: charge customer
4. Confirm order
On failure: trigger compensating transactions (release reserved stock, update order to cancelled)

Best Practices:
- Always have compensating actions plan for failure
- Use events or commands for coordination
- Keep workflow as local steps

Specific Technologies, Frameworks, Libraries:
- Java ecosystem
- Spring Boot
- Message brokers: Kafka, RabbitMQ
- Orchestration engines: Camunda, Temporal, Netflix Conductor

More in this category