# Activity retries in the workflow replay

**URL:** <https://community.temporal.io/t/activity-retries-in-the-workflow-replay/1747>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [March 17, 2021, 2:52pm UTC](https://community.temporal.io/t/activity-retries-in-the-workflow-replay/1747 "2021-03-17T14:52:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramprasad\_Indarapu](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ramprasad_indarapu/32/718_2.png) [@Ramprasad\_Indarapu](https://community.temporal.io/u/Ramprasad_Indarapu)\
**Post date:** [March 17, 2021, 2:52pm UTC](https://community.temporal.io/t/activity-retries-in-the-workflow-replay/1747/1 "2021-03-17T14:52:59Z")

</div>

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

```java
     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());

```

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [March 17, 2021, 7:10pm UTC](https://community.temporal.io/t/activity-retries-in-the-workflow-replay/1747/2 "2021-03-17T19:10:46Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Ramprasad\_Indarapu](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ramprasad_indarapu/32/718_2.png) [@Ramprasad\_Indarapu](https://community.temporal.io/u/Ramprasad_Indarapu)\
**Post date:** [March 18, 2021, 3:41am UTC](https://community.temporal.io/t/activity-retries-in-the-workflow-replay/1747/3 "2021-03-18T03:41:37Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [March 18, 2021, 3:43am UTC](https://community.temporal.io/t/activity-retries-in-the-workflow-replay/1747/4 "2021-03-18T03:43:49Z")

</div>

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.
