Java Reactive Solutions — My impressions on Spring,Quarkus,Jooby and VertX

Shay Dratler
5 min readJan 5, 2022

--

Introduction

In the last two years, I was working with VertX on a project and I fell in love with the concept of VertX.

The main idea is breaking all moving parts into Nano \ Single Responsible components.

But the Java Markets held more than one flavor of Solutions so I have decided to try also :

  • Spring Reactive Empowered by Reactor project
  • Quarkus
  • Jooby

So first thing to starting all these frameworks\toolkits are mature and but each one of them requires some time to learn and every one of them have pitfalls that need to be addressed.

What is Reactive and why Should I care?

I have found this definition: “reactive programming is a programming paradigm where the focus is on developing asynchronous and non-blocking components”.

So the main idea is as I see it as working in an asynchronous way with Java, but if we think about it a little bit dipper then when working with Java the main power if the language is thread handling, and reactive programming does it for use in many many many frameworks\toolkits and this is why you should care.

You can focus on resolving the problems and let Java handle the rest.

On Spring Reactive

Spring

Spring is a framework, from all other competitors it’s the biggest it has the most features and big community but it comes with penalties for good or bad, I will let you to be the judge of it.

Spring reactive does not come out of the box being work-ready, there is a need to fine-tune it and to work by Sprint Reactor project.

Once you have set your project to be reactor ready and replace to web-server to be Netty or else but not tomcat you are almost done now you need to decide whether you what to work using Mono or Flux, this part is critical it will define your system behavior.

I think the only way for one to understand what he wants or what he\she needs are to do the tutorial but before that to understand the use-case Spring does it with well-written documentation.

Spring also has the longest loading time this is due to being a framework and mostly relays on boot loader mechanism for loading all required jars to start the application, IMO I don’t recommend changing it but it can be done.

With Spring you are gaining some good parts such as very mature security, filtering, DI and annotations by Spring, and more, Spring is the biggest and most common if you wish keep it safe and have a lot of time fine-tuning it this is the right place for you.

Meet Jooby

Jooby is our first competitor it’s also a framework but unlike Spring it’s a modular basis meaning once you need a module you will need to add it via Gradle or via Maven.

Jooby allow you being to work non-blocking and asynchronous, you will need to define your flavor of web server Jetty, Netty, or undertow web server.

As before it’s recommended that you will read the documentation it’s lighter than what Springs offers.

Same as Spring you will gain some good parts such as DI powered by Google Guice and many modules from different databases and more.

IMO Jooby is a nice try but not really there yet, but if you like working with Callables this is the place for you.

Wrap it up with Quarkus

Quarkus is also a framework that according to the authors :

“Quarkus was created to enable Java developers to create applications for a modern, cloud-native world. Quarkus is a Kubernetes-native Java framework tailored for GraalVM and HotSpot, crafted from best-of-breed Java libraries and standards. The goal is to make Java the leading platform in Kubernetes and serverless environments while offering developers a framework to address a wider range of distributed application architectures”

I haven’t tried it on the container but I did write a simple “hello world” application and Quarkus is aiming to be Reactive driven it’s on their tutorials but from the code level its closer to being a plain java application written in streams.

While playing with it I have found it a little bit trickier to debug.

I think if you like steam and you want to go reactive this will be a good place to start.

Enter the Vert.X

Unlike frameworks VertX defines itself as a Toolkit, so the solution itself might be not covered everything, from what I have worked on it has most of the moving parts I needed.

VertX Syntax is also a little bit different than other Solutions it’s more JavaScript oriented it has a code block on that code block the code is being executed.

VertX also does has unique annotations such as Spring (@Service,@Repository etc…) but the main idea is to write each Vertical as a nano service meaning you will have many Vertical that each one does on the operation and it does it well.

VertX also recommends using its Eventbus (queues) to communicate between Verticals internally and also it can be monitored by Prometheus.

VertX code is been generated as anonymous functions for good or bad it takes time to learn and also it rais a new issue, the pyramid of Death right out of languages such as JavaScript.

I think if you know JavaScript and has some of Robert Cecil Martin (Aka uncle Bob) principles you will get along with this toolkit and it will be one of your tools in the tool belt

My Two Cents

I think Reactive programming in Java entered a readiness phase and it’s worth starting using it and elevating your Java applications with one of these solutions.

I think I would work with Quarkus or VertX if my project is container driven, I think Spring is a very good framework but it very has and it’s start time is its main pitfall and as for Jooby it’s not really Reactive ready and to me it felt not there (yet).

All of these solutions can be contributed to being better so it’s a great plus.

From me Happy Coding.

--

--