Stateful Step Scope
Scope for forward step execution, providing access to saga state.
This scope is the receiver for forward action lambdas, enabling:
Reading current state via state property
Updating state via updateState function
Accessing previous step's result via result property
Example
first `do` "take-payment" with { cart ->
// Read current state
val currentAmount = state.paymentAmount
// Update state
updateState { it.copy(paymentAmount = payment.amount) }
// Access previous result (null for first step)
val previousOrder = result
createOrder(cart)
}Content copied to clipboard
Parameters
R
The type of result produced by saga steps
S
The type of shared saga state