In the last few years we used Vert.x to prototype and develop several IoT related projects. Most of the projects use MQTT for lightweight messaging between the connected devices (or things ;)) and the applications. The messaging is handled by an external broker liker Mosquitto.
Instead of using an external broker it’s now possible to connect MQTT enabled devices directly to Vert.x using the Vert.x MQTT server project. Although the project is still in Tech Preview we’ll show you how use it to create a MQTT server within Vert.x. Continue reading
We currently use Vert.x in several internal and external projects. Until the most recent project we where building our Vert.x modules using Maven.
Gradle is our build tool of choice, but the default approach described at the Vert.x site caused several issues:
- The task of cloning, cleaning and configuring the template project is error-prone;
- The template project does not support recent Gradle versions >= 2.x;
- This approach is not compatible with the Gradle support in IntelliJ IDEA.
While starting our most recent project we investigated the possibility of using Gradle again. Instead of using the approach described at the Vert.x site we are using the excellent Vert.x Gradle plugin provided by Daryl Teo.
Using the following Gradle build file we are able to build and run our project from Gradle and import it successfully into IntelliJ IDEA:
// Configure the dependencies for our build script
// Specify our dependency on the marvelous plugin from Daryl Teo
// Apply the Groovy plugin to compile our Groovy code
apply plugin: 'groovy'
// Apply the Vertx plugin
apply plugin: 'vertx'
// Specify the project dependencies
// Configure Vertx
// Specify Vert.x version
// Language used
// Configuration of the module using Vert.x fields using camelcased names
// See: http://vertx.io/mods_manual.html#module-descriptor-file-modjson
// Specify the config file to pass to Vert.x using -conf when executing the runMod task
Using this configuration exposes the following Vert.x related Gradle tasks:
- modZip : Creates the module zip
- debugMod : Run the module including remote debugging
- runMod : Run the module
More information regarding this marvellous Gradle Vert.x plugin can be found at:
Note that the credits for the Vert.x Gradle plugin fully go to Daryl Teo. This post is only meant to raise the awareness of the existence of the plugin and to complement him for his great work.