How do you handle long-running workflows that span days or weeks?
Long-running workflows require durable state management since processes cannot be held in memory across days or weeks. Persist workflow state to a database after each step completion, allowing the system to resume from the last checkpoint after restarts, crashes, or deployments. Use workflow engines like Temporal, Camunda, or AWS Step Functions that inherently support durable execution. Implement timer-based triggers for scheduled steps like waiting 3 days for customer response then sending reminder. Handle external event injection where the workflow pauses until receiving a signal like payment confirmation or manager approval. Manage timeouts and deadlines with escalation paths when human tasks exceed SLAs. Provide visibility dashboards showing all in-progress workflows with their current step, elapsed time, and next expected action. Implement cancellation and modification capabilities for workflows that need to be updated or terminated mid-execution. Archive completed workflow execution history for compliance and analysis.