compensate
fun compensate(compensation: suspend CompensationScope<R, S>.() -> Unit): StatefulSagaBuilder<C, R, S>
Define compensation logic for the current step.
The compensation action is executed with a CompensationScope receiver, providing access to both the step's result and the current saga state. This enables "smart compensation" based on execution progress.
Must be called after step.
Return
This builder for method chaining
Parameters
compensation
Suspend function that compensates (undoes) the step
Throws
if called before step