This extension sets a PublishInboundInterceptor to add a MQTT5 user property "kafkaKey" the payload of every MQTT3 Publish.
We strongly recommend to read the HiveMQ Extension Documentation to grasp the core concepts of HiveMQ extension development.
-
Clone this repository into a Java 11 Gradle project.
-
Execute the Gradle task
hivemqExtensionZip
to build the extension. -
Move the file:
build/hivemq-extension/hivemq-extension-4.18.0.zip
to the directory:HIVEMQ_HOME/extensions
-
Unzip the file.
-
Start HiveMQ.
-
Connect with an MQTT client of your choice as MQTT3 client.
-
Subscribe to a test topic.
-
Publish a message to the test topic as MQTT3 client.
-
Verify that received message has a user property
kafkaKey
.
The following example logger configuration adds the required logger.
Example extension logger configuration
<logger name="com.hivemq.extensions.userprop" level="TRACE" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE-MYEXTENSION"/>
</logger>
<logger name="com.hivemq.extensions.userprop" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE-MYEXTENSION"/>
</logger>
In the logger
configuration, the logger
name must match the package name of the associated extension and the appender-ref
must match the name of a defined appender. For appender configuration please refer to: https://docs.hivemq.com/hivemq/latest/user-guide/logging.html#_extension_log_file_configuration.
Awesome, you got the extension working.
Now read the HiveMQ Extension Documentation to see what extensions can do.
If you encounter any problems, we are happy to help. The best place to get in contact is our support.
If you want to contribute to the extension, see the contribution guidelines.
HiveMQ Extension is licensed under the APACHE LICENSE, VERSION 2.0
.
A copy of the license can be found here.