Exploring the Vert.x MQTT server project

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.

At first we add the snapshot repository to our build.gradle file.

We also add our dependencies including the Vert.x MQTT server project.

Using the Vert.x MQTT server project we are able to create a MQTT server from within a Vert.x Verticle.

 

The “complete” code of this example can be found here https://bitbucket.org/rob_brinkman/vertx-mqtt-demo/ and is heavily based on: https://github.com/vert-x3/vertx-mqtt-server.

This entry was posted in Coding, MQTT, Vert.x by Rob Brinkman. Bookmark the permalink.

About Rob Brinkman

Rob's interests and knowledge focus on application development using open source software. He utilizes his Java experience as a developer hands-on architect on successful JVM based projects. When not online he prefers to spend his time with his kids and kitesurfing.

One thought on “Exploring the Vert.x MQTT server project

  1. Rob,

    Thanks for the tutorial, but can you please explain how a subscriber is going to get the message in Vetx MQTT.

    I can see
    MqttEndpoint subscribeHandler(Handler handler);

    which is invoked with each subscription, but how these subscription are going to get the message is what i am looking for.

    Thanks
    Tosheer

Leave a Reply

Your email address will not be published. Required fields are marked *