What is a Step in Workflow?
mainA Step is the fundamental building block of a workflow. It is a function that implements business logic by processing the current workflow state.
Each step:
- Receives the current
Runstate (containing your business data). - Executes logic (e.g., database updates, API calls).
- Returns the next
Statusto transition to, or anerrorto trigger a retry.
Steps are type-safe, using a ConsumerFunc signature that binds a specific data type and status type to the step logic.
type ConsumerFunc[Type any, Status StatusType] func(
ctx context.Context,
r *Run[Type, Status]
) (Status, error)