Generic MQTT Over SSL Integration Guide (Mosquitto)
Review the following guide for setting up an integration between Manufacturing Connect Edge and an MQTT broker using Mosquitto and SSL authentication.
Mosquitto is a lightweight open source message broker that Implements MQTT versions 3.1.0, 3.1.1 and version 5.0.
Make sure you Install the Mosquitto MQTT Broker on Ubuntu.
You will need to retrieve the contents of the ca.crt file, so that you can add it to the CA Certificate parameter value in the connector you'll configure in Step 2.
To retrieve the contents of the ca.crt file:
- Go to the Ubuntu system.
- Open your Home directory using the Files app.
- Open the ca.crt file.
- If you see the message Could Not Display "ca.crt", click Cancel.
- Right-click the ca.crt file and select Open with Other Application.
- Select View All Applications.
- Select Text Editor and click Select.
- Copy the entire contents of the file.
Follow the steps to Add a Connector and select the MQTT - Generic over SSL provider.
Configure the following parameters.
- Name: A recognizable name to identify the connector.
- Hostname: Since Mosquitto is running locally on your PC, enter your IP address.
- Port: Confirm that the default value 8883 is entered.
- CA Certificate: Paste or upload the ca.crt file you copied in Step 1.
- Certificate (Optional): Upload the certificate.
- Private key (Optional)
- Client ID: Enter <username>-with-ssl.
- Username (Optional)
- Password (Optional)
- QoS: Confirm that the default value 0 is entered. The Quality of Service (QoS) level is an agreement between the sender of a message and the receiver of a message that defines the guarantee of delivery for a specific message.
- Parallel Publish Count: Confirm that the default value of 100 is entered. The number of messages being published simultaneously. Once the defined limit has been reached, subsequent messages are silently dropped.
- Integration Topic: Enter test.
- LWT topic: Enter lwtTopicName.
- LWT payload: Enter Some LWT Payload.
- LWT payload type: The payload type for MQTT's Last Will and Testament feature. The options are string and base64.
- LWT QoS: The Quality of Service value for MQTT's Last Will and Testament feature.
- LWT retained: Select this check box to retain the value for MQTT's Last Will and Testament feature.
- Throttling limit: The maximum number of messages per second to be processed. The default value is zero, which means that there is no limit.
- Persistent storage: When enabled, this will cause messages to undergo a store-and-forward procedure. Messages will be stored within Manufacturing Connect Edge when cloud providers are online.
- Queue Mode: Select the queue mode as lifo (last in first out) or fifo (first in first out). Selecting lifo means that the last data entry is processed first, and selecting fifo means the first data entry is processed first.
To observe the log file:
- Return to the Ubuntu system.
- Open a Terminal window if none is open.
- Enter sudo tail -f /var/log/mosquitto/mosquitto.log and press ENTER to open the log file.
- View the incoming requests.
After adding the connector, click the toggle in the connector tile to enable it.
If you see a Failed status, you can review the Connector Logs and relevant error messages.
To view the connection in the log file:
- Return to the Ubuntu system log file.
- Enter sudo tail -f /var/log/mosquitto/mosquitto.log. The log file shows the new connection.
You should see something like this: