Hi. I have a case when i get data from third-party service and want to cancel activity and workflow with err.
I was trying to return nonretryable error.
func (v *VMOps) DeleteProtectionPlanActivity(ctx context.Context, data ProtectionPlanData) error {
// .......
if data.Ref == "" {
return temporal.NewNonRetryableApplicationError("someaaa", "NewNonRetryableApplicationError", errors.New("failed"), "details here")
}
// .......
}
func workflow() {
// somewhere at workflow, also error type is added
ctx = workflow.WithActivityOptions(
ctx,
workflow.ActivityOptions{
StartToCloseTimeout: time.Hour,
RetryPolicy: &temporal.RetryPolicy{
NonRetryableErrorTypes: []string{"NewNonRetryableApplicationError"},
},
},
)
slog.Debug("started protection plan removing")
err := workflow.ExecuteActivity(ctx, nullVMOps.DeleteProtectionPlanActivity, data).Get(ctx, &data.Ref)
if err != nil {
return err
}
}
But it won’t help. Activity retries over and over again.
3:14PM DBG started protection plan removing service=unknown
3:14PM DBG ExecuteActivity ActivityID=5 ActivityType=DeleteProtectionPlanActivity Attempt=1 Namespace=default RunID=72d74bb1-15af-4422-816b-5ea5bc8f9eac TaskQueue=edgeclient WorkerID=46116@sc-mac-01014@ WorkflowID=DeleteProtectionPlan:(name01) WorkflowType=DeleteProtectionPlanWorkflow service=unknown
3:14PM ERR Activity error. ActivityType=DeleteProtectionPlanActivity Attempt=1 Error="someaaa (type: NewNonRetryableApplicationError, retryable: false): failed" Namespace=default RunID=72d74bb1-15af-4422-816b-5ea5bc8f9eac TaskQueue=edgeclient WorkerID=46116@sc-mac-01014@ WorkflowID=DeleteProtectionPlan:(name01) service=unknown
3:14PM DBG started protection plan removing service=unknown
3:14PM DBG ExecuteActivity ActivityID=5 ActivityType=DeleteProtectionPlanActivity Attempt=2 Namespace=default RunID=cebaa993-2bd5-4e3e-8b58-c99cf1aafcb9 TaskQueue=edgeclient WorkerID=46116@sc-mac-01014@ WorkflowID=DeleteProtectionPlan:(name01) WorkflowType=DeleteProtectionPlanWorkflow service=unknown
3:14PM ERR Activity error. ActivityType=DeleteProtectionPlanActivity Attempt=1 Error="someaaa (type: NewNonRetryableApplicationError, retryable: false): failed" Namespace=default RunID=cebaa993-2bd5-4e3e-8b58-c99cf1aafcb9 TaskQueue=edgeclient WorkerID=46116@sc-mac-01014@ WorkflowID=DeleteProtectionPlan:(name01) service=unknown
3:14PM DBG started protection plan removing service=unknown
3:14PM DBG ExecuteActivity ActivityID=5 ActivityType=DeleteProtectionPlanActivity Attempt=3 Namespace=default RunID=c6760fbe-d92d-4aff-9376-8c0116d7f589 TaskQueue=edgeclient WorkerID=46116@sc-mac-01014@ WorkflowID=DeleteProtectionPlan:(name01) WorkflowType=DeleteProtectionPlanWorkflow service=unknown
3:14PM ERR Activity error. ActivityType=DeleteProtectionPlanActivity Attempt=1 Error="someaaa (type: NewNonRetryableApplicationError, retryable: false): failed" Namespace=default RunID=c6760fbe-d92d-4aff-9376-8c0116d7f589 TaskQueue=edgeclient WorkerID=46116@sc-mac-01014@ WorkflowID=DeleteProtectionPlan:(name01) service=unknown
I see in logs that retryable: false, but workflow rerun forever. How to exit from workflow?