chapter two

2 Your first Quarkus application

 

This chapter covers:

  • Creating a Quarkus project
  • Developing with Quarkus Live Coding
  • Writing tests for a Quarkus microservice
  • Deploying and running a microservice to Kubernetes

Throughout the book we will be using the domain of banking to create microservice examples, highlighting key concepts from each chapter.

Throughout this chapter, the example will be an Account Service. The purpose of the Account Service is to manage bank accounts, holding information like customer name, balance, and overdraft status. In developing the Account Service, the chapter will cover the ways to create Quarkus projects, developing with Live Coding for real time feedback, writing tests, building native executables for an application, how to package an application for Kubernetes, and how to deploy to Kubernetes.

There’s a lot to cover, let’s dive into creating the Account Service!

2.1 Creating a project

There are several ways to create a microservice using Quarkus:

  1. With the project generator at https://code.quarkus.io/
  2. In a terminal with the Quarkus Maven plugin
  3. Manually create the project and include the Quarkus dependencies and plugin configuration

Of the above options, option 3 is the more complicated and prone to errors, so we won’t cover this option.

Option 2 would use a command such as:

2.2 Developing with Live Coding

2.3 Writing a Test

2.4 Creating a Native executable

2.5 Running in Kubernetes

2.5.1 Generating Kubernetes YAML

2.5.2 Packaging an application

2.5.3 Deploying and running an application

2.6 Summary