Flow
Flow triggers can operate in event or polled mode, and read one or more sources, perform trigger logic, and trigger events into the pipeline.
Flow triggers are used to migrate Flows from version 3.X and older to version 4.0 and function the same as in version 3.X. The new Polled and Event, combined with Read stages may be better suited for new projects.
Configuration
References
A list of sources to read data from when the flow executes. Each source generates a single event into the pipeline. 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 outputting events.
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.
Execution 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 the flow reads the source references. |
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. |
Interval
When the Execution Type is Polled, this specifies how often the flow is processed. This setting it not shown in Event mode.
Mode
Specifies when the flow triggers.
Mode | Description |
---|---|
Always | For Polled mode, the flow executes on every interval. 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 flow executes. On successive intervals, the expression is evaluated and compared with the previously stored result. If a change is detected, the flow executes, 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
In Polled mode this field represents the JavaScript logic performed to detect On change, On true, etc. The field can reference one or more sources.
In Event mode, this field represents the event source(s) to trigger off of when the mode is set to Always. In On change and other modes, this field represents the trigger sources and logic.
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 | The event contains all source data values. |
Only changes | The event contains only source data values that have changed from the previous interval. For modeled instances, all attribute values are written. |
Only changes, compressed | The event contains only source values that have changes from the previous interval, and only the changed values. 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.