call

Defines a saga step with "call 'name' with { ... }" syntax.

This is the preferred alternative to backtick-escaped do keyword.

Example:

first call "take-payment" with { cart ->
updateState { it.copy(amount = payment.amount) }
createOrder(cart)
} otherwise {
if (state.paymentAmount > 0) cashManager.returnEscrow()
}

infix inline fun <E : Enum<E>> call(step: E): StatefulSagaStepWithBuilder<C, R, S>

Defines a saga step with enum-based name: "call StepEnum.STEP with { ... }" syntax.

This provides type-safe step identification using enums instead of strings. The enum instance is preserved and can be retrieved via stepAs<E>() on events.

Example:

enum class OrderSteps { VALIDATE, PAYMENT, SHIP }

first call OrderSteps.VALIDATE with { cart ->
completes with validateOrder(cart)
} otherwise {
// compensation
}