Could you please help me understand how can we achieve the same in Golang?
retryPolicy := &temporal.RetryPolicy{
InitialInterval: time.Second,
BackoffCoefficient: 2,
MaximumInterval: time.Minute,
MaximumAttempts: 10,
}
options := workflow.ActivityOptions{
StartToCloseTimeout: time.Minute * 5,
RetryPolicy: retryPolicy,
}
ctx = workflow.WithActivityOptions(ctx, options)
logger.Info("starting workflow!")
err := workflow.ExecuteActivity(
ctx,
Activity_1,
configuration,
workflow.GetInfo(ctx).WorkflowStartTime,
).Get(
ctx,
nil,
)
if err != nil {
return nil, err
}
err := workflow.ExecuteActivity(
ctx,
Activity_2,
configuration,
workflow.GetInfo(ctx).WorkflowStartTime,
).Get(
ctx,
nil,
)
if err != nil {
return nil, err
}
err := workflow.ExecuteActivity(
ctx,
Activity_3,
configuration,
workflow.GetInfo(ctx).WorkflowStartTime,
).Get(
ctx,
nil,
)
if err != nil {
return nil, err
}
Here, the Activities named as Activity_1, Activity_2, and Activity_3 would be retried 10 times in case of failure, since we have configured it as
MaximumAttempts: 10,
I want to do something like, I don’t want Activity_3 to be retried at all. I just want it to run once, in case of failure.
Also, I don’t want to declare the retry policy for Activity_3 again.
How can I achieve the same?
Is there any way, I can pass some or any argument to the workflow.ExecuteActivty() method to avoid the retried completely?
Any pointers or suggestions would help thanks.