:::warning
Update-with-start is considered experimental.
:::
Update-with-start allows you to start a workflow and immediately apply an update atomically. This ensures the workflow starts with the desired state modification already applied.
To enable this, configure the Protobuf service definition using the (temporal.v1.workflow).update.start option. In Go, the generated client provides a method (e.g., CreateFooWithUpdateFooProgress) that returns both the result of the initial update and a handle to the workflow run.
// Protobuf configuration
service Example {
rpc CreateFoo(CreateFooRequest) returns (CreateFooResponse) {
option (temporal.v1.workflow) = {
update: { ref: "UpdateFooProgress", start: true }
};
}
rpc UpdateFooProgress(SetFooProgressRequest) returns (GetFooProgressResponse) {
option (temporal.v1.update) = {};
}
}
// Go usage
updateResult, workflowRun, err := client.CreateFooWithUpdateFooProgress(ctx,
&examplev1.CreateFooRequest{Name: "test"},
&examplev1.SetFooProgressRequest{Progress: 50.0},
)
// Access workflow run
finalResult, err := workflowRun.Get(ctx)