Queued – Parallel Workflow Runtime Behavior
Caution |
Test the script(s), processes and/or data file(s) thoroughly in a test environment, and customize them to meet the requirements of your organization before attempting to use it in a production capacity. (See the legal notice here) |
Note: The workflow sample mentioned in this article can be downloaded from the Opalis project on CodePlex: https://opalis.codeplex.com |
Overview
When a Workflow is triggered multiple times, Opalis can launch one Workflow instance at a time (default behavior), or launch multiple Workflow instances in parallel. This example has a collection of Workflows that demonstrate this queued and parallel runtime behavior.
Getting Started
Launch the Workflow named 0.Setup by using Start or by running it using the Testing Console.
The Workflow will create a sample input.txt file on your C: drive. The sample input.txt file will be used by the other Workflows and has following contents:
One
two
Three
Four
Example Workflows
1. Mode Selector
This Workflow uses the Custom Start Activity to obtain input data using a parameter:
The Workflow branches according to the provided value for ‘Mode’. The corresponding Read Line Activity reads all four lines from the sample input.txt file:
The corresponding Trigger Policy Activity then starts either Child Workflow ‘2.1 Queued’ or ‘2.2 Parallel’. The Published Data Variable for ‘Line Text’ from either the ‘1. Read line’ or ‘2. Read Line’ Activity is submitted, so that a total of four Child Workflow instances will be launched:
2.1 Queued
This Workflow uses the Custom Start Activity to obtain input data using a parameter:
The Link has a five second delay which is set via the Link Properties:
The variable ‘Input’ consumes the ‘Line Text’ Published Data from the Parent Workflow. The Send Platform Event Activity is used to display ‘Line Text’ Published Data as it subscribes to the Input variable from the Custom Start activity:
2.2 Parallel
This Workflow is similar to the Workflow ‘2.1 Queued’ except that the Run Behavior settings (Workflow Properties) are different:
‘Maximum number of simultaneous requests’ is set to a value of 10, which means ten instances of this Workflow can be run at the same time.
The Workflow ‘2.1 Queued’ uses the default value of 1, which means only a single instance of the Workflow can be run at any given time.
The Send Platform Event Activity is used to display ‘Line Text’ Published Data as it subscribes to the Input variable from the Custom Start activity:
Running the example Workflow
Launch the Workflow ‘1. Mode Selector’ by starting it from the Operator Console. When prompted, enter the appropriate value (0 for queued, 1 for parallel):
When a value of 0 is submitted, note how the Start Times for the ‘Workflow 2.1 Queued’ are between six and eight seconds apart. Only a single instance of the Workflow is launched at the same time. Once completed, the next one is launched, etc.:
When a value of 1 is submitted, note how the Start Times for the ‘Workflow 2.2 Parallel’ are only one second apart. All four instances of the Workflow are launched at the same time and run in Parallel. Also note the identical End Times:
More Information:
Search the Opalis Help for ‘Policy Properties’ for more information.
Share this post : |