cancel
Showing results for 
Search instead for 
Did you mean: 

Stop and resume Activiti processes and state management

aitan
Champ in-the-making
Champ in-the-making
Hi and thanks all for your job with this engine!

I've a question for u:
I'm moving my Spring web application from using a JBPM 4.3 engine to the Activiti engine; until now I'm in trouble only for two old features that worked with the old engine:
1) I couldn't stop and resume processes
2) I couldn't manage and show process state

is there a way to add these features also with Activiti engine


Thanks a lot.

Regards,
Gaetano.
7 REPLIES 7

frederikherema1
Star Contributor
Star Contributor
Hi,

Suspending/resuming a process is not possible in activiti currently, a process only stops when a waitstate (eg. user task) is reached or when it's ended.
To view process state, you can use probe (http://www.jorambarrez.be/blog/2011/02/01/screencast-proc-inst-visual/). You can use the visualisation feature to create png's for your own app, have a look at org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator and org.activiti.rest.api.process.ProcessInstanceDiagramGet for example on how to generate this.

aitan
Champ in-the-making
Champ in-the-making
thanks for your reply;

ok for the stop and resume feature I'm trying to solve with a workaround

a last question about process state:

can I monitor this state using activiti API???

jbarrez
Star Contributor
Star Contributor
No, you would have to use a process variable there and create your own API around it.

mats
Champ in-the-making
Champ in-the-making
Hello,

We are currently considering the use of activiti in our project. The app running activiti could be run on both desktop or a server and would orchestrate an execution of workflows with potentially very long running tasks (one/two weeks). In order to fulfill that requirement the workflow engine would need to be able to pause/restart the process instance when executing a task. The pausing request would ideally notify the active tasks to save their state (or roll back) prior shutting down the workflow engine.

The questions are:
1. As I understand it is not possible to pause/restart the PI [process instance] in the acitviti, but is it on road map?
2. Are there some workarounds proven to work with activiti to cover the pause/restart functionality? Is the following example solution possible: task creates an environmental variable to store its state during its execution and when the process instance is stopped-and-restarted it uses the variable to load its state? Or since such variable would be created inside an uncommited transaction some additional session mechanism would need to be introduced to store such interim state data?
3. Acitivi uses a database to store runtime variables of currently running processes. In case of a (system) failure after the engine is restarted activiti should continue execution of the processes using the state information from the database. Is it possible to programmatically stop the engine or engine is not meant to be stopped and that is a case of stopping JVM? I couldn't find an example anywhere and also there is no section in the user guide that covers that.

Thank you for your help,
Mats

meyerd
Champ on-the-rise
Champ on-the-rise
Whenever you put a waitstate in a process (Timer, UserTask, ReceiveMessage, …) activiti is going to persist the current state of the process instance and wait for a signal to continue.

That signal can come from "within" activiti (Timer) or from outside (Message / Usertask). So the default behavior of activiti is to persist at these waitstates. Everything in between of two waitstates happens in a single transaction (either succeeds or fails atomically).

So it is OK to "shut down" activiti: all process instances currently at a waitstate will be able to resume from the database after.

1. As I understand it is not possible to pause/restart the PI [process instance] in the acitviti, but is it on road map?
What do you mean by pause/restart? Do you mean at a waitstate in the process or somewhere else?
3. Acitivi uses a database to store runtime variables of currently running processes. In case of a (system) failure after the engine is restarted activiti should continue execution of the processes using the state information from the database. Is it possible to programmatically stop the engine or engine is not meant to be stopped and that is a case of stopping JVM? I couldn't find an example anywhere and also there is no section in the user guide that covers that.
ProcessEngine.close()

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

1. As I understand it is not possible to pause/restart the PI [process instance] in the acitviti, but is it on road map?
What do you mean by pause/restart? Do you mean at a waitstate in the process or somewhere else?
What I meant was pausing execution of a PI anywhere in the process in order to stop the engine. So any tasks beeing executed in the background could perform any clean up (if required). Taking into account your reply and because it is closely related to the following question, please see below.

ProcessEngine.close();

Is there any notification mechanism of the engine (or process) execution? How for example a java Service Task can know that the engine that runs the process is being closed?

Thank you.

meyerd
Champ on-the-rise
Champ on-the-rise
Hi Gaetano,

please read this again, carefully:

the default behavior of activiti is to persist at these waitstates. Everything in between of two waitstates happens in a single transaction (either succeeds or fails atomically).

I think you need a better understanding of "what" activiti "is" and how it works. Try to implement a process using activiti designer and test it in a unit test etc.

Daniel