AnsweredAssumed Answered

Freezing of subprocess with MI tasks

Question asked by vladimirpanov on Oct 21, 2015
Hi all,
I have made a simple process model in Activiti Explorer 5.18 to test one feature for real approving processes.
We need to add new approvers to the parallel approving cycle already running,
or in other words to add new instances to the parallel MI activity which is already active. But it's not possible.
Instead we can activate MI-activity another time (in parallel flow) with additional data collection for new instances.

Please, see a picture and bpmn20.xml files in google drive:
https://drive.google.com/file/d/0B8kci6E3apZ_d0dveG0zdFotRXM/view?usp=sharing
https://drive.google.com/file/d/0B8kci6E3apZ_Z2c5bjIzT0dreFE/view?usp=sharing
You can import the model to the Activiti Explorer and test by "kermit" user.

There are three user tasks and one subprocess in the model: 
1) Task0: set two variables:
- iterationNum - the iteration number in the cycle of adding new parallel flow with new MI-task
- instanceCount - the number of instances in the next MI-task
2) MultiTask: MI task (as the parallel approving cycle)
3) Task2: serves as breakpoint after subProcess is over but before overall process finish.
The x-gateway loops back after Task0  if the value of instanceCount was set to >0 but flows to the end if instanceCount==0.

When the subProcess is active there can be zero or one Task0 and any number of MultiTasks and their instances simultaneously.
According to BPMN "theory" the subProcess can finish by only two ways:
1) When there aren't more MultiTasks (all completed) and the last Task0 is completed.
2) When there is only last MultiTask and the last its instance is completed.
And here comes the problem with 2-nd way.
Activiti 5.18 "freeze" the process on the subProcess: all tasks within subProcess completed but Task2 isn't activated.
But the 1-st way works correctly.

By the way, Activiti 6 beta1 also freeze the process but a bit differently.
And there is another problem: it can emit several tokens from a single subProcess. So there can be several Task2 activated simultaneously.

Outcomes