stepWithRetry

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

Adds a step with retry capability.

Parameters

name

Human-readable name for the step

retries

Number of retry attempts

action

The action to execute

compensation

The compensation action to execute on failure (optional)