This article shows how to control how many sessions can run at the same time for a given delivery.
The method
It is possible to limit the number of parallel executions of a process by setting the property nbMaxParallelSessions in the Meta-Inf of the Process.
This parameter limits the number of parallel executions for a given Delivery, within a given Runtime. The other sessions are queued by this Runtime and they will start progressively as the previous sessions end.
The sample process
For this example, we have a child process, which can last a random duration between 1 and 30 seconds.
Expression of the SLEEP_DELAY = %e(rhino){(1000*Math.floor(1+Math.random() * 30)).toString()}e(rhino)%
Notice the Property "Meta-Inf" : <nbMaxParallelSessions>10</nbMaxParallelSessions>
This property will prevent this process from being executed more than 10 times in parallel.
The main process has a SqlOperation which retrieves 35 rows from a table.
The bound action executes the "parallel-child" delivery in "Asynchronous mode".
Execution
Here is what happens when executing the "parallel" process :
All the necessary sessions are prepared.
The Runtime executes these prepared sessions, but "holds" them so that there is no more than 10 sessions at the same time.