A durable Lambda function must be wrapped with the withDurableExecution wrapper. The wrapper enables durable execution by providing the DurableContext object and managing checkpoint operations.
A durable function receives a DurableContext instead of the standard Lambda context.
This object provides methods for durable operations like step() and wait() that create checkpoints.
If your function is interrupted, it resumes from the last completed checkpoint. The function doesn't re-execute completed steps. It uses their stored results instead.
Each context.step() call in your function code creates a checkpoint before and after execution.
A context.wait() call pauses execution without consuming compute resources. This means your Lambda function is not sitting idle whilst waiting to resume. When the wait completes, Lambda invokes your function again and replays the checkpoint log, substituting stored values for completed steps.
Your durable function code must be deterministic. This is because whenever the function is replayed (after resuming from a wait or interruption) from the last completed checkpoint and does not re-execute completed steps. If your code is not deterministic, the function may produce different results than expected on replay.
- Local testing
- Local development
- I/O
- Durable operations/operation detail
- Event history