Lesson 10. Quarkus Overview


Quarkus

Why
Quarkus is a cutting-edge Kubernetes-native Java framework designed to optimize Java applications for cloud and container environments. It empowers developers to build high-performance microservices and serverless applications with minimal memory consumption and ultra-fast startup times.

Learn
Explore Quarkus’s developer-centric tools, live coding capabilities, and integrations with popular libraries. Dive into reactive programming, RESTful APIs, and native image creation with GraalVM. Whether you're a beginner or an expert, Quarkus enhances productivity.

Extensions
With over 400 extensions, Quarkus simplifies integration with Kafka, RESTEasy, Hibernate, and other frameworks. Its extension ecosystem ensures adaptability for a variety of workloads, including event-driven and API-centric systems.

Community
Quarkus is driven by a vibrant open-source community. Collaborate, learn, and contribute through guides, mailing lists, and forums. The Quarkus community fosters innovation and shares best practices for modern application development.


START CODING

Getting started with Quarkus is simple and efficient. Below are step-by-step instructions to create your first Quarkus application.


Step 1: Install via Command Line Interface

Installing the Quarkus CLI is straightforward. Use JBang, a powerful tool for Java CLI applications, to set it up effortlessly. You don’t need Java pre-installed.

For Linux, macOS, and Windows (using WSL or bash-compatible shells like Cygwin or MinGW):

curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio

For Windows using PowerShell:

iex "& { $(iwr https://ps.jbang.dev) } trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/"
iex "& { $(iwr https://ps.jbang.dev) } app install --fresh --force quarkus@quarkusio"

Alternative Installation with SDKMAN!:

sdk install quarkus

For additional options, such as Homebrew or Chocolatey, consult the Quarkus CLI Guide.


Step 2: Create the Getting Started Application

Use the CLI to generate a basic Quarkus application:

quarkus create && cd code-with-quarkus

This command initializes a project structure, pulling all necessary dependencies to begin coding.


Step 3: Run the Getting Started Application

Start your Quarkus app in development mode:

quarkus dev

Your application will now run locally at http://localhost:8080. Quarkus’s hot reload ensures instant reflection of code changes without restarting.


Step 4: Live Coding with Quarkus

Modify your Quarkus application in real time:

  1. Open src/main/java/org/acme/GreetingResource.java in an editor.

  2. Change "Hello from RESTEasy Reactive" to "Hola from RESTEasy Reactive".

  3. Refresh the browser and observe the updated response.

Example Code:

@Path("/hello")
public class GreetingResource {
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        return "Hola from RESTEasy Reactive";
    }
}

Live coding makes it incredibly fast to test and refine your applications without restarting the development server.


Next Steps

After creating your first app, explore advanced features to deepen your expertise:

  1. Building Native Executables:
    Use GraalVM or Mandrel to compile native binaries for fast, efficient execution.

  2. Continuous Testing:
    Implement Quarkus’s continuous testing capabilities to debug and validate code on the fly.

  3. Start with Serverless:
    Create serverless functions deployable to platforms like AWS Lambda and Azure Functions.

  4. Quarkus Tools in IDEs:
    Leverage Quarkus plugins for popular IDEs like IntelliJ IDEA, VS Code, or Eclipse.

  5. Writing JSON REST Services:
    Learn how to handle JSON payloads effectively in RESTful APIs.

  6. Getting Started with Reactive:
    Build high-throughput, event-driven applications using Quarkus’s reactive extensions.

  7. Deploying on Kubernetes:
    Deploy GraalVM-native applications on Kubernetes for scalable and efficient microservices.


Community and Open Source

Quarkus is a community-driven framework built on Apache-licensed projects. Contribute, learn, and collaborate through various platforms like GitHub, Stack Overflow, and mailing lists. Together, we can build faster, better, and more scalable Java applications.


Navigation and Help

  • Explore guides, FAQs, and forums for assistance.

  • Connect with the community on GitHub, Mastodon, LinkedIn, and more.

  • Join discussions and mailing lists to stay updated.


Extensions and Dependencies

Quarkus integrates with popular projects like SmallRye, Hibernate, RESTEasy, and Apache Camel. These extensions enable you to build powerful, feature-rich applications with minimal effort.


This guide ensures you can start coding with Quarkus while gaining insights into its ecosystem and potential. Dive deeper into the official guides to master Quarkus.