Primary Host ID Setting
Implementing MQTT in Ignition: Video 102 min video / 2 minute read
< Previous Video | Next Video >
Travis Cox discusses the primary host ID setting for the MQTT Engine and MQTT Transmission Module. The primary host ID identifies the main application that is receiving the MQTT data to guarantee that data doesn’t get lost and gets delivered to the desired application.
Travis: In this session, we're going to discuss the primary host ID setting for both the MQTT Engine and Transmission Modules. The primary host ID is an ID to identify the main application that is receiving the MQTT data to guarantee that we don't lose the data and ultimately deliver it to the application. The ID is used for state notifications. These notifications are used to notify the Edge Node if the primary application goes offline. If the Edge Node is notified that the primary application has gone offline, it will close its connection with the server and it will lock to the next one on the list. If there's no next on the list, it will store that data locally in a buffer. That way, when it connects, when it comes back up, we can deliver that data to its final destination. If that primary host ID is not set, the Edge Node will not subscribe on these notification topics and will not receive any of these state notifications.
So it's only going to buffer data in the case where it loses connection to the MQTT server, not if the application loses connection to the MQTT server. So, because it's really important for critical applications to identify this primary host ID and to actually use it on both sides. In my case, I'm using the MQTT Engine Module as my primary application here in Ignition. So, we're going to go to the configuration area, I'm going to go down to the MQTT Engine settings, and right down the general, we can specify this primary host ID. So I'm going to call mine Main Ignition. So now this Main Ignition is my primary application using this ID. I have to make sure that the Edge knows about this as well. So in my case, the Edge is the Transmission Module, so we're going to go to the MQTT Transmission settings and we'll go to the server sets. And on my default set, that's what I'm using. If I edit that, I can specify the primary host ID here as well. So, I'm going to specify the same one, Main Ignition. Now, the Edge will be notified if the main application goes offline, and can store that data. As well as, of course, it will store that data if it goes offline, if it disconnects from the MQTT server as well. So we're good to go on both sides of the fence. Now, we can only have one primary host ID, so we have to set it to our most critical application on the central side.