step

fun step(step: TypedValue, timeout: Duration? = null, forward: suspend (C) -> R): SagaBuilder<C, R>

Define a saga step with forward logic and optional timeout.

This method finalizes the previous step (if any) and starts configuring a new step. The forward action receives the saga context and produces a result that will be passed to the compensation handler if the saga fails.

The forward action is a suspend function, allowing for async operations.

Return

This builder for method chaining

Parameters

step

Step identifier wrapped in TypedValue (can be enum or string)

timeout

Maximum execution time for this step (null = no timeout)

forward

Suspend function that executes the step's forward logic


fun step(name: String, timeout: Duration? = null, forward: suspend (C) -> R): SagaBuilder<C, R>

Define a saga step with string name (convenience overload).