In what scenarios does GetChildWorkflowExecution future returns error? Will these errors auto retryable?
Also currently i’m doing something like this
req := Request{}
cwf := workflow.ExecuteChildWorkflow(ctx, MyWorkflow, req)
var cwe workflow.Execution
if err := cwf.GetChildWorkflowExecution().Get(ctx, &cwe); err != nil {
return nil, cwe, err
}
var res *Response
if err := cwf.Get(ctx, &res); err != nil {
return nil, cwe, err
}
return res, cwe, nil
if i remove the cwf.GetChildWorkflowExecution().Get(ctx, &cwe)
completely will the cwf.Get(ctx, &res)
return the same error if the GetChildWorkflowExecution returns error?
It returns an error if the child workflow cannot be started due to duplicated workflowID.
You don’t need to call GetChildWorkflowExecution
unless you need to get its runID or ensure that it is started before completing workflow or doing some other operation like sending a signal to the child.
So your code can be reduced to:
req := Request{}
cwf := workflow.ExecuteChildWorkflow(ctx, MyWorkflow, req)
var res *Response
if err := cwf.Get(ctx, &res); err != nil {
return nil, err
}
return res, nil
thanks Maxim, so just to clarify, in case of outage on temporal cluster, the ExecuteChildWorkflow will auto-retry until the cluster is up?
Yes, all internal communication is retried automatically.
1 Like