Siglo provides first-class support for forward execution with automatic backward compensation.
1. Core Saga Pattern & Automatic LIFO Rollback
Compensations execute in exact reverse order (LIFO) of step completion. Only steps that completed successfully prior to the point of failure are compensated.2. Compensation Registration Patterns
Siglo supports both inline closures and decoupled named compensation handlers.A. Inline Closures (In-Memory Sagas)
Suitable for single-process, short-lived workflows:B. Named Handlers & Global Registry (Durable & Multi-Process Sagas)
When workflows are persisted to storage (PostgreSQL, Redis) across service restarts or code deployments, JavaScript closures cannot be serialized. Register named handlers at application startup:3. Compensation Retry Policy
Transient failures during compensation can be retried with fixed delays or custom conditional predicates:4. Execution Modes: Strict vs. Best-Effort
When rolling back compensations, Siglo supports two execution modes viaCompensationRunOptions:
