A Spring Boot demo application showing the usage of hivemq-spring-boot-starter.
In order to use this demo, you first need to build the hivemq-spring-boot-starter.
Follow the section on building the starter at hivemq-spring-boot-starter.
If you're done you can clone this repository and start the demo:
git clone https://github.com/janosch24/hivemq-spring-boot-demo
gradlew bootRun
Using the given settings in src/resources/application.yml, you should then be able to connect to localhost:1883 using any MQTT-client, like MQTT Explorer or NodeRED.
- Subscribe to topic boot/extensions/# to see some information about the running embedded extensions.
- Subscribe to topic boot/ping/# to see the output of the running embedded extensions.
For a general understanding of HiveMQ Extension SDK, see HiveMQ Extension Developer Guide.
To learn more about HiveMQ-CE and embedded extensions, read the HiveMQ Community Edition Wiki.
Following some restrictions figured out so far.
As stated already for the hivemq-spring-boot-starter we had to downgrade some Spring managed dependencies regarding
the JAXB XML config file parsing for HiveMQ (javax style vs. jakarta style).
Take a look at the gradle.properties file of this project to find out about the used dependency versions.
So, if there are other components in your application, requiring the original Spring managed dependencies, it probably
will result in some clashes. Currently, there is no work-around for such cases.
HiveMQ comes with a logback.xml, which will take precedence unless you have defined your own one. If you did, in turn you cannot include the one from HiveMQ, as it is not ready to be included. Recommendation is, to force Spring Boot to use your own Spring-ready logback-spring.xml like this:
logging:
config: classpath:logback-spring.xml
Then don't forget to include the logback-spring-hivemq.xml provided by the hivemq-spring-boot-starter in your own logback-spring.xml.