cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting a MultiInstanceLoop sub process

jorell
Champ in-the-making
Champ in-the-making
Hi
I have a use case wherein I need to be able to 'delete' or immediately end a subprocess created from a multiinstance loop. I tries using the deleteProcessInstance API in the RuntimeService. This works fine but because the multiInstance loop run sequenctially it doesnt create the remaining subprocesses.
So, suppose I have a list {a,b,c}. And I have a call activity with multiInstanceLoopCharacteristics that takes this list. Now when the first subprocess is created for 'a', I delete that subprocess. This works fine but the subprocesses for 'b' and 'c' are never created.

I have tried using activiti:exclusive="false" and activiti:async="true" for the call activity but the subprocesses still seem to be created parallely. Any help would be appreciated here.
Thanks.
3 REPLIES 3

jorell
Champ in-the-making
Champ in-the-making
Please disregard the above issue. There was a error in my tests. The sub processes do get created in parallel. But I have found another issue which on the surface looks like a bug. If I delete a sub process created by a multiInstance loop the parent process waits indefinitely for the killed sub process.
I think when deleting a process, activiti should check if the process being deleted has a parent execution and if so update its loop variables (nrOfActiveInstances, nrOfCompletedInstances), so the parent doesnt end up waiting for a process that has been deleted. Does this sound right? Please confirm if I should open a bug for this.

jorell
Champ in-the-making
Champ in-the-making
Please let me know if I can provide more information or if I am unclear about the issue. If someone from the activiti team can just confirm whether this is a bug or not I can go ahead and create a jira issue for this.

jbarrez
Star Contributor
Star Contributor
Im not sure if it's a bug or 'by design'.
Immediately deleting the process manually sounds like an edge case. Or do you mean that the called process goes into an end state?

Could you provide a unit test with a simple process that demonstrates your use case, that would clarify a lot.