BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Quarkus, a Kubernetes Native Java Framework

Quarkus, a Kubernetes Native Java Framework

This item in japanese

Lire ce contenu en français

Bookmarks

Red Hat has released Quarkus, a Kubernetes native Java framework tailored for GraalVM and OpenJDK HotSpot. Quarkus aims to make Java a leading platform in Kubernetes and serverless environments, offering developers a unified reactive and imperative programming model.

Quarkus brings a full-stack framework by leveraging a series of libraries used by Java developers, such as Eclipse MicroProfile, and Vert.x. Quarkus dependency injection is based on CDI, enabling developers to use JPA/Hibernate, JAX-RS/RESTEasy, and more. Furthermore, Quarkus includes an extension framework that third-party framework authors can leverage to extend it; this extension framework also compiles to a GraalVM native binary.

According to RedHat, Quarkus delivers significant runtime efficiencies, such as a fast startup enabling automatic scaling up/down of microservices on containers and Kubernetes, low memory utilization helping to optimize container density in microservices architecture deployments, and smaller application and container image footprint.

(Image taken from https://quarkus.io/)

Quarkus is designed to seamlessly bring both imperative and reactive models, aiming for rapid adoption by Java developers who are familiar with the imperative model and do not want to learn a new paradigm, as well as developers who are adopting a cloud native/reactive model approach.

Imperative style:

@Inject
SayService say;

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
    return say.hello();
}

Reactive style:

@Inject @Stream("kafka")
Publisher reactiveSay;

@GET
@Produces(MediaType.SERVER_SENT_EVENTS)
public Publisher stream() {
    return reactiveSay;
}

It is also possible to implement functions using Quarkus to be used in serverless environments, such as the following AWS Lambda example:

public class HelloLambda implements RequestHandler {

    @Inject
    HelloGreeter greeter;

    @Override
    public String handleRequest(HelloRequest request, Context context) {
        return greeter.greet(request.firstName, request.lastName);
    }
}

Quarkus has been designed to have little or no configuration, working intuitively. For this, developers can scaffold a new project with:

mvn io.quarkus:quarkus-maven-plugin:0.12.0:create \
    -DprojectGroupId=my-groupId \
    -DprojectArtifactId=my-artifactId \
    -DprojectVersion=my-version \
    -DclassName="org.my.group.MyResource"

Quarkus also brings a Live Coding feature, which enable developers to avoid the boring process of Write Code → Compile → Deploy → Refresh Browser → Repeat. By running mvn compile quarkus:dev, Quarkus will launch in development mode. When it receives an HTTP request it will hold the request and check if any application source files have been changed. If they have, it will transparently compile the changed files, redeploy the application with the changed files, and then the HTTP request will continue to the redeployed application.

Quarkus seems to be at least an interesting alternative in the cloud era, where containers, Kubernetes, microservices, functions-as-a-service (Faas), and cloud native applications are delivering higher levels of productivity and efficiency.

More details about Quarkus can be found at the quarkus.io page. Developers who want to start with Quarkus can access the getting started guide, or any of the other guides available.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT