cancel
Showing results for 
Search instead for 
Did you mean: 

Do something when max retries is reached for a task

spartan
Champ in-the-making
Champ in-the-making
I would like to move the execution point to another branch of the workflow when the max number of automatic retries is reached for a service task.

I guess I have to add an "errorBoundaryEvent" to the monitored service task and that I could handle the routing from the delegate ; if {max retry is reached } then {move to error handling branch} else {let the retry engine do his part}. But I don't like the idea of handling it that way plus I dont want to duplicate that routing code for every single service task we have. I'd rather have it handled on the engine side. Do you know what would be a proper solution ?
4 REPLIES 4

spartan
Champ in-the-making
Champ in-the-making
So I ended up implementing that logic in the delegate. I'm throwing a BpmnError when max repeat is reached. The errror handling branch is then started (by a errorBoundaryEvent).

The problem is that now it ends up with a "RollbackException: Transaction marked as rollbackOnly"…

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Spartan,

There are many possibilities e.g.:
- try to implement your custom org.activiti.engine.impl.jobexecutor.FailedJobCommandFactory. Add it to the process engine configuration. In the created command when retries are 0 -> throw BpmnError.
- Listen to JOB_RETRIES_DECREMENTED entity event and when there is 0 -> throw BpmnError event.
….

Regards
Martin

spartan
Champ in-the-making
Champ in-the-making
- try to implement your custom org.activiti.engine.impl.jobexecutor.FailedJobCommandFactory. Add it to the process engine configuration. In the created command when retries are 0 -> throw BpmnError.
- Listen to JOB_RETRIES_DECREMENTED entity event and when there is 0 -> throw BpmnError event.
Just tried that : The BpmnError is thrown but my error handling branch is not triggered…

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Can you create jUnit test for your case?
https://forums.activiti.org/content/sticky-how-write-unit-test

regards
Martin
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.