# Overview The types of solutions for handling multi-step processes include... #flashcard - Single Server Orchestration - [[Event Sourcing]] - Workflow Managers - [[Durable Execution Engines]] - [[Managed Workflow Systems]] # Key Considerations ## Approaches for Handling Multi-step Processes ### Single Server Orchestration #flashcard A single server receives a request, calls downstream services sequentially, and returns the result. This starts to have limitations when you have reliability guarantees and complex cooridination: - What happens when one of the services fail? - How can you ensure a webhook goes back to the initiating API server? ### [[Event Sourcing#Overview]] ![[Event Sourcing#Overview]] # Implementation Details ## Common Deep Dives ### How will you handles updates to the workflows? #flashcard You can use two main approaches: - **Workflow Versioning** - if changes don't need to take place immediately, then we just create a new version of the workflow. Old workflows use the old code, now workflow use the new code. - **Workflow Migrations** - For declarative workflow systems, you simply update the workflow definition in place. For durable execution engines, you'll use a patch which helps the workflow system to decide deterministically whether a new path can be followed. For workflows that have passed through the patched branch before in their execution, they follow the legacy path. For new workflows that have yet to follow the patched branch, they follow the new path. ### How do we keep the workflow state size in check? #flashcard - First, be proactive and try to minimize the size of the activity input and results. Pass an ID that can be looked up in a database, rather than including everything in the payload. - Second, we can periodically recreate the workflow. Pass only the required inputs to the new workflow and keep going. ### How do we deal with external events? #flashcard Use signals for external events. This pattern handles human tasks, webhook callbacks, and integration with external systems. # Useful Links # Related Topics ## Use Cases - [[Design a Payment System]] - Human-in-the-loop Workflows ## Reference #### Working Notes #### Sources