Skip to content

guinp1n/user-property-extension

Repository files navigation

HiveMQ 4 User Property Extension

Purpose

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.

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-extension-4.18.0.zip to the directory: HIVEMQ_HOME/extensions

  4. Unzip the file.

  5. Start HiveMQ.

First Steps

Manual Testing

  • 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.

Debug Logging

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.

Next Steps

Awesome, you got the extension working.

Now read the HiveMQ Extension Documentation to see what extensions can do.

Need Help?

If you encounter any problems, we are happy to help. The best place to get in contact is our support.

Contributing

If you want to contribute to the extension, see the contribution guidelines.

License

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

About

Adds user property to MQTT 3 packets

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published