Skip to content

hivemq/hivemq-hello-world-extension

Repository files navigation

HiveMQ 4 Hello World Extension

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

Purpose

This Hello World extension sets a ClientLifecycleEventListener which logs the MQTT Version and identifier of every connecting and disconnecting client and registers a PublishInboundInterceptor to modify the payload of every Publish with the topic 'hello/world' to 'Hello World!'.

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-hello-world-extension-4.35.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. You should see a log message with its identifier and MQTT version.

Automatic Testing

Execute the HelloWorldInterceptorIT for automatic testing of the extension. It uses the HiveMQ Testcontainer to automatically package, deploy and run the extension inside a HiveMQ docker container. The test creates a HiveMQ MQTT Client to publish and receive a message with the topic 'hello/world'. It checks whether the payload has been changed correctly to 'Hello World!'.

Next Steps

Awesome, you got your first HiveMQ 4 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 HiveMQ Hello World Extension, see the contribution guidelines.

License

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