ServiceComb Saga Omega Source Analysis
ServiceComb Saga uses compensating actions rather than a global ACID transaction across services. Omega runs inside each service, while Alpha coordinates saga events and recovery.
Omega intercepts methods marked as saga transactions or compensable operations. It creates transaction identifiers, reports start and completion events, and associates a forward operation with its compensation method.
When a later step fails, Alpha determines which completed operations require compensation and sends commands back to the relevant services. Compensation methods must be idempotent because retries, duplicate commands, and partial failures are expected.
A compensation is a business reversal, not a database rollback. It may need to issue a refund, restore inventory, or mark a record as canceled while preserving audit history. Some effects cannot be perfectly reversed and require manual reconciliation.
Record saga IDs in logs and business tables, protect event ordering assumptions, define timeouts and retry limits, and monitor stuck or repeatedly failing compensations. Test process crashes between local commit and event reporting, not only normal exceptions.