I have a problem understanding how multi instance call activity works.
At first I assumed that if I have a collection which is a result of calling a method, multi instance would work like this: execute the method and iterate through result.
However, when I set a Collection like this:
${someDbClass.getWantedItems()}
I see that this method is called as many times as this method returns items.
So if query in this method returns 1000 rows, the method would be called 1000 times.
That is correct. Creating those multi-instance iterations may happen in separate transactions, at least for sequential multi-instance. For example, consider the case where we have a sequential multi-instance user task with 1000 iterations. Then the process engine must either persist the returned collection or evaluate the expression again with every iteration. Currently, the engine implements the latter strategy, as it does not make assumptions on whether the collection can be serialized correctly. Here’s a ticket to change this: https://app.camunda.com/jira/browse/CAM-7304, but I doubt it will happen anytime soon.