Polymorphic Multi-instance CallActivity

Hello,

In our project we are using multi-instance CallActivity which iterates over a collection of elements.
Now everything is working fine in the project.

We have requirement to make project extendable by other projects which can “plug” in it.
It means that other projects can re-use the flowable diagram and add other kind of elements in the multi-instance collection.

It depends on “plugin” projects what kind of elements can put in the collection and the collection could comprise of different kind of elements. “Plugin” projects must define how to deal with their own elements their own diagrams.

The result should be some kind polymorphism in multi-instance Call Activity.

As far as I can see now such scenario is not supported.
I was looking at DynamicBpmnService and thinking of idea to change called element in Call Activity dynamically depending on some pre-processing of the element.

Other idea is multi-instance collection to accept a map of element names and types, not just list of element names.

Please provide your comments how we can continue and if there is something existing in Flowable so far.

Best Regards,
Boyan

Hi Boyan,

Multiinstance task accepts list of items.

<multiInstanceLoopCharacteristics isSequential="true"
 flowable:collection="${myService.resolveUsersForTask()}" flowable:elementVariable="assignee" >
</multiInstanceLoopCharacteristics>

Element variable can be complex.

In the case when the items needs to be injected into collection in runtime:

  1. in the case of parallel multiinstance task you have to do it before multiinstance task is executed or migrate currently running process instance to the new state.
  2. sequential multiinstance task is just a simple loop. It should be possible to add items to collection in runtime. Do not update collection in parallel.

Regards
Martin

Hi Martin,

I guess I did not express very well.

We know what are the elements in the collection before reaching the CallActiviti.
The question is how calledElement can be changed depending the element type.
I can see it similar as DynamicBpmnService::changeServiceTaskDelegateExpression.

For example, we have two types of elements where each of them represents different process definition X and Y.

Multi-instance accepts collection of 3 elements A, B and C, where A represents X, B - Y and C - X.

As a result, we would like that calledElements to be X for first iteration, Y for the second and X for the third.

Best Regards,
Boyan

Hi Boyan,

Your case is much simpler than I thought.
Have a look on the following test

Process definition referenced from the call activity is based on the expression. You just need to create correct expression to address element.procesDefinition.

Regards
Martin

Hi Martin,

Your suggestion works for us. Thanks!

Best Regards,
Boyan