You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.adoc
+27-13
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,15 @@
2
2
3
3
This repository represents the book code developed in the book link:https://www.manning.com/books/quarkus-in-action[Quarkus in Action] released in January 2025.
4
4
5
-
Free online e-book version - https://developers.redhat.com/e-books/quarkus-action
6
-
Printed version can be baught here - http://mng.bz/7vl7
5
+
*Free online e-book version - https://developers.redhat.com/e-books/quarkus-action*
6
+
7
+
*Printed version can be bought here - http://mng.bz/7vl7*
Folders in this repository correspond to the individual chapters in the book. The commit history contains the step by step implementations added per section of the book.
15
22
16
-
- link:chapter-02/README.adoc[Chapter 2: Your first Quarkus application]
17
-
- link:chapter-03/README.adoc[Chapter 3: Enhancing developer productivity with Quarkus]
The root link:acme-car-rental[acme-car-rental] directory contains the full Car Rental application that you start building from Chapter 4. Everything can be built from source. Feel free to experiment with this codebase as you find fit.
29
36
@@ -42,3 +49,10 @@ Jan Martiska
42
49
43
50
- X - link:https://twitter.com/janmartiska[@janmartiska]
= Quarkus in Action Chapter 02 - Your first Quarkus application
2
+
3
+
_Available in_: link:README.adoc[English]
4
+
5
+
---
6
+
7
+
In this first coding chapter, we will learn how you can start working with Quarkus. You will learn how you can generate Quarkus application in three different ways:
8
+
9
+
- Quarkus Maven plugin
10
+
- Quarkus CLI
11
+
- Quarkus generator site (code.quarkus.io)
12
+
13
+
All subsections in this directory container the same starting quarkus-in-action application that we use to explain the Quarkus project structure and how you can run Quarkus applications. You can compile all the applications to GraalVM native with the `-Pnative` flag.
14
+
15
+
[source,bash]
16
+
----
17
+
__ ____ __ _____ ___ __ ____ ______
18
+
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
19
+
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
20
+
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
21
+
2025-02-12 10:24:10,817 INFO [io.quarkus] (Quarkus Main Thread) quarkus-in-action 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.15.1) started in 1.279s. Listening on: http://localhost:8080
22
+
23
+
2025-02-12 10:24:10,819 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
24
+
2025-02-12 10:24:10,820 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, rest, smallrye-context-propagation, vertx]
= Quarkus in Action Chapter 03 - Enhancing developer productivity with Quarkus
2
+
3
+
_Available in_: link:README.adoc[English]
4
+
5
+
---
6
+
7
+
This chapter explores various different productivity enhancements included in the Quarkus's Dev mode. You can start dev mode with `./mvnw quarkus:dev` (maven) or `quarkus dev` (CLI):
8
+
9
+
[source,bash]
10
+
----
11
+
__ ____ __ _____ ___ __ ____ ______
12
+
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
13
+
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
14
+
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
15
+
2025-02-12 10:27:36,431 INFO [io.quarkus] (Quarkus Main Thread) quarkus-in-action 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.15.1) started in 1.257s. Listening on: http://localhost:8080
16
+
17
+
2025-02-12 10:27:36,433 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
18
+
2025-02-12 10:27:36,433 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, rest, smallrye-context-propagation, vertx]
19
+
----
20
+
21
+
The Dev mode is interactive, just press `h` key to see the options.
22
+
23
+
Dev UI can be opened at `http://localhost:8080/q/dev-ui` or by simply pressing `d` in the Dev mode terminal.
24
+
25
+
Continuous testing can be started by pressing `r` in the Dev mode terminal.
= Quarkus in Action Chapter 06 - Exposing and securing web applications
2
+
3
+
_Available in_: link:README.adoc[English]
4
+
5
+
---
6
+
7
+
This chapter moves to the front end side of development. We create our next car rental service call the Users service in link:6_1[6.1 Creating a secured web application] section. You will also learn how to use a Keycloak instance (automatically started and managed through Dev Services) to authenticate your users with very little configuration. Lastly, you will also deploy a very simple production version of Keycloak using containers (Docker or Podman) in link:production[6.4.1 Running Keycloak and PostgreSQL as container] and learn how to set up your applications (Users service and Reservation service) to connect to it in link:6_4_2[6.4.2 Wiring the services to use Keycloak].
8
+
9
+
The final version of the application after this chapter looks like this:
Right after the frontend part, we jump straight to the other side -- databases. Quarkus provides a plethora of different options for databases ranging from direct JDBC and traditional JPA (Hibernate ORM) to newly defined Panache library that also comes from the very same Hibernate team and greatly simplifies the ORM development in Quarkus. Which is also why we focus on it in this chapter. You will learn about two different approaches -- active record pattern and the repository pattern. We will also look into the REST data extensions that allow us to generate REST CRUD resources for our entities. Next, we move to the NoSQL world and guess what? We will still use the same Panache API also there! Lastly, we will take a step in to the reactive world and show you how you access your databases in nonblocking way with Hibernate Reactive and its integration with Panache in Quarkus.
8
+
9
+
After we finish this chapter we will have the following databases setup in the respective services:
10
+
11
+
- PostgreSQL in the Reservation service (link:7_1_2[7.1.2 Getting started with Panache])
12
+
- MySQL in the Inventory service (link:7_2_1[7.2.1 Utilizing repository pattern with MySQL])
13
+
- MongoDB in the Rental service (link:7_6_1[7.6.1 Utilizing MongoDB with Panache])
14
+
- PostgreSQL with Hibernate Reactive in the Reservation service (link:7_7_1[7.7.1 Using Hibernate Reactive with Panache])
= Quarkus in Action Chapter 08 - Reactive programming
2
+
3
+
_Available in_: link:README.adoc[English]
4
+
5
+
---
6
+
7
+
The were a few places in the book so far where the learning journey took us into the reactive world. Especially, the last section in the previous chapter. Now is the time to embrace reactive programming and learn what it can bring into your applications. You will learn about the Mutiny library and its very simple API that we can utilize almost everywhere in Quarkus (link:8_2_2/mutiny-example[8.2.2 Mutiny API]). We will also look into whether you might need it or not. Reactive programming is of course a very discutable and opinionated topic, so no one is forced to use it. Since project Loom (virtual threads) became a finalized feature in JDK 21, you don't even have to learn reactive programming to get similar performance characteristics. However, there are still some problem with project Loom that we describe in link:8_5_1/loom-example[8.5.1 Project Loom in Quarkus]. The final choice of whether to use the reactive programming or project Loom or neither is however not restricted in any way. In Quarkus, you can mix and match all paradigms as you see fit. Even in the same class.
8
+
9
+
10
+
This chapter prepares us for the inclusion of asynchronous massage passing in our Acme Car Rental application in the next chapter.
= Quarkus in Action Chapter 09 - Quarkus messaging
2
+
3
+
_Available in_: link:README.adoc[English]
4
+
5
+
---
6
+
7
+
Scaling of synchronous communication protocols that we learned about in chapter 4 is restricted by the unreliable nature of networks (link:https://en.wikipedia.org/wiki/CAP_theorem[CAP theorem]). Which is why Quarkus provides you with a very simple integration of different messaging protocols based on the asynchronous message passing jointly called Quarkus messaging. Even if the integration is based on the MicroProfile Reactive Messaging specification (link:9_3_2/reactive-messaging-example[9.3.2 Reactive messaging API]) and its SmallRye Reactive Messaging implementation we use in Quarkus, users are not required to write reactive code to utilize asynchronous messaging. In this chapter, we will learn how to integrate our car rental services using two messaging providers -- Apache Kafka (link:9_6_1[9.6.1 Kafka integration in the Rental service]) and RabbitMQ (link:9_7[9.7 Quarkus messaging with RabbitMQ]). We will also create our final and purely reactive car rental service, the Billing service in link:9_8[9.8 Car Rental Billing service] that integrates both providers in a single service. You will see how Quarkus make all this development extremely easy with Dev Services that automatically share all providers between the relevant services.
8
+
9
+
After this chapter, we will have the following architecture:
= Quarkus in Action Chapter 10 - Cloud-native application patterns
2
+
3
+
_Available in_: link:README.adoc[English]
4
+
5
+
---
6
+
7
+
After the previous chapter we have all communication covered but if we are about to deploy our services to cloud platforms (Kubernetes or OpenShift), we should also prepare them for the various scenarios that they can hit there. These are jointly covered by a set of MicroProfile specifications. In this chapter, we will go over the main specifications and their SmallRye implementation used in Quarkus, to demonstrate how you can easily extend your services to provide for instance health checks (link:10_2_1[10.2.1 Monitoring the health of Car Rental]), metrics (link:10_3_6[10.3.6 Monitoring metrics of Car Rental]), observability (link:10_4_2[10.4.2 Adding tracing capabilities to Car Rental]), or fault tolerance of synchronous communication (link:10_5_1[10.5.1 Adding Fault Tolerance to Car Rental]). We will focus our development on the Inventory service but all of the demonstrated patterns can be applied to any of the other services too.
= Quarkus in Action Chapter 11 - Quarkus applications in the cloud
2
+
3
+
_Available in_: link:README.adoc[English]
4
+
5
+
---
6
+
7
+
The time has come to put everything we developed so far together and deploy it in the production environment which in our case is the link:https://developers.redhat.com/developer-sandbox[Red Hat Openshift Sandbox]. Individual sections will take us gradually the full OpenShift deployment of Acme Car Rental in several steps:
8
+
9
+
1. Local development version with Dev Services (what we used so far) -- link:11_1[11.1 Car Rental production]
10
+
2. Local production version with externalized providers -- link:11_1_1[11.1.1 Externalizing providers for independent deployment]
11
+
3. Production version with deployed Docker/Podman images -- link:11_2_4[11.2.4 Pushing Car rental images to quay.io]
12
+
4. Deploying single Quarkus application on Kubernetes -- link:11_3_3[11.3.3 Deploying Quarkus applications on Kubernetes]
13
+
5. Deploying single Quarkus application on OpenShift -- link:11_3_4[11.3.4 Deploying Quarkus applications on OpenShift]
14
+
6. Example of serverless deployment with Knative -- link:11_5_3[11.5.3 Car statistics application with Knative]
15
+
7. Full Acme Car Rental deployment in OpenShift Sandbox -- link:11_6_3[11.6.3 Car rental services deployment with OpenShift Sandbox]
16
+
17
+
And after step 7, you will see a full Acme Car Rental in your OpenShift Sandbox instance!
= Quarkus in Action Chapter 12 - Custom Quarkus extensions
2
+
3
+
_Available in_: link:README.adoc[English]
4
+
5
+
---
6
+
7
+
The last chapter of this book focuses on the extension development. This is not and easy task, but it nicely puts the concepts explained in the book into perspective since you will be able to directly see how the individual pieces of Quarkus's magic set in place. We will develop a small informative extension called "metadata" that outputs some metadata about your Quarkus application. We will how you bootstrap an extension project in link:12_3_1[12.3.1 Creating the project]. Then we explore various pieces of extension development like addition of custom configuration (link:12_3_2[12.3.2 Extending the configuration model]), exposing HTTP interface (link:12_3_3[12.3.3 Creating the HTTP handler]), or creating a recorder object that records the bytecode that can be replayed during runtime (link:12_3_4[12.3.4 Creating the recorder]). Later, we put everything together in the processor class (link:12_3_5[12.3.5 Creating the processor]). For completeness, we finish Quarkus in Action with a few tests for our newly created extension.
8
+
9
+
Congratulations! You've got to the end of the book. Hopefully, you found the presented content valuable and helpful. Thank you for reading our book!
0 commit comments