Examples

The following example can be found on this page:

JSON Example

This example demonstrates how to use the Listener to return set of sensor readings such as Pressure, Temperature, Humidity and Sound as well as timestamps, sequence and other sensor details from an MQTT broker with Sparkplug B compliant payload having its Metrics displayed as a JSON string. This is designed to work with Sparkplug B Action Agent Example.

Refer to configuration to understand all configuration options of this Agent.

Step 1: Add the Agent

  1. Drag the Sparkplug B Listener onto the canvas.

  2. Rename the Agent and link the output endpoint to the printer.

  3. Save the Data Stream.

  4. Double-click to configure the Agent.

Step 2: Configure Broker Connection

Set the Connection details of the Broker

In this case, tick to use variables and select Spb Broker as the Broker Address.

Step 3: Configure Topic

Set the Group ID, Message Type, Edge Node ID and Device ID.

In this case, select Spb Group ID, NBIRTH, Spb Edge Node ID, and Spb Device ID respectively.

Step 4: Configure Payload

Set the Payload Type. In this case, keep the default Payload Type JSON.

Step 5: Results

Apply the changes, save the Data Stream, and publish it.

Let's look at the Live Data View. Make sure the Sparkplug B Action Agent Example is also published.

Observe that any new set of sensor readings published via the Action Agent are printed as metrics in a JSON string.

Files

See the Import, Export, and Clone - XMPro article for steps to import a Data Stream.

Parse to Columns Example

This example demonstrates how to use the Listener to return set of sensor readings such as Pressure, Temperature, Humidity and Sound as well as timestamps, sequence and other sensor details from an MQTT broker with Sparkplug B compliant payload having its Metrics mapped into columns. This is designed to work with Sparkplug B Action Agent Example.

Refer to configuration to understand all configuration options of this Agent.

Follow the same steps as for the JSON example, but select Parse to Columns as the Payload Type

Observe that any new set of sensor readings published in the MQTT Broker are being fetched and mapped to its respective columns.

Files

See the Import, Export, and Clone - XMPro article for steps to import a Data Stream.

Last updated