Protecting Process Variable Values in Parallel Flows

When a node in a process is configured to run multiple instances (or if a process flow loops back on itself) each copy of the node calls and/or writes to the same process variables (PVs). In such cases, it is possible to have one instance of a flow overwrite the value in another. To avoid this problem, shield the value passed between each node (in a multi-instance flow) using the Keep process variables synchronized option on the Flow Properties dialog box, which is configured by double-clicking the flow connector on your process model.

shielded-flows.gif

When the Keep process variables synchronized option is selected, all PV values used in the output phase of a node are protected from overwrites – from the start of the flow – to the start of the next node. For example, if three instances of a node are spawned (and the node is configured to continue the flow after each instance completes) the PVs in outgoing flows are protected from being overwritten by each other.

The overwrite-protection is distinct for each instance, but it does not place a lock on the process variable (meaning that other flows can still write to the PV if you have another using the same variables). This feature also triggers an update to the PV prior to following the flow.

All PVs used during the output phase of a node are shielded from overwrites, when this option is enabled. These include PVs used by expressions in Rules, Timers, and other event conditions.

Protecting Process Variables from Overwrites Between Activities

  1. Double click a Connector between two nodes of the process model. The Flow Properties dialog box is displayed.

    flow\_properties.gif

  2. Select the Keep process variables synchronized across this flow checkbox.

Process Variables and the Output Phase

When the Keep process variables synchronized option is selected, if a PV is used in the Output phase of node execution, it is also protected from overwrites across any subsequently shielded flows. The following nodes frequently consume PVs during the Output phase.

  • Rule Event: When a protected flow arrives at a Rule Event node, the Rule Conditions are evaluated immediately. If the Rule Event is false (and does not execute) the protected PV value is discarded.

  • Timer Event: A Timer Event might be triggered during Output; however, if a Timer Event condition is false (and does not execute) the protected PV value is discarded. A true timer event PV that is consumed during the Output phase will be shielded from overwrites.

  • Gateways: When a protected flow arrives at a gateway, the expressions configured for the node are evaluated immediately. The protected PV value is also retained and made available to any subsequent flows.

Exceptions and Other Considerations

  • Nodes with multiple incoming flows: When processes include gateways with multiple incoming flows with only one outgoing flow, only the PV values carried by a winning incoming flow are passed on to the subsequent node.

  • Scheduled Nodes: When a protected flow arrives at scheduled node, the protected value is stored until the node executes.

  • Receive Message Events: Regardless of the configuration setting, PVs will always synchronize across flows on the output flow for a Receive Message Event node.

Reassigned Tasks

Protected PV values also keep their shielding when associated with a reassigned task. Any subsequent assignees are supplied the same data as the initial assignee.

  • For any attended activity, keeping PVs synchronized could result in assignees seeing stale data, as there is no inherent limit to how much time a user might take when viewing and completing their tasks.

Shielding Process Variables During Node Execution

As the synchronized option only applies to process flows, you might need to write the value from one shielded flow to a Node Input, then to a Node Output, then to the next flow. This would ensure that the PV value cannot be overwritten during node execution.

If you need to shield more than one flow, we recommend that you put the related nodes into a sub-process.

During the Output phase, a PV's value is written from the Node Output at the same time it is passed to the outgoing flow. You can further shield the PV value in other flows by creating a new PV from the existing value. See also: Process Variables and Parallel Flows.

shielded-pvs.gif

To shield a process variable's value through the Start, Run, and Output phases of a node's execution:

  1. Pass the data from a process variable (PV) to a node input.
  2. Open the Configure dialog, by double-clicking the node on the Process Modeler Canvas.
  3. Select the Data tab.
  4. Click the New Input button. A row is added to the Node Input list.
  5. In the Type field select the data type that corresponds to the data type that is assigned to the PV.
  6. Type an expression in the Value field, using the following syntax.

    =pv!ProcessVariableName
    

  7. Save the node input data to a custom node output on the Data tab.

    1. Select the Outputs property sheet on the Data tab of the dialog box.
    2. Click the New Custom Output button.
    3. In the Expression field, select the Expression Editor button. The Expression Editor is displayed.
    4. Expand the Activity Class Parameters in the left navigation of the Expression Editor's Data tab.
    5. Select the name of the node input (created earlier) from the list provided.
    6. Click Save & Close in the Expression Editor.
    7. Save your custom output into the same process variable that supplied the node input data. Select the process variable name from the Target list. Click OK.
  8. The outgoing flow(s) must be shielded, until the flow no longer executes with multiple instances. Right-click the outgoing flow. Select the Keep process variables synchronized option.

17.1

On This Page

FEEDBACK