# BPMN jobs: Overriding no' of retries and default retry wait time via application.yaml

**URL:** <https://forum.flowable.org/t/bpmn-jobs-overriding-no-of-retries-and-default-retry-wait-time-via-application-yaml/10799>\
**Category:** Flowable Engine\
**Created:** [August 27, 2023, 6:39pm UTC](https://forum.flowable.org/t/bpmn-jobs-overriding-no-of-retries-and-default-retry-wait-time-via-application-yaml/10799 "2023-08-27T18:39:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sagar-kalburgi-ripco](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/sagar-kalburgi-ripco/32/3124_2.png) [@sagar-kalburgi-ripco](https://forum.flowable.org/u/sagar-kalburgi-ripco)\
**Post date:** [August 27, 2023, 6:39pm UTC](https://forum.flowable.org/t/bpmn-jobs-overriding-no-of-retries-and-default-retry-wait-time-via-application-yaml/10799/1 "2023-08-27T18:39:58Z")

</div>

Hi,

I want to be able to override the default values for number of retries and retry wait time for BPMN jobs. As I understand it, the default values for the same are defined here:

> <https://github.com/flowable/flowable-engine/blob/main/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/interceptor/RetryInterceptor.java#L29>

I also understand that there is an exponential back-off every time before a retry.  
Although the values seem to be hard coded to me, I also see that it they are configurable as per this doc: [https://github.com/flowable/flowable-engine/blob/main/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json#L602C29-L602C29](https://github.com/flowable/flowable-engine/blob/main/modules/flowable-spring-boot/flowable-spring-boot-starters/flowable-spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json#L602C29-L602C29)

Another thing I found is that these values can be overridden at the serviceTask level: [BPMN 2.0 Constructs · Flowable Open Source Documentation](https://www.flowable.com/open-source/docs/bpmn/ch07b-BPMN-Constructs#fail-retry)  
But on Flowable design, I did not see a way to override them for a serviceTask or a processTask.

Basically I want to override them at the Flowable engine level, and would also like to know how I can override them at process definition level via Flowable engine. We use Flowable engine, and do not edit the XML files ourselves.

Looking forward to hear from you!

---

<div class="post-metadata">

**Author:** ![valentin](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/valentin/32/3367_2.png) [@valentin](https://forum.flowable.org/u/valentin)\
**Post date:** [August 28, 2023, 7:03am UTC](https://forum.flowable.org/t/bpmn-jobs-overriding-no-of-retries-and-default-retry-wait-time-via-application-yaml/10799/2 "2023-08-28T07:03:24Z")

</div>

Hi @sagar-kalburgi-ripco,

you can use the method `ProcessEngineConfigurationImpl#setAsyncExecutorNumberOfRetries`.

In the Flowable Cloud Design you can change it on a service task level below the advanced option as part of the Failed Job Retry Time Cycle.

Valentin

---

<div class="post-metadata">

**Author:** ![sagar-kalburgi-ripco](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/sagar-kalburgi-ripco/32/3124_2.png) [@sagar-kalburgi-ripco](https://forum.flowable.org/u/sagar-kalburgi-ripco)\
**Post date:** [August 29, 2023, 12:48am UTC](https://forum.flowable.org/t/bpmn-jobs-overriding-no-of-retries-and-default-retry-wait-time-via-application-yaml/10799/3 "2023-08-29T00:48:32Z")

</div>

Hi @valentin  
Thanks for the response. Even if I make use of ProcessEngineConfigurationImpl#setAsyncExecutorNumberOfRetries, if a job fails due to OptimisticLockException, the number of retries that I set will get overridden by the number of retries hardcoded on this class right? [https://github.com/flowable/flowable-engine/blob/main/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/interceptor/RetryInterceptor.java#L29](https://github.com/flowable/flowable-engine/blob/main/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/interceptor/RetryInterceptor.java#L29)

And on Flowable design I checked and I do not see the advanced option to set the retry time on the configuration of service task.

---

<div class="post-metadata">

**Author:** ![amporsim](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@amporsim](https://forum.flowable.org/u/amporsim)\
**Post date:** [August 29, 2023, 6:23am UTC](https://forum.flowable.org/t/bpmn-jobs-overriding-no-of-retries-and-default-retry-wait-time-via-application-yaml/10799/4 "2023-08-29T06:23:45Z")

</div>

Hi @sagar-kalburgi-ripco

Your service task must be set to asynchronous = true, then you see the retry option. Because the retry mechanism does only work for asynchronous tasks.

Regards,  
Simon
