Example
Last updated
Was this helpful?
Last updated
Was this helpful?
The following examples can be found on this page:
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.
Drag the MQTT Listener onto the canvas and rename it. Link the output endpoint to the printer and save the Data Stream.
Select the Agent and click Configure. In this case, keep the default Collection.
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.
Fill in the payload definition. In this case, leave the payload format default and enter the following properties:
Temperature, Double
Timestamp, DateTime
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.
See the Import, Export, and Clone - XMPro article for steps to import a Data Stream.
This example demonstrates how to use the Listener to return temperature readings from an MQTT broker with a Secured channel using advanced configuration.
Refer to configuration to understand all configuration options of this Agent.
Drag the MQTT Listener onto the canvas.
Link the output endpoint to the printer.
Save the Data Stream.
Click Configure.
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.
Enter the port, client ID, QoS, and status message preference.
In this example, select your port and client ID. Keep the default QoS (Exactly Once), and status message (unticked).
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.
Enter the authentication details: select a username and password.
Fill in the payload definition. In this case, leave the payload format default and enter the following properties:
Temperature, Double
Timestamp, DateTime
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.
See the Import, Export, and Clone - XMPro article for steps to import a Data Stream.
Data Stream
C0mp|ex123
Data Stream
C0mp|ex123