Overview
Theeffect/unstable/workflow modules provide tools for building durable workflows that:
- Survive process restarts
- Handle long-running operations
- Maintain state across interruptions
- Coordinate distributed activities
What are workflows?
Workflows are durable execution contexts that can:- Persist state - Workflow state is stored and restored across restarts
- Handle delays - Wait for hours, days, or weeks without blocking
- Coordinate activities - Orchestrate multiple operations across services
- Recover from failures - Automatically retry failed activities
Defining a workflow
Activities
Activities are the units of work performed by workflows:Signals
Signals allow external events to communicate with workflows:Durable delays
Workflows can wait without consuming resources:Starting workflows
Querying workflows
Workflow state
Workflows maintain durable state:Error handling
Activities can be retried automatically:Workflow proxy
Call workflows like regular functions:Complete example
Use cases
- Order processing - Handle multi-step order fulfillment
- Approval flows - Wait for human approval in business processes
- Scheduled tasks - Run tasks at specific times or intervals
- Sagas - Coordinate distributed transactions
- Event-driven processes - React to events over long periods