cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve active process instances

tobiasw_
Champ in-the-making
Champ in-the-making
Hi,

I was wondering how I could get a list of all processInstances that are alive on a runtime service. With alive I mean all instances, including instances in wait state and currently processing something.

As I understand, as soon as a processInstance hits a wait state, e.g. user task, the entire process isntance is persisted into a database able?

"At such a wait state, the current state of the process instance is stored in the database."
http://www.activiti.org/userguide/index.html#bpmnFirstExamplStartProcess

Is that the ACT_HI_PROCINST table?

If so, then there are some processInstances in a database table, which I could query, and some are not (only alive somewhere in runtime environment).
What would be your approach to retrieve those instances?

Also, how can I force a processInstance to persist itself upon process start? Basically when it enters the start node?
Not only for this task, but also in case the process engine crashs and I have to restore all instances.

Cheers and kind regards,

Tobi
1 REPLY 1

trademak
Star Contributor
Star Contributor
Hi,

Yes if you hit a wait state the state is persisted.
If you want every process instance to persist itself immediately it's a good idea to add an async task right after the start event. This can even be a dummy manual task.

Best regards,