Durable.Executor.CompensationRunner (Durable v0.1.0-rc)

View Source

Executes compensation handlers for saga pattern rollbacks.

Compensations are executed in reverse order when a workflow step fails and need to undo the effects of previously completed steps.

Behavior

  • Compensations run in reverse order (last completed step first)
  • Each compensation is recorded as a step_execution with is_compensation: true
  • Compensation failures are logged but don't stop the compensation chain
  • Retry logic is supported for individual compensations

Summary

Functions

Executes a single compensation handler with retry logic.

Types

result()

@type result() :: {:ok, any()} | {:error, any()}

Functions

execute(compensation, workflow_id, compensating_step, config)

Executes a single compensation handler with retry logic.

Returns {:ok, output} on success or {:error, reason} after all retries exhausted. Compensation errors don't stop the chain - they are recorded and the process continues.