Note
|
HiveMQ 4 uses a new extension system. This HiveMQ 3 plugin is not compatible with HiveMQ 4. The new version can be found here. |
This Hello World plugin is a showcase for the kind of functionality that is possible within the HiveMQ plugin environment. There is a Maven Archetype available to generate a much more basic plugin from the IDE.
We strongly recommend to read the HiveMQ Plugin Documentation to grasp the core concepts of HiveMQ plugin development.
This Hello World plugin implements a few simple HiveMQ Callbacks to get you started:
-
A callback when a client connects
-
A callback when a client disconnects
-
A callback when a client publishes something
-
A callback when HiveMQ starts
-
A scheduled callback that gets executed every 5 sec
There are also some advanced callbacks, which implement more complex use cases:
-
A callback that shows the async Subscription Service
-
A scheduled callback using the RetainedMessages Service
-
A callback that shows the Client Service and Publish Service
Also, this hello world plugin can reads configurations from a properties file (and reloads it every 5 minutes).
There’s a Maven profile configured which starts HiveMQ with your plugin. Just enable the profile and run the package Maven phase.
Important
|
Don’t forget to set the path to your HiveMQ installation in the pom.xml. There’s a "FIXME:" in the pom.xml to remind you of that. |
The plugin is documented with javadoc which explains what’s going on. Please don’t forget to read the extensive HiveMQ Plugin Documentation.
-
Execute the package goal from Maven with the profile RunWithHiveMQ activated. (Need help?: Consult: The maven documentation)
-
Now HiveMQ should be running with your plugin installed.
-
Connect with a MQTT client of your choice and publish something. You should see some log output.
Awesome, you got your first HiveMQ plugin working. Now grab a coffee and prepare for the next steps:
-
Read about the available HiveMQ callbacks here.
-
Implement a great plugin. Bring your JDBC driver and do some database fun. Integrate with your favourite web service. There are no limits :-)
-
Blog about your awesome plugin. Tell us and if you like we can add your plugin to the plugin registry on http://www.hivemq.com
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 HiveMQ Hello World Plugin, see the contribution guidelines.
HiveMQ Hello World Plugin is licensed under the APACHE LICENSE, VERSION 2.0
. A copy of the license can be found here.