Overview
Get a practical introduction to Quarkus, the full-stack framework for building cloud-native Java applications, with Quarkus in Action.
This hands-on guide teaches you how to use Quarkus to build resilient, scalable applications. Building on an example car rental application, you’ll explore technologies that integrate with Quarkus to provide functionalities integral to modern applications.
Dive into features that make Quarkus application development unique:
- Use Quarkus Dev mode to speed up and enhance Java development
- Observe and troubleshoot running applications using the Dev UI
- Automate background testing with the Continuous Testing feature
- Integrate frameworks and libraries such as Reactive Messaging, gRPC, and GraphQL
- Easily deploy applications on Kubernetes and Red Hat OpenShift
- Automatic management of remote services such as databases and message brokers
This book is ideal for intermediate Java developers with experience developing server-side Java applications.
Note: This PDF download of Quarkus in Action includes Chapters 1-11 in preview edition format, available through the Manning Early Access Program (MEAP). The final book is expected to be released in January 2025.
Because this is a work in progress, the manuscript currently references multiple Quarkus versions. The examples will align to a single version once the book is finalized for publication.
Excerpt
Java is one of the most popular programming languages utilized for developing enterprise systems. With its vast ecosystem of libraries, frameworks, standards, runtimes, and most importantly us, the developers, Java represents a genuine choice for building modern, robust, and scalable software.
However, many systems often solve similar challenges. This is why they often rely on some underlying technology that provides solutions to these problems. Whether the composition of the system consists of a set of JARs, WARs, or EARs (Java, Web, or Enterprise Archives) deployed on an application server, or whether it follows the more recent microservices architecture, there are multiple choices of Java frameworks and libraries that the system can utilize.
Quarkus is a Java framework primarily targeting microservices and serverless applications. It aims to provide an application framework that delivers unmatched performance benefits while still providing a development model utilizing the APIs (Application-Programming interfaces) of popular libraries and Java standards that the Java ecosystem has been practicing for years. Quarkus also puts a strong focus on developer productivity because a technology’s productivity and usability are what developers appreciate the most.
In this book, we focus on delivering a concise learning experience of the Quarkus framework assuming no prior Quarkus experience and gradually building towards a completely developed enterprise system consisting of multiple Quarkus microservices. Our priority is to explain the main concepts, tools, and features of Quarkus, so by the end of the book you understand the values that Quarkus provides and can also assess the Quarkus applicability for your projects.
1.1 Why Quarkus?
Especially with the move to the cloud environments, application startup times (as restarts are managed by the deployment platform) and memory/CPU utilization (representing cloud costs) became the prominent application metrics. However, Java was originally designed for big, long-running applications, which meant it didn’t particularly fit into these environments.
Quarkus was created to address these issues. It defines a very lightweight framework that splits the application processing into the build-time and runtime phases. Any Java stack needs to do a lot of processing once the application starts, e.g. reading and processing of the application’s code, annotations, configuration, injection points (inversion of control), or generating dynamic code to properly initialize the application within the framework. And all of this processing repeats with every application start.
Quarkus, on the other hand, splits the processing into build-time and runtime phases. It moves as much of the processing as possible to the build time phase (application build/packaging) to save resources at runtime. The packaged application carries only the results of these initial framework operations, which makes it not only faster to start since they don’t need to be executed at startup, but also smaller in size, because any code that is needed only in this initialization phase is never included in the final packaged artifact.
While performance benefits are very important, Quarkus also puts enormous effort into the developer experience when using the framework. It provides the so-called Dev mode which is a continuous execution of the Quarkus application allowing live reloads of (not only) code changes without the application restart or compilation. By just saving our changes in the editor and invoking the application, Quarkus dynamically applies our changes, so we can see the results of our modifications in mere milliseconds. The development flow doesn’t need to stop to recompile and rerun the application which closes the reevaluation loop in a continuous experience similar to scripting languages while we still work with JVM. Dev mode bundles a lot of productivity boosting features that we dive into in this book.
Quarkus also exposes all these features for integrations which makes it very popular also among library developers. With its over 670 extensions (pluggable pieces of functionalities) that integrate different popular libraries (e.g., Hibernate, Jackson, or LangChain4j), Quarkus proves that it stands out as a framework where the Java ecosystem wants to be.