Defining workflow tasks and steps
How a multi-step job is described in code, what makes a step safe to retry, and why the boundary you draw between steps decides how well retries work.
What this covers
Defining a workflow means splitting a job into steps and deciding where the boundaries fall. The boundary matters more than the code inside it: everything within one step reruns together on a retry, so a step that charges a card and then sends an email will send that email twice if it fails after the charge. The rule of thumb is one external side effect per step. Each step should also be safe to attempt twice, usually by carrying a unique key the other system recognises, so a repeat is ignored rather than duplicated.
Workflows are not available on Voroa today, so there is nothing to define here. The idea of one side effect per unit of work is still worth applying inside a background worker.