09-26-2018 07:03 AM
I'm noticing some strange behaviour with multi instance process.
My original need was to create a multi instance call activity, as follows:
<callActivity id="callactivity1" name="Call activity" calledElement="testCalledProcess">
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${myList.getList()}" activiti:elementVariable="myVar"></multiInstanceLoopCharacteristics>
</callActivity>
When I try to lookup the process variable myVar in the sub-process I can't find it.
Also, I saw that myList.getList() is being run multiple times. The list has only two entries in it, but from a println in getList() it seems to be run about six times! The correct number of sub-processes (2) is created.
I therefore tried a test with a script task
<scriptTask id="scripttask1" name="Script Task" scriptFormat="javascript" activiti:autoStoreVariables="false">
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${myList.getList()}" activiti:elementVariable="myLetter"></multiInstanceLoopCharacteristics>
<script>java.lang.System.out.println("Letter "+myLetter)</script>
</scriptTask>
I found the same behaviour with multiple executions of getList(). i.e. six times. However the variable myLetter is passed and correctly printed correctly. Only two instances of the task are created.
09-30-2018 04:33 AM
I've fixed the problem with not finding the variable in called activity. I'd hadn't mapped the elementVariable in the input parameters.
It's still strange that the service to create the collection seems to run multiple times.
09-30-2018 04:33 AM
I've fixed the problem with not finding the variable in called activity. I'd hadn't mapped the elementVariable in the input parameters.
It's still strange that the service to create the collection seems to run multiple times.
12-05-2018 11:22 PM
The running multiple times may be transaction roll back and retries. I've just been working on a similar problem where I haven't set process variables correctly. I just see my service task run and fail 3 times 10 seconds apart. I assume a rollback is occurring then the transaction is retried. No error is shown presumably as the exception isn't caught.
In your case you have 2 sub processes, so it could be the same behaviour, if each fails and retries 3 times that gives 6.
Explore our Alfresco products with the links below. Use labels to filter content by product module.