Vert.x JVM Framework. MacOS installation Guide.

Distributed Systems Development A-Z Guide.

Dmytro Nasyrov
Pharos Production
4 min readFeb 10, 2019

--

Vert.x logo.

Give us a message if you’re interested in Blockchain and FinTech software development or just say Hi at Pharos Production Inc.

Or follow us on Youtube to know more about Software Architecture, Distributed Systems, Blockchain, High-load Systems, Microservices, and Enterprise Design Patterns.

Pharos Production Youtube channel

Everyone knows that JVM is fast and its horizontal scalability is a battle-tested feature for many developers. Today we have a zoo of frameworks and libraries available that are waiting for our choice when we start a new project. We can select well known Spring and Hibernate or Play framework. They are good with all imaginable features, but here in Pharos Production, we prefer to try tools that are mature enough but provide some other interesting capabilities than MVC and database connection out of the box. Also, we don’t need to build front end within the back end monolith. Today we have chosen a Vert.x framework for our future project. Our goal — minimize microservices features to only required for the usage, wrap functionality into an interface which comfortable for inter-microservice interaction, make it easily scalable and event-driven. Our messaging layer is Apache Pulsar and it’s awesome in terms of inter-microservice messaging. But also Pulsar’s nature is real-time events. So we want the same characteristics for all other parts of the system. Some microservices will be done with Elixir and Actors-based architecture, but for others, we select Vert.x from the zoo of technologies.

The first thing we want to do is to launch HelloWorld on our local machine. We use MacOS, so let’s install Vert.x on it. Also, we will use Scala. So let’s install Scala and SBT using Brew:

brew install scala

brew install sbt

To check if they work well just type scala and sbt in your terminal.

Scala is up and running.
SBT is up and running.

Now let’s boilerplate a new project from the seed. From command line execute:

sbt new vert-x3/vertx-scala.g8

You should see a newly generated project source now.

Generated source code

Import the project into IDEA. Now the most interesting part. How to make the project runnable from IDEA. Select preferable JDK. On the bottom of the window, you should see a Launcher — a path to sbt-launcher.jar. This jar file sits inside the sbt installation directory.

Import project.

If you have installed sbt from the brew, you can find Launcher at:

Brew Launch location.

Now continue with the project import and in project tree structure you should see, well, your project. Project setup should go automatically and hassle-free. Don’t forget to click Enable Auto-Import to auto-import libraries into the project structure.

Now it’s time to make this little panel work

Your favorite panel.

Add new Application configuration and name it RunVertx.

Configuration

Vert.x main class is io.vertx.core.Launcher. Use it to run Verticles. In program arguments add run scala:com.pharosproduction.vertx.HttpVerticle.

Where com.pharosproduction.vertx is a package name selected during project import. And HttpVerticle — one of two classes created for you by scaffolding script.

HttpVerticle is really straightforward. There is only one method startFuture() and the only one thing it does is running a brand new HTTP server with a single GET endpoint — /hello on port 8666.

HTTP server.

We’re ready to go! Click the Run button

A Server is up and running.

In browser open http://localhost:8666/hello. And the response is the world!

Hello World from Vert.x

Thank you for reading!

--

--

Dmytro Nasyrov
Pharos Production

We build high-load software. Pharos Production founder and CTO.