I work on a process with a list of business data. What I want is to loop on that list of data and to execute for each data a same collection of steps.
How Can I do it? What is the best way to design my collection of steps : subprocess or referenced process?
you could have a look at the the document 8-0-SP1_Administering_Process_Engine.pdf in the Process Engine documentation. On page 49 you find a section About Dynamic Referenced Processes which describes exactly what you try to do. You can start a number of subprocesses and use a list to determine the amount of subprocesses.
Hope that helped.
Thanks Matthias for your answer.
I omitted to say that I was using WM 7.1.2. Is it possible in this version to invoke, at the same time multiple instances of a referenced process?
If not, does somebody have a tip?
Afaik there is no out of the box implementation for dynamically calling subprocesses in 7.1.2 but this is an interesting question.
If you have a defined set of parallel executions which don’t change for different instances you can just draw parallel paths in Designer, those are executed in parallel by PRE (Amount of parallelity is defined by the thread count of the process transition trigger, default is 10).
If the number of “threads” is dynamic, I can think of 2 alternatives (there are more for sure)
Call the subprocesses by publish subscribe out of the model by publishing starter documents. If you do not need to join back after the steps for the different threads are done, that’s all and this a quite easy approach If you need to come back to a common thread, yo need to join the answers using a subsequent receive step with a correlation service. This receive step must not be allowed to start the process and the original starter needs a fitting correlation service too. You will also need to find a solution to recognize when all answers arrived, but how this can be done depends on your process.
You may implement a service which spawns threads in IS and use this as process step. In a service it’s easier to recollect the running threads. In the threads the logic may be performed or again a process be triggered with a request reply pattern.
Hope this help, please share your results if you find a solution.
I had the same question
“I work on a process with a list of business data. What I want is to loop on that list of data and to execute for each data a same collection of steps”
its a popular pattern
whats the best way to execute a set of steps (either in a subprocess or referenced process) for an array
I input an array of documents to a subprocess/referenced-process and the set of steps should execute for all elements in the document array.
does it come out of box - or custom code required
Imho looping over an array should be donein a service not in a process. You should not use processes to implement logic that belongs into an service.
It’s sometimes difficult to decide whereto place logic, but nevertheless important for clarity and good running processes, not to mix process logic with processing logic.
sometimes you need to be able to fork multiple child-processes of the same type for better visibility and control of the whole process. I am talking high level referenced processes not detail level processing.
And these child-referenced processes could have workflow-Tasks in them. cannot be done in flow-services
Anyways based on my research it is not possible without custom code as of 8.2.