Activity retries in the workflow replay

Hi
I have a use case where I am calling external API thru the activity for which i have set maxAttempts to 3.
The workflow run failed after the maxAttempted reached, may be due to the server not available or timeout.
when I am running the workglow using replay, it is using the MaximumAttemptsReached in the previous instance.
How do i reset or ignore the retries made in the previous workflow instance run.
These following is the code i am using now

     builder = ActivityOptions.newBuilder()
            .setHeartbeatTimeout(Duration.ofSeconds(appProperties.getActivityHeartbeatTimeout()))
            .setScheduleToCloseTimeout(
                Duration.ofSeconds(appProperties.getActivityScheduleToCloseTimeout()))
            .setScheduleToStartTimeout(
                Duration.ofSeconds(appProperties.getActivityScheduleToStartTimeout()))
            .setStartToCloseTimeout(
                Duration.ofSeconds(appProperties.getActivityStartToCloseTimeout()))
            .setRetryOptions(RetryOptions.newBuilder()
                .setMaximumAttempts(appProperties.getActivityRetryAttempts())
                .build());

when I am running the workglow using replay

Do you mean using reset?

How do i reset or ignore the retries made in the previous workflow instance run.

You have to reset to the point before the activity invocation.

@maxim
Thanks for the quick response!
Let me be more explicit.
I have set my activity retries to 3
Ran a workflow, which uses this activity and it retried 3 times but the external system was down.
Now I wan to rerun this workflow, which should execute this activity as it failed with max retries It is not triggering the same, rather reading from history.
Is there any way i can reset some particular activity retries in the previous run.

The standard way to deal with the external system being down is to not specify max retries to 3, but keep it unlimited. Then when the downstream system is back the activity succeeds and the workflow continues.

I still don’t understand what you mean by " I want to rerun this workflow,". Temporal supports workflow rerun in form of reset feature. But I would recommend writing your workflows to not ever fail instead of relying on reset.