Payment Activity, Failed. Reset is hitting max retry limit

I have an activity which attempts a payment (not idempotent) and I want to limit the automatic retry to one so I have max retry at 1.

If I want to retry the payment manually I tried to reset the workflow (while retaining the history) but it tells me that it has already reached the max number of attempts.

I am not able to easily reproduce this error but should I have just used “–type=LastContinuedAsNew” option if I want to reattempt?

Have you seen samples-java/core/src/main/java/io/temporal/samples/retryonsignalinterceptor at main · temporalio/samples-java · GitHub?

It looks like this will retry the workflow, programatically. Is that different than the CLI/UI options because when I retried there I still ran into the max retry limit.

If this is different, is there a way to do this using the UI/CLI to get around the max retry limit when running it manually?

Reset is not intended for normal business logic. It is a mechanism to deal with bugs, etc.

Coding the interaction into the workflow logic is the recommended approach. I don’t understand the issue with the max retry limit. You said that you set attempts to 1.

In a scenario where its expensive to retry, I want it to automatically retry only once, so I set the max retry to 1.

If I then want to manually retry after the automatic one failed, I am hitting the retry limit.
Is the right approach then to add the interceptor?

I don’t understand what “retry limit” means. Temporal doesn’t have such a concept.

The interceptor just executes the same activity again when a signal is received. BTW you can implement this logic in the workflow directly if you don’t want to make it generic through an interceptor.

I have a workflow that fails sometimes because of bugs in a release.
Once I roll out the fixes, I’d like to manually retry the workflows but I am having trouble starting them up again.

Tried workflow with this option first

private final WorkflowOptions options = WorkflowOptions
   .newBuilder()
   .setWorkflowExecutionTimeout(Duration.ofDays(3))
   .setTaskQueue(TASK_QUEUE)
   .setRetryOptions(RetryOptions.newBuilder().setMaximumAttempts(1).build())
   .build();

when I try to reset the workflow in the UI, I choose the earliest event to reset to but the new run will fail immediately with RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED
Tried in CLI with this command

temporal workflow reset   --workflow-id 02d959d5-aa87-45f0-9968-b8d0333bbd9b   --reason "Retry with updated retry options"   --type FirstWorkflowTask

and I get the same results.

Then I tried removing .setRetryOptions(RetryOptions.newBuilder().setMaximumAttempts(1).build())

and now it looks like this

private final WorkflowOptions options = WorkflowOptions
   .newBuilder()
   .setWorkflowExecutionTimeout(Duration.ofDays(3))
   .setTaskQueue(TASK_QUEUE)
   .build();

When I try to manually reset it now I get RETRY_STATE_RETRY_POLICY_NOT_SET

Is the issue with the activities? Some of them are payment related and I do not want them to retry indefinitely.