Skip to content

Latest commit

 

History

History
74 lines (54 loc) · 4.24 KB

README.adoc

File metadata and controls

74 lines (54 loc) · 4.24 KB

HiveMQ Sparkplug Aware Extension

Extension Type GitHub release (latest by date) GitHub GitHub Workflow Status

Purpose

This HiveMQ Sparkplug aware extension has the purpose to fulfil the new Sparkplug Release of the Sparkplug specification extend HiveMQ with the functionality of a Sparkplug Aware Broker wich is an optional Requirement.

This includes on top of providing the necessary native HiveMQ MQTT features like Retained Message handling and all QoS levels the following

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 conf/sparkplug.properties 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 of 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 send to the systopic can be configured to a smaller lifetime. If not set, the standard expiration of 4.294.967.296 seconds for a message is used.

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/conf/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

  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-aware-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 Aware Extension is licensed under the APACHE LICENSE, VERSION 2.0. A copy of the license can be found here.