recordSagaStep

@Transactional
open fun recordSagaStep(sagaId: String, stepName: SagaTypeValue, status: SagaStepStatus, payload: Any? = null): T(source)

Type-safe overload of recordSagaStep that accepts the step name as a SagaTypeValue.


@Transactional
open fun recordSagaStep(sagaId: String, stepName: String, status: SagaStepStatus, payload: Any? = null): T(source)

Records (or transitions) a saga step.

Idempotent semantics:

  • If a step with the same stepName already exists in status — no-op.

  • If the existing step is in a terminal status — no-op.

  • Otherwise the existing step is transitioned via the port's behavior methods.

Transitioning a step to SagaStepStatus.FAILED additionally moves the owning saga to SagaStatus.COMPENSATING and schedules compensation after the current transaction commits (see scheduleCompensationAfterCommit).

Throws

if no saga with sagaId exists.