Result
Understand how to use Flow’s Integration Services and different consumers to "push" Flow calculated measures to consumers via an MQTT broker.
Tutorial steps
- Create a new MQTT Consumer to consume data pushed from Flow’s Integration engine.
- Visualize the MQTT data using a generic MQTT client named MQTTBox.
Flow Configuration
Return to the Flow Configuration editor and locate the "Data" tab. We need to configure an MQTT Consumer in Flow to push values to an MQTT Broker, thus allowing other data consumers to consume and display Flow information.
Right-click on the "Data Consumers" section and add the "MQTT Broker" under the "More…" section.
Configure the broker connection as below. Note that the Mqtt Version has been changed to "V311"
Select the "Test" Button to confirm that a connection can be established to the MQTT Broker…
Notice that your "MQTT Broker" Data Consumer has a fault status - do you know what the problem is? Remember to assign it to your platform and deploy it!
Locate the "Filler 1.Efficiency (%)" measure and open its editor. Expand the "Integration" Section. Drag the newly created MQTT Consumer to the "Production" calendar context of the Integration section…
Select Consumer Settings (the "gear" icon). Notice that the Consumer is undeployed.
We need to Deploy this specific "Measure Consumer" for the Integration Engine to push the values for this measure out via the MQTT Data Consumer. Note that here you can "backfill" the push of data - this will reinitiate a data push from the time configured. By default, the first time you configure a Measure Consumer, it will backfill from your default backfill time (in the Defaults Toolbar). Deploy the measure consumer…
Notice the status at the bottom indicating that a Backfill has been requested. When everything is running, this status message should change to reflect the time up to which the consumer has processed.
Repeat the process for the "Filler 1 Quality (%)" measure.
Locate the "Deployment" view in the config tool. If not already deployed, deploy the "Integration Engine" from the Deployment view…
Note: Flow will automatically create the Topic path depending on the configuration of the MQTT consumer. One can use an MQTT Client tool like "MQTT Box" and subscribe to the "#" Topic. This will list all the topics that are currently being created on the MQTT Broker. One can use this as a "sniffing" tool to identify the different topics that Flow creates
If you do not have MQTT Box installed on your training PC, ask the instructor to confirm that your message has come through. If you do have MQTT Box installed, add a new MQTT Client and configure the following settings:
- MQTT Client Name - Flow Training MQTT
- Protocol - mqtt / tcp
- Host - broker.hivemq.com
After selecting Save, you should see that the client is "Connected" as indicated by the green status at the top. Set the "Topic to Subscribe" property to "Flow Nodes/#" and select "Subscribe"
You'll know everything is working when you see information appearing in the MQTT Topic that you've subscribed to using MQTT Box. If you don't see anything, it could be because Flow pushed the data before you started observing the topic! No worries, go back and Backfill one or both of your measure consumers and Flow will push the data out again for you.
In this case, you've subscribed to the Flow Nodes/# topic. Look carefully at the payloads - you'll see that the topic being written to is in the format Flow Nodes/[Flow Instance Name]/[Measure ID]/[Calendar Name]/[Measure Name]]/[Unit of Measure]/[Calendar Name and Interval Type]