You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

Overview

The MQTT Sparkplug B specification defines a way for subscribing clients (like MQTT Engine) to notify publishing clients (like MQTT Transmission) when they are online or offline. The publishing clients can then key off of a particular subscriber’s status to do different things when the subscriber’s status changes either online or offline. One example would be that the disconnection of a main application such as a SCADA system could trigger the devices to stop transmitting any data as the main application is not available to receive the published data.

When the MQTT server determines an ungraceful disconnect between itself and the main application, it will publish a retained message to all connected clients stating that the main application is offline. When the Edge Node is notified that the Main application has gone offline, the Edge Node will close its connection with the server and it will walk to the next one on the list. If the Edge Node is unable to make a connection to any server, it may have the ability to store that data locally in a buffer. That way, when it reconnects, the stored data can be delivered to its final destination.

The primary host ID is used for state notifications which are used to notify the Edge Node if the primary application goes offline.

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. In this case, data will only be buffered when it loses connection to the MQTT server not if the main application loses connection to the MQTT server. 

Changes to the STATE message in the Sparkplug v3.0.0 Specification

MQTT Modules

For the MQTT Transmission (Edge Node) and MQTT Engine (main application) modules, the Primary Host ID is the setting used 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.

MQTT Transmission and MQTT Engine support server sets where each set represents a logical grouping of MQTT servers and the Primary Host ID is configurable on a Server Set basis 

MQTT Engine

When configured, MQTT Engine will publish its connection state on a topic that contains the Primary Host ID.

MQTT Distributor or Chariot

In the event that MQTT Engine becomes disconnected from the MQTT Distributor or Chariot server, a death certificate will be published on the same topic setting the state to 'offline'.  Any connecting client that subscribes on the state topic will then be notified of the MQTT Engine state.

MQTT Transmission

When configured, MQTT Transmission will subscribe on 'state' notification topics. If MQTT Transmission is notified that MQTT Engine has gone 'offline', it will close its client connection with the MQTT server and begin to store messages locally (assuming Store and Forward is enabled) to be sent once MQTT Engine is back online.

When MQTT Transmission is notified that MQTT Engine is back 'online', it will publish all BIRTH messages along with the stored data.


If the Primary Host ID is not set:

  • MQTT Transmission will not subscribe on the notification topics and not receive any 'state' notifications to trigger the data storage
  • MQTT Engine tags that were set to Stale on a disconnect from the MQTT server will remain staled after a re-connect until either:
    • Data changes at the Edge which will result in a REBIRTH request from MQTT Engine
    • An MQTT Transmission refresh is performed forcing BIRTH messages to be published




  • No labels