Welcome Guest! Log in
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…


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.

01-child

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".

02-main

 

 

Execution

Here is what happens when executing the "parallel" process :

03-exec

 

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.

 

Articles

Suggest a new Article!