Microservices with Quarkus

Develop microservices with Quarkus and MicroProfile

I bet you already have heard about Quarkus and MicroProfile. Microservices is today the most popular architecture style when creating cloud-native applications. Spring Boot is a good choice, but typical frameworks like Java EE/Jakarta EE, are not sufficient.

Now Quarkus is an interesting alternative. Quarkus („Supersonic Subatomic Java“) is a MicroProfile implementation that focuses on efficiently running Java applications in containers and Kubernetes. MicroProfile gives you a good foundation for developing microservices-based applications by adopting a subset of the Java EE standards. The specifications include Config, Fault Tolerance, Health Check, Metrics, Open API, Rest Client, JWT Authentication and Open Tracing API.

So what are the advantages? A MicroProfile application with Quarkus using ahead-of-time (AOT) or even compiled to a native binary starts very fast and consumes less megabytes of memory. A simple Java JAX-RS application can start in 14 milliseconds while consuming only 13MB of memory.

I made a simple helloworld example by myself. Here I show you the HelloWorldController.

import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
@ApplicationScoped
public class HelloWorldController {

  @GET
  @Produces(MediaType.TEXT_PLAIN)
  public String hello() {
    return "hello world!";
  }
}

You find the full example on GitHub.

Links
Quarkus Getting Started https://quarkus.io/get-started/
Microprofile https://microprofile.io/
Quarkus Helloworld example https://github.com/claudioaltamura/quarkus-helloworld