Skip to main content

How to Continue-As-New-in-Go

To cause a Workflow Execution to Continue-As-New, the Workflow function should return the result of the NewContinueAsNewError() API available from the go.temporal.io/sdk/workflow package.

func SimpleWorkflow(ctx workflow.Context, value string) error {
...
return workflow.NewContinueAsNewError(ctx, SimpleWorkflow, value)
}

To check whether a Workflow Execution was spawned as a result of Continue-As-New, you can check if workflow.GetInfo(ctx).ContinuedExecutionRunID is not nil.