Flow
Flows represent the movement of data from one or more sources to one or more targets. Sources include Inputs, Instances, and Conditions, and targets include Outputs or Pipelines. When the flow executes all source data is sent to all targets.
Create a Flow
- Navigate to Flows in the configuration’s Main Menu. Here you can add, edit, and view flows. To add a flow, click the New Flow button.
- Enter a Name to represent the flow. Optionally enter in a Description or a Group As folder to categorize the flow. Click Next to continue.
- To add one or more Sources, use the References panel to view and select Inputs for any Connection and/or Instances and drag them to the Sources field. To add one or more Targets, use the References panel to view and select Outputs for any Connection and drag them to the Targets field. Click Next to continue.
- Set the additional flow settings described below. Click the Submit button when finished.
Flow Status
Enabled
The enabled state of the flow. When disabled, sources are not read and no data is written to the targets.
Sources & Targets
Sources
A list of sources to read data from when the flow executes. Drag & drop sources from the reference panel. All reads for each source are issued at the same time, and the flow waits for all reads to complete before writing data to the targets.
Sources can be templated. For example, if a templated Instance expands into 10 Instances, referencing the templated Instance is the same as manually creating and adding all 10 Instances.
Sources can also take parameters (e.g., {{Connection.SQL.machines(id=3)}}
). See the Input and Instance Parameters subsection under Templating for more details on
templating and parameterizing sources.
Targets
A list of targets to write data to. Targets can be Outputs or Pipelines. Once all source reads are complete the results are sent to each target. The flow will not wait for the target writes to complete before re-executing the trigger and reading the sources again. If there are any write errors, the flow will transition into an error state.
Flow Settings
Type
Specifies the type of Trigger. Flows can trigger in Polled or Event mode.
Type | Description |
---|---|
Polled | Operates on an interval. On each interval the flow evaluates the trigger mode and expression, and when true (e.g., the mode is Always) the flow executes. |
Event | Event based flows execute when a new event occurs and guarantees each event is processed. For example, an event based flow can be triggered every time an MQTT message arrives. If 100 messages arrive in a second, each message is queued and processed in order. Event based sources include: Azure Event Hub, Azure IoT Hub, MQTT, OPC UA (Tag Types only), Sparkplug, and Webhook. |
Interval
For Polled mode, this specifies how often the flow is processed.
Mode
Specifies the flow’s mode of operation.
Mode | Description |
---|---|
Always | For Polled mode, every interval the sources are read and written to the targets. For Event mode, the flow triggers for every event received. |
On change | On the first Poll or Event, the expression is evaluated, the result is stored, and the source data is written to the targets. On successive intervals, the expression is evaluated and compared with the previously stored result. If a change is detected, the result is stored and the source data is written to the targets, otherwise no action is taken. |
On true | The flow executes every time the expression transitions from false to true (rising edge). |
While true | The flow executes as long as the expression remains true. |
Expression
Depending on the mode, a JavaScript expression that either assigns a source’s data value or performs a calculation on one or more source data. This field is not applicable for all modes.
Trigger Delay
When the flow is in Event Mode or is in Polled mode with a trigger Expression, this is the amount of time the flow waits from the Event Source / Expression evaluation to reading source data. This can be useful in cases where there is a delay between getting an event and when the source should be read. An example of this would be a machine where an OPC UA machine status tag changes, but requires a delay to ensure the remaining OPC UA tags are updated.
Publish Mode
Controls what is published per source.
Publish Mode | Description |
---|---|
All | Write all successfully read source data values at each interval. |
Only changes | Write successfully read source data values that have changed from the previous interval. For modeled instances, all attribute values are written. |
Only changes, compressed | Write successfully read source data values that have changed from the previous interval. For modeled instances, only the attribute values that changed are written. |
Only Changes, compressed Example
Assume the source below is published on the first flow execution.
{
"attribute1": 1,
"attribute2": 2,
"attribute3": 3
}
On the second flow execution only the value for attribute2
changes to 20. The other attributes stay the same. The following is published.
{
"attribute2": 20
}
Flow Templating
Flows can be templated like Inputs and Instances. Templating a flow accelerates the virtual creation of many flows that have the same basic configuration. Template settings can be used in sources, targets, and trigger expressions.
See Templating for more details.