Do something when max retries is reached for a task

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 06:06 AM
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 ?
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 ?
Labels:
- Labels:
-
Archive
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 01:41 PM
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"…
The problem is that now it ends up with a "RollbackException: Transaction marked as rollbackOnly"…
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2016 03:26 PM
Hi Spartan,
There are many possibilities e.g.:
- try to implement your custom
- Listen to JOB_RETRIES_DECREMENTED entity event and when there is 0 -> throw BpmnError event.
….
Regards
Martin
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

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2016 06:08 AM
- 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.Just tried that : The BpmnError is thrown but my error handling branch is not triggered…
- Listen to JOB_RETRIES_DECREMENTED entity event and when there is 0 -> throw BpmnError event.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2016 07:26 AM
Hi,
Can you create jUnit test for your case?
https://forums.activiti.org/content/sticky-how-write-unit-test
regards
Martin
Can you create jUnit test for your case?
https://forums.activiti.org/content/sticky-how-write-unit-test
regards
Martin
