Example

The following examples can be found on this page:

Basic Settings Example

This example demonstrates how to use the Listener to return temperature readings from an MQTT broker using minimal configuration. It is designed to work with the MQTT Action Agent Basic Settings Example.

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

Step 1: Add the Agent

Drag the MQTT Listener onto the canvas and rename it. Link the output endpoint to the printer and save the Data Stream.

Step 2: Configure General

Select the Agent and click Configure. In this case, keep the default Collection.

Step 3: Configure Broker Connection

Fill in the broker address of your MQTT broker and the topic to listen for. In this case, tick to use variables, and select a broker address and topic.

Step 4: Configure Payload

Fill in the payload definition. In this case, leave the payload format default and enter the following properties:

  • Temperature, Double

  • Timestamp, DateTime

Step 5: Results

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

Let's look at the Live Data View. Make sure the MQTT Action Agent Basic Settings Example is also published.

Observe that any new temperature readings published by the MQTT Action Agent for the specified topic are printed by the Listener.

Files

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

Advanced Settings Example

This example demonstrates how to use the Listener to return temperature readings from an MQTT broker using advanced configuration.

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

Step 1: Add the Agent

Drag the MQTT Listener onto the canvas and rename it. Link the output endpoint to the printer and save the Data Stream.

Step 2: Configure General

Select the Agent and click Configure. In this case, keep the default Collection.

Step 3: Configure Broker Connection

Fill in the broker address of your MQTT broker and the topic to listen for. In this case, tick to use variables, select a broker address and topic and leave clean session ticked.

Tick the advanced settings to show more configuration options.

Step 4: Configure Advanced

Enter the port and QoS option. In this example, select your port and keep the default QoS (Exactly Once).

Step 5: Configure Channel

Tick the secure channel if you want to enable TLS/SSL channel communication and enter the channel details.

In this case, keep the default protocol (TSL v1.2), upload both the root and client certificates and select the client certificate password.

Step 6: Configure Authentication

Enter the authentication details: username and password.

Step 7: Configure Payload

Fill in the payload definition. In this case, leave the payload format default and enter the following properties:

  • Temperature, Double

  • Timestamp, DateTime

Step 8: Results

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

Let's look at the Live Data View. Observe that any new temperature readings published to the MQTT broker for the specified topic are printed.

See Basic Settings Example for a side-by-side results with an Action Agent.

Files

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

Last updated