cancel
Showing results for 
Search instead for 
Did you mean: 

Resume a service task after error occured

cocojack42
Champ in-the-making
Champ in-the-making
I have a Process based mostly on Service-Tasks.
What I want to achieve:

1) A servicetask notices an error.
2) Servicetask throws an error.
3) Error get caught by Event-Sub-Process
4) Sub process sends email and starts a userTask (to resolve the error by a user)
5) When userTask has been finished restart the Service-Task that threw the error and continue

Is this possible?

greetings Coco.
8 REPLIES 8

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Coco.

1-4 are supported by BPMN2.0.
5 -> You can make service task asynchronous and set retry times to 1. In that case you can restart task manually after the first failure.

Regards
Martin

cocojack42
Champ in-the-making
Champ in-the-making
From the User-Guide I get the information, that, if an error occurs and the task is async, it'll be stored in the database. Through the throwed error, the execution will be closed.

In my example the second Service-Tasks throws an BpmnException.
[img]http://picload.org/thumbnail/cgrlrll/example_process.png[/img]
How do I restart the Process beginning with the Service-Task "more Stuff"?

cocojack42
Champ in-the-making
Champ in-the-making
Do I need to add another ServiceTask (and use the TaskService) in order to start the Task?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

How do I restart the Process beginning with the Service-Task "more Stuff"?

When "more Stuff" task is asynchronous and it has failed, retries_ in the job are set to 0. Increasing retries_ in the DB should reinvoke "more Stuff" task again.

Regards
Martin

cocojack42
Champ in-the-making
Champ in-the-making
But it only get stored in the ACT_RU_JOB Table, when I don't catch the error thrown by the "more Stuff" task.
I guess when the error gets catched, everything is ok so far, thus the job "hasn't failed".
It is only stored in the Database when the Error isn't handled by the Process itself.

Therefore it won't work like the process I posted earlier.

cocojack42
Champ in-the-making
Champ in-the-making
I cant find Information how to set the retry count to 1. I just found the "JobEntry.DEFAULT_RETRIES". But I didn't want to edit the engine. Is there another way to change that?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,


org.activiti.engine.ManagementService#setJobRetries

sets the retries for the given job.
http://forums.activiti.org/content/how-customize-retries-count-actrujob-table

Regards
Martin

cocojack42
Champ in-the-making
Champ in-the-making
Ok thank you, that did work. I can avoid the rollback when I execute the setJobRetries in a new Thread.
I now start a new Message-Start-Event when an exception occurs. This works ok for me.