cancel
Showing results for 
Search instead for 
Did you mean: 

Retry an email task

himanshu_agarwa
Champ in-the-making
Champ in-the-making
Hi Team,

I have a requirement where I have an email task and I want it to retry for 5 times until it throws some exception (may be due to some network issue). If after 5 times also, we get an exception than continue the flow as it was supposed to.

I have a sprint boot app with activiti dependency

So, can you pls answer below queries
1. how can I change the default retry count from 3 to 5?
2. how can I get number of retries remaining for a particular job in email executor (Java Delegate)

If I am able to get crack both these conditions than I can append try catch in email task and on reaching the threshold, I can catch the exception and continue the flow.
1 REPLY 1

gdharley
Elite Collaborator
Elite Collaborator

The retry count for both Job and Timer threads is actually hard coded in the JobEntity.java class

  public static final int DEFAULT_RETRIES = 3;

You can change it here and recompile the engine.
In order to check the number of retries remaining, you can use the managementService.createJobQuery() to retrieve a list of jobs. The retry count is an exposed parameter in the returned list.

Greg