This was a post writted for Making Devs Blog.
Recently we use the project Vertx for develop a project. Now I’m going to talk about the basic functionality.
VertX is a tool-kit for building reactive applications on the JVM.
It has many interesting features:
- Actor model based.
- It’s polyglot: you can use with Java, Groovy, Ruby, Scala, Ceylon, Javascript, and Kotlin.
Verticles
For the beginning it’s important know that VertX has a nervous system called Event Bus, where you can write and run Verticles.
Verticles are chunks of code that get deployed and run by Vert.x.
In groovy, a verticle is called consumer.
Every verticle have an identifier, it’s only a String. It could be deployed on a script or a class, and into him you can receive a message from another part of the Event Bus, and send a reply.
A Vertx Verticle:
-
Run on the event bus.
-
Have a address identifier (string)
-
Have a deployment ID (deployment identifier)
- It can receive a message and send a reply to the same message
- It can send message for other verticles

A simple groovy consumer:
| vertx.eventBus().consumer( "com.makingdevs.my.first.verticle" ){ message -> | |
| String deploymentId = vertx.getOrCreateContext().deploymentID | |
| println "This consumer has this deployment ID ${deploymentId})" | |
| println "The message received by this verticle is ${message.body}" | |
| } | |
| vertx.eventBus().send("com.makingdevs.my.first.verticle", "== Hello Vertx! ==") |
Deploy Verticles
The verticles can be deployed for be available on the event bus. When a verticle be deployed, it will be available on the Event Bus. You can deploy one consumer, or N instances of the same consumer.

Sending Messages
You can send messages to verticle trough the verticle’s address. And it could be point to point, or a broadcast. With this simple concepts we can make a simple design using VertX verticles.
Ping-Pong simple example.
| vertx.eventBus().consumer("com.makingdevs.ping"){ message -> | |
| println "Message Received: ${message.body()}" // Pong! | |
| message.reply("ping") | |
| } | |
| vertx.eventBus().send("com.makingdevs.ping", "pong"){ reply -> | |
| if(reply.suceeded()){ | |
| println "Reply Received: ${reply.result().body()}" // Ping! | |
| } | |
| } | |

This are only the basics concepts of VertX, because this toolkit is much bigger and useful.
You can learn more on VertX site Vertx Site
Visit the [ VertX Google Group ] (https://groups.google.com/forum/#!forum/vertx)
Thanks for reading.
@carlogilmar