step

fun <R> step(name: String, action: suspend () -> R, compensation: suspend (R) -> Unit? = null): SagaBuilder<T>(source)

Adds a step to the saga.

Parameters

name

Human-readable name for the step

action

The action to execute

compensation

The compensation action to execute on failure (optional)