Best way to model multiple process calls, given a collection


#1

Hi there,

What do you guys think is the best way to model the following situation:

There’s a process where one of its tasks has a form in which the user defines a list of n values.
The idea is to take that list and, for every value, call another process providing the value itself as a variable.

I already tried two approaches:

  1. Used the CallActivity, providing the list as the collection… Which works as expected, but unfortunately it hangs there until every called process ends;
  2. Instead CallActivity, used a SubProcess and inside I created a SignalEndEvent… which does what I want to achieve, but seems more complicated than the CallActivity.

Which is the best way to achieve what I’m trying to do?

The idea is to use something like the CallActivity (because of its simplicity) but asynchronously.

Thanks in advance,
Pedro Silva


#2

You can use a Call Activity and a Multi-Instance marker to make something like this:

https://cawemo.com/share/ec229f79-6eb1-4bdf-8420-4e64991ac6c8


#3

Sorry, I accidentally posted without all the information. Its updated now.


#4

You can use a Multi-instnace message send task. that will start a process instance without waiting for it to finish - i’ve updated the link above


#5

Thanks for the response!

And how do you start a process using the message task?
With the CallActivity you only need to define the process key.


#6

There are a lot of ways but it all boils down to some how using the processes engine’s
runtimeService.startProcessInstanceByKey("someKey");
You could do it as a JavaDelegate or script it in JS or Groovy.