How-To Guides
Integration Guides
Generic MQTT Integration Guide (Mosquitto)
6min
review the following guide for setting up an integration between manufacturing connect edge and an mqtt broker using mosquitto mosquitto is a lightweight open source message broker that implements mqtt versions 3 1 0, 3 1 1, and version 5 0 before you begin you must download the mosquitto message broker see the mosquitto download page to learn more configure mosquitto so that anonymous users are allowed to access it to verify that mosquitto is running in windows, open up a command prompt and enter netstat an if mosquitto is successfully running, you should be able to see your ip address and port 1883 if you don't see port 1883 being used open task manager > services and start/restart the mosquitto server from there make sure the mosquitto conf file is correctly configured so that mosquitto can run on your system step 1 add generic mqtt connector follow the steps to add a connector docid\ m2nifnaadyphcvzwmcoto and select the mqtt generic provider configure the following parameters name a recognizable name to identify the connector hostname mosquitto is running locally on your pc, so enter your ip address port confirm that the default value 1883 is entered client id enter 1 username leave this field blank password leave this field blank qos make sure the default value 1 is entered parallel publish count confirm the default value 100 is entered the number of messages being published simultaneously once the defined limit has been reached, subsequent messages are silently dropped the default value is 100 integration topic enter mos topic 1 lwt topic the topic for mqtt's last will and testament feature you can leave this value blank lwt payload the payload for mqtt's last will and testament feature you can leave this value blank 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 the default value is 1 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 step 2 add outbound/inbound topic to connector to add the outbound and inbound topics to the mqtt connector navigate to integration click the mqtt generic connector tile click the topics tab click the add a new subscription icon the data integration dialog box appears configure the following parameters data direction select local to remote outbound local data topic enter a local data topic remote data topic confirm the topic where the data is pushed this is the integration topic value for the connector enable select the toggle to enable the topic click ok to add the topic click the add a new subscription icon again to add the inbound topic configure the following parameters data direction select remote to local inbound local data topic enter integration raw\ mos topic 1 remote data topic confirm the topic where the data is pushed this is the integration topic value for the connector enable select the toggle to enable the topic click ok to add the topic step 3 enable the connector after adding the connector, click the toggle in the connector tile to enable it if you see a failed status, you can review the manage connectors docid\ zz28hztqbk7od xsj81o8 and relevant error messages step 4 create flow to verify connection to create the flow in manufacturing connect edge, navigate to flows manager click the go to flow definition icon for a selected flows manager the flow canvas opens in a new browser tab from the node palette, drag the datahub subscribe node (dataconnector section), inject node (common section), and debug node (common section) to the canvas connect the datahub subscribe and inject nodes to the debug node double click the datahub subscribe node the edit datahub subscribe node dialog box appears in the topic field, enter integration raw\ mos topic in if needed, configure the datahub subscribe connection see create a flow docid\ veeod3n3slcasdleedzbr to learn more click done double click the inject node the edit inject node dialog box appears in the msg payload field, select string in the msg topic field , enter integration raw\ mos topic 1 enter test in the name field, and then click done click deploy to save the flow open the command prompt window and go to the directory that stores mosquitto files enter mosquitto pub exe t mos topic 1 m "hello from mosquitto" , and then press enter in the browser window that has the manufacturing connect edge flow canvas, expand the message window beneath the flow to view debug messages and click the debug icon verify that hello from mosquitto displays