saga
Saga Pattern
The Saga pattern manages data consistency across microservices in distributed transaction scenarios. A Saga is a sequence of local transactions. Each local transaction updates the database and publishes a message or event to trigger the next local transaction in the saga.
When to Use
- Distributed Transactions: e.g., "Book Flight" + "Book Hotel" + "Charge Card".
- Long-running processes where you can't hold a DB lock.
- Ensuring eventual consistency across Services A, B, and C.
Core Concepts
Compensating Transactions
If a step fails (e.g., Card Declined), the Saga must execute compensating transactions to undo the changes made by the preceding steps (e.g., "Cancel Hotel", "Cancel Flight").
Choreography
Each service listens to events and decides what to do.
More from g1joshi/agent-skills
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
34mariadb
MariaDB MySQL-compatible database with Galera clustering. Use for MySQL-compatible database needs.
6claude
Anthropic Claude AI models for analysis and coding. Use for AI assistants.
5javascript
JavaScript ES6+ programming including async/await, DOM manipulation, modules, and Node.js. Use for .js files and web development.
4typescript
TypeScript static typing with interfaces, generics, decorators, and type inference. Use for .ts files.
4python
Python programming with type hints, async/await, decorators, and package management. Use for .py files and data science.
4