Continue-As-New
This page discusses Continue-As-New and how to decide when to use it.
What is Continue-As-New?
Continue-As-New allows you to checkpoint your Workflow's state and start a fresh Workflow.
There are two main reasons you might want to start a new Workflow:
- A Workflow Execution with a long, or large Event History, such as one calling many Activities, may bog down and have performance issues. It could even generate more Events than allowed by the Event History limits.
- A Workflow Execution can hit Workflow Versioning problems if it started running on an older version of your code and then begins executing on a newer version.
Your goal is to create a new Workflow with a fresh history that picks up where your last one left off. First, pass your latest relevant state into Continue-As-New. This hands it to a new Execution in the Execution Chain. This state is passed in as arguments to your Workflow. The parameters are typically optional and left unset by the original caller of the Workflow.
The new Workflow Execution has the same Workflow Id, but a different Run Id, and starts its own Event History.
You can repeat Continue-As-New as often as needed, which means that your Workflow can run forever. Workflows that do this are often called Entity Workflows because they represent durable objects, not just processes.
- How to Continue-As-New using the Go SDK
- How to Continue-As-New using the Java SDK
- How to Continue-As-New using the PHP SDK
- How to Continue-As-New using the Python SDK
- How to Continue-As-New using the TypeScript SDK
- How to Continue-As-New using the .NET SDK