Article - CS332981

Can I Set up a Mosquitto MQTT Broker to Receive KEPServerEX IoT Gateway Messages?

Modified: 02-Nov-2020   


Applies To

  • Kepware Server (formerly KEPServerEX) 5.19.467.0 to 6.8
  • ThingWorx Kepware Server (legacy) 8.0 to 8.4

Description

Yes! Setting up a Mosquitto MQTT Broker to Receive KEPServerEX IoT Gateway Messages The KEPServerEX IoT Gateway Plug-in does not include an MQTT broker. A third-party broker, such as Mosquitto, may be configured to receive messages from the IoT Gateway Plug-in agent. Follow these instructions to setup Mosquitto on a Microsoft Windows computer or refer to the vendor instructions. Tip : The Mosquitto broker may be installed on the machine running KEPServerEX and the IoT Gateway Plug-in. Prerequisites: Mosquitto relies on several third-party packages to install properly. The following should be installed before Mosquitto according to its documentation: Microsoft Visual C++ 2010 Redistributables Link: http://www.microsoft.com/en-us/download/details.aspx?id=5555 Install vcredist_x86.exe OpenSSL Link: http://slproweb.com/products/Win32OpenSSL.html Install "Win32 OpenSSL " Use all the default settings in the installer Required DLLs: libeay32.dll ssleay32.dll pthreads Link: ftp://sourceware.org/pub/pthreads-win32 No install needed for pthreads-w32--release.zip Required DLLs: pthreadVC2.dll Installation: Install Mosquitto. Link http://mosquitto.org/download/ Install Windows Binary mosquitto--install-win32.exe (Native build, Windows Vista or higher) Copy the following files from the OpenSSL installation, C:\OpenSSL-Win32, to the Mosquitto root folder, C:\Program Files (x86)\mosquitto: ssleay32.dll libeay32.dll Copy the following file from the pthreads zip archive to the Mosquitto root folder, C:\Program Files (x86)\mosquitto: pthreads-w32--release.zip\Pre-built.2\dll\x86\pthreadVC2.dll Running Mosquitto: To start the broker, open a command prompt by clicking on Start | All Programs | Accessories | Command Prompt . In the command prompt, navigate to the Mosquitto root folder, such as C:\Program Files (x86)\mosquitto. Start the Mosquitto service by running the command: " net start mosquitto" . Acknowledge the message: The Mosquitto Broker service was started successfully. Connecting to the Mosquitto Broker: Follow the steps in the KEPServerEX IoT Gateway Plug-in help system to setup an MQTT agent. In the agent, the URL is tcp://:1883. Set the topic (user configurable). Set the publish rate to a reasonable number, such as 1000ms. Add a tag to the agent. This tag should change value at least once per the publish interval set in step 4 or be configured to send "every scan" to confirm function. Once the tag is added, confirm this event log message in KEPServerEX Configuration interface: "MQTT agent is connected to broker 'tcp://:1883'" Verifying the Data: Open a command prompt by clicking on Start | All Programs | Accessories | Command Prompt . In the command prompt, navigate to the Mosquitto root folder, such as C:\Program Files (x86)\mosquitto. Start the Mosquitto subscription service by running the command:  " mosquitto_sub.exe -t # "  where "?t #" instructs the mosquitto_sub program to display data published to all topics on the Mosquito broker. Verify the data IoT Gateway Plugin is publishing to the Mosquitto Broker appears in the command window. Congratulations!
This is a printer-friendly version of Article 332981 and may be out of date. For the latest version click CS332981