cancel
Showing results for 
Search instead for 
Did you mean: 

Restart process after exception.

mhanrahan
Confirmed Champ
Confirmed Champ
I have a process that is something along the lines of:
Start -> Service Task 1 (async = true) -> Service Task 2 (async = true) -> End.

However Service Task 2 has a chance of throwing an exception, which is fine, as it will only roll back to before Service Task 2.  What I'm unsure about is how to recover from this position if the number of retries is reached.

In the user guide in the section about Exclusive Jobs (http://activiti.org/userguide/index.html#exclusiveJobs) it says:

Activiti will retry the same job for a fixed maximum number of times only ('3' in the default configuration). After that, the job will still be present in the database but not be retried actively anymore. That means that an operator would need to trigger the job manually.

How would this triggering manually be done?  is there an API call to resume a job that has hit the retry limit?  or is it some manipulation of the database that would need to be done in order to achieve this?
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
Yes, use the managementService.createJobQuery to get the job, and the managementService.executeJob() to execute it

david_bellem
Champ in-the-making
Champ in-the-making
Is there a way to do this with only database access?
In my case it is an async task that failed and I want to rerun it.

Do I now have to write a java application that connects to the Activiti instance or is there a way to remove the entry in ACT_RU_JOB and insert a new one so that it will be executed the next time the executor runs?

jbarrez
Star Contributor
Star Contributor
You can set the 'retries' of the job to 3 again. The job executor will pick it up again then.