Skip to content

HiveMQ Extension

Sparkplug Aware

This extension adds to HiveMQ with the functionality of a Sparkplug Aware Broker, which fulfills the optional requirements of the new Sparkplug specification.

Version: 4.24.0

License: Apache 2.0

Provider: HiveMQ

Verified: Yes

Purpose

This HiveMQ Sparkplug Aware Extension extends HiveMQ with the functionality of a Sparkplug Aware Broker, which fulfills the optional requirements of the new Sparkplug specification, released with the new Sparkplug Release - Sparkplug v.3.0.0. Apart from providing the necessary native HiveMQ MQTT features like Retained Message handling and all QoS levels, the Sparkplug Aware Broker fulfills the following requirements.

REQUIREMENTS:

  • A Sparkplug Aware MQTT Server MUST store NBIRTH and DBIRTH messages as they pass through the MQTT Server

  • A Sparkplug Aware MQTT Server MUST make NBIRTH messages available on a topic of the form: $sparkplug/certificates/namespace/group_id/NBIRTH/edge_node_id

  • A Sparkplug Aware MQTT Server MUST make NBIRTH messages available on the topic: $sparkplug/certificates/namespace/group_id/NBIRTH/edge_node_id with the MQTT retain flag set to true

  • A Sparkplug Aware MQTT Server MUST make DBIRTH messages available on a topic of the form: $sparkplug/certificates/namespace/group_id/DBIRTH/edge_node_id/device_id

  • A Sparkplug Aware MQTT Server MUST make DBIRTH messages available on this topic with the MQTT retain flag set to true

  • A Sparkplug Aware MQTT Server MAY replace the timestamp of NDEATH messages. If it does, it MUST set the timestamp to the UTC time at which it attempts to deliver the NDEATH to subscribed client.

Configuration

The Extension expects the configuration file sparkplug.properties to be in the extension home folder. This configuration file contains a set of properties to align the behavior of the extension. The topic structure root for the systopic, and the sparkplug version can be configured. Compression is switched off by default. An optional log output of the payload in formatted JSON can be configured. The JSON is available from a separate logger. The Message Expiry of the retained messages sent to the systopic can be configured to a smaller lifetime. If not set, the standard expiration for a message is used (max_uint seconds).

Default properties are:
sparkplug.version=spBv1.0
sparkplug.systopic=$sparkplug/certificates/
sparkplug.compression=false
sparkplug.json.log=false
sparkplug.systopic.msgExpiry=4294967296

JSON Logging configuration

When using logger sparkplug.json.log, add the configuration settings appender and logger from the src/hivemq-extension/logback-example.xml file to your hivemq/conf/logback.xml configuration. With this, the sparkplug payload will be written as JSON into the separate file hivemq/log/sparkplug-json-payload.log.

Installation

Installing the extension for HiveMQ is very easy:

  1. Clone this repository into a Java 11 Gradle project.

  2. Execute the Gradle task hivemqExtensionZip to build the extension.

  3. Move the file: build/hivemq-extension/hivemq-sparkplug-compatible-extension-4.X.X.zip to the directory: HIVEMQ_HOME/extensions

  4. Unzip the file.

  5. Start HiveMQ.

Contributing

If you want to contribute to HiveMQ Sparkplug Aware Extension, see the Contribution Guidelines.

License

HiveMQ Sparkplug Extension is licensed under the APACHE LICENSE, VERSION 2.0. A copy of the license can be found here.

Need Help?

We're always happy to answer any questions you may have during installation. The best place to get in contact is ourcommunity forum.

Get started with HiveMQ today

Choose between a fully-managed cloud or self-managed MQTT platform. Our MQTT experts can help you with your solution and demonstrate HiveMQ in action.

HiveMQ logo
Review HiveMQ on G2