SagaCompensator class

Executes saga compensation (rollback) for failed workflow executions.

When a workflow execution fails, the compensator:

  1. Transitions execution to COMPENSATING status
  2. Finds all COMPLETED steps with registered compensate functions (reverse order)
  3. Executes each compensation function
  4. Records COMPENSATED checkpoint for each
  5. Transitions execution to FAILED status

Constructors

SagaCompensator({required CheckpointStore store})
Creates a SagaCompensator.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

compensate(String workflowExecutionId, Map<String, Future<void> Function(dynamic)> compensateFunctions, {Map<String, dynamic> compensateResults = const {}, void onCompensateError(String stepName, Object error)?}) Future<void>
Runs saga compensation for the given execution.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited