cancel
Showing results for 
Search instead for 
Did you mean: 

About continuing a failed process

alexbt
Champ in-the-making
Champ in-the-making
Hello to all Activiti team,

I have a question regarding restarting a failed process.
I have a process that contains several subprocesses. The overall process run can take about 2 hours.
Sometimes there is an unexpected problem that is not connected to the process itself, but influences its execution.
So, say, the process runs for 45 minutes and then one of its tasks fails.
In this case we don't want to fail the whole process but to fix the problem and let the process continue its execution as if there was no problem at all.
We don't want to restart the whole process from scratch - it's too much time to waste for us.
I thought about some kind of true/false result flag for any task and upon receiving a false result use another task and notifying an operator (a person who initiated the process)  and waiting for his reaction. If he,say, fixes the problem and press on some "Continue" button the process continues its execution.
But this workaround looks pretty ugly - to add true/false check + wait after every task.
So the question is if it is possible to start a failed process from the point where it has failed?
Or you may suggest another workaround.

Regards,
Alex
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
By default, when the Activiti engines encounters an exception, it will rollback to the last known stable state, which is always a wait state (eg a user task).

Your problem could be fixed using async continuations: that way you introduce an wait state in your process, that commits all data to the DB, and then continues execution. However, we haven't implemented this not yet as core functionality in the engine.
A 'workaround' which I've seen on the forum - altough a not so clean one, is to add a timer event in your process with a ridicolous small time. When process executions arrives at the timer, it commits all data to the DB, and then executes the process further when the timer fires.

alexbt
Champ in-the-making
Champ in-the-making
Hi Joram,

I think you misunderstood my question.
I'll try to explain myself better.
I have a long-running process that contains 11 tasks.
Say, there is task #2.
When that task runs and throws an exception I catch it in my code. What I need to do now is to initiate a process that will make a user (in our case a process operator) perform some non-process related work in the background.
At that time task #2 must wait for the user to finish his background work.
When he finishes his fixes, he must release the main process execution flow by either restarting task #2 or moving to task#3.

I'm looking forward for your advice.
Regards,
Alex

jbarrez
Star Contributor
Star Contributor
Well, the same explanation applies in that case: you must make sure your process can rollback to a previous wait state (eg waitstate or timer). You operator can in that case signal process execution starting from that waitstate.

alexbt
Champ in-the-making
Champ in-the-making
Thank you for your reply.

Do you have any example of using wait state? I didn't find it in the Activiti examples code.

Regards,
Alex

frederikherema1
Star Contributor
Star Contributor
Check out org.activiti.examples.bpmn.receivetask.ReceiveTaskTest