MQTT CONNECTOR

Setting Up The Subscription Node

Start by putting an “MQTT In” node into the flow.

image015

image017

This is what the MQTT node looks like by default. For the topic field, enter the “#” character. The “#” character allows the node to subscribe to all topics within the broker.

image019

The QoS (Quality of Service) field determines how the data is sent to the subscriber, with the options being 0, 1, or 2. 0 means that the Broker sends the data but does not look to receive confirmation from the subscriber that data was received, meaning that the Broker will send the data but does not care if the subscriber receives the data or not. 1 means that the Broker will confirm that the data has been sent at least once. It will keep sending the data until it has received confirmation that the subscriber has received it, but this means that the subscriber could receive the data multiple times. 2 means that the Broker will confirm that the data has been received exactly once. Since we want to maintain data integrity, we will always keep this field at 2.

Next, create a new MQTT Broker configuration. Click the pencil button while the Server field has “Add new mqtt-broker…” selected. This window for configuring an MQTT Broker config will appear:

image021

For the Server field, type in “localhost”. “localhost” refers to the machine that the IoT server is on. For the port number, (assuming the customer is following the standard of using TLS) set it to 8883.

image023

Check the “Use TLS” checkbox as well if it is being used. This will cause a new option for selecting a TLS configuration to appear.

image025

Click the pencil icon to add a new TLS configuration.

image027

To start, uncheck the “Verify server certificate” field. This is generally unnecessary for the configuration.

Then go into the Storage Manager and download the .crt, .key, and ca files the customer uploaded. Upload the .crt file to the “Certificate” field, the .key file to the “Private Key” field, and the ca file to the “CA Certificate” field. The configuration should now look something like this, and add the configuration by clicking the “Add” button at the top-right (this example says “Update” because it already exists):

image029

Now that the Connection configuration is complete, go to the Security configuration panel of the Broker configuration.

image031

Enter in the username and password information that was used to generate the passwd file (unless the customer provided the account info directly). After filling in that information, the configuration for the Broker should be complete. You should not need to fill out the Messages configuration panel. Click the Add button at the top-right to add the MQTT-Broker configuration to the MQTT node. The node should now be extracting information from the Broker, and this can be checked by using a debug node.

Troubleshooting

If the MQTT node is disconnected, the Connectivity Expert may want to check with the customer to make sure that none of the networking information has changed if the node was able to connect before.

If the MQTT node is connected and no data is flowing through, the Connectivity Expert will have to check the MQTT Broker itself by using a program called MQTT Explorer, which can be downloaded here: http://mqtt-explorer.com/

Most connections will be configured like this:

  • Set the “Name” field to the name of the server (this does not matter in terms of connecting).
  • Make sure “Valid certificate” is set to off.
  • Make sure “Encryption (tls)” is set to on.
  • Enter the URL of the server in the “Host” field.
  • Assuming the server is using the default ports and we are following the standard of using TLS, set the port to 8883.
  • For Username and Password, enter the username and password information used to access the broker.

Once the connection has been configured, save the connection configuration, and click Connect to connect to the Broker. A connection to the customer’s VPN may be necessary if it is on their network.

Was this article helpful?

Powered by Zendesk