Kubernetes Native Microservices with Quarkus and MicroProfile

Kubernetes Native Microservices with Quarkus and MicroProfile

Kubernetes Native Microservices with Quarkus and MicroProfile

Kubernetes Native Microservices with Quarkus and MicroProfile

eBook

$43.99 

Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

Build fast, efficient Kubernetes-based Java applications using the Quarkus framework, MicroProfile, and Java standards.

In Kubernetes Native Microservices with Quarkus and MicroProfile you’ll learn how to:

    Deploy enterprise Java applications on Kubernetes
    Develop applications using the Quarkus runtime
    Compile natively using GraalVM for blazing speed
    Create efficient microservices applications
    Take advantage of MicroProfile specifications

Popular Java frameworks like Spring were designed long before Kubernetes and the microservices revolution. Kubernetes Native Microservices with Quarkus and MicroProfile introduces next generation tools that have been cloud-native and Kubernetes-aware right from the beginning. Written by veteran Java developers John Clingan and Ken Finnigan, this book shares expert insight into Quarkus and MicroProfile directly from contributors at Red Hat. You’ll learn how to utilize these modern tools to create efficient enterprise Java applications that are easy to deploy, maintain, and expand.

About the technology
Build microservices efficiently with modern Kubernetes-first tools! Quarkus works naturally with containers and Kubernetes, radically simplifying the development and deployment of microservices. This powerful framework minimizes startup time and memory use, accelerating performance and reducing hosting cost. And because it's Java from the ground up, it integrates seamlessly with your existing JVM codebase.

About the book
Kubernetes Native Microservices with Quarkus and MicroProfile teaches you to build microservices using containers, Kubernetes, and the Quarkus framework. You'll immediately start developing a deployable application using Quarkus and the MicroProfile APIs. Then, you'll explore the startup and runtime gains Quarkus delivers out of the box and also learn how to supercharge performance by compiling natively using GraalVM. Along the way, you'll see how to integrate a Quarkus application with Spring and pick up pro tips for monitoring and managing your microservices.

What's inside

    Deploy enterprise Java applications on Kubernetes
    Develop applications using the Quarkus runtime framework
    Compile natively using GraalVM for blazing speed
    Take advantage of MicroProfile specifications

About the reader
For intermediate Java developers comfortable with Java EE, Jakarta EE, or Spring. Some experience with Docker and Kubernetes required.

About the author
John Clingan is a senior principal product manager at Red Hat, where he works on enterprise Java standards and Quarkus. Ken Finnigan is a senior principal software engineer at Workday, previously at Red Hat working on Quarkus.

Table of Contents
PART 1 INTRODUCTION
1 Introduction to Quarkus, MicroProfile, and Kubernetes
2 Your first Quarkus application
PART 2 DEVELOPING MICROSERVICES
3 Configuring microservices
4 Database access with Panache
5 Clients for consuming other microservices
6 Application health
7 Resilience strategies
8 Reactive in an imperative world
9 Developing Spring microservices with Quarkus
PART 3 OBSERVABILITY, API DEFINITION, AND SECURITY OF MICROSERVICES
10 Capturing metrics
11 Tracing microservices
12 API visualization
13 Securing a microservice

Product Details

ISBN-13: 9781638357155
Publisher: Manning
Publication date: 03/01/2022
Sold by: SIMON & SCHUSTER
Format: eBook
Pages: 328
File size: 10 MB

About the Author

Ken Finnigan is a senior principal software engineer and Eclipse MicroProfile technical architect at Red Hat. He’s the co-founder of Eclipse MicroProfile and a MicroProfile committer.

Table of Contents

Preface ix

Acknowledgments xi

About this book xii

About the authors xv

About the cover illustration xvi

Part 1 Introduction 1

1 Introduction to Quarkus, MicroProfile, and Kubernetes 3

1.1 What is a microservice? 4

The rise of microservices 6

Microservices architecture 7

The need for microservices specifications 8

1.2 MicroProfile 8

History of MicroProfile 9

MicroProfile community core principles 10

1.3 Quarkus 11

Developer joy 12

MicroProfile support 13

Runtime efficiency 13

1.4 Kubernetes 14

Introduction to Kubernetes 14

1.5 Kubernetes-native microservices 18

2 Your first Quarkus application 20

2.1 Creating a project 21

2.2 Developing with live coding 27

2.3 Writing a test 35

2.4 Creating a native executable 40

2.5 Running in Kubernetes 43

Generating Kubernetes YAML 44

Packaging an application 46

Deploying and running an application 47

Part 2 Developing microservices 51

3 Configuring microservices 53

3.1 MicroProfile Config architecture overview 54

3.2 Accessing a configuration 55

3.3 The Bank service 55

Creating the Bank service 56

Configuring the Bank service name field 57

3.4 Configuration sources 59

3.5 Configuring the mobileBanking field 62

3.6 Grouping properties with @ConfigProperties 62

3.7 Quarkus-specific configuration features 64

Quarkus configuration profiles 64

Property expressions 65

Quarkus ConfigMapping 66

Run-time vs. build-lime properties 67

3.8 Configuration on Kubernetes 69

Common Kubernetes configuration sources 69

Using a ConfigMap for Quarkus applications 70

Editing a ConfigMap 71

Kubernetes Secrets 72

4 Database access with Panache 76

4.1 Data sources 77

4.2 JPA 78

4.3 Simplifying database development 84

Active record approach 84

Data repository approach 87

Which approach to use? 89

4.4 Deployment to Kubernetes 90

Deploying PostgreSQL 90

Package and deploy 91

5 Clients for consuming other microservices 93

5.1 What is MicroProfile REST Client? 94

5.2 Service interface definition 95

CDI REST client 97

Programmatic REST client 101

Choosing between GDI and a programmatic API 103

Asynchronous response types 103

5.3 Customizing REST clients 105

Client request headers 105

Declaring providers 109

6 Application health 115

6.1 The growing role of developers in application health 116

6.2 MicroProfile Health 117

Liveness vs. readiness 118

Determining liveness and readiness status 118

6.3 Getting started with MicroProfile Health 119

Account service MicroProfile Health liveness 121

Creating an Account service liveness health check 122

Account service MicroProfile Health readiness 123

Disabling vendor readiness health checks 124

Creating a readiness health check 124

Quarkus health groups 128

Displaying the Quarkus Health UI 129

6.4 Kubernetes liveness and readiness probes 129

Customizing health check properties 131

Deploying to Kubernetes 131

Testing the readiness health check in Kubernetes 133

7 Resilience strategies 137

7.1 Resilience strategies overview 137

7.2 Executing a method under a separate thread with @Asynchronous 138

7.3 Constraining concurrency with bulkheads 138

7.4 Updating a TransactionService with a bulkhead 140

7.5 Exception handling with fallbacks 142

7.6 Defining execution timeouts 143

7.7 Recovering from temporary failure with @Retry 146

7.8 Avoiding repeated failure with circuit breakers 147

MicroProfile Fault Tolerance: @CircuitBreaker 148

How a circuit breaker works 148

Updating the TransactionService to use @CircuitBreaker 150

Testing the circuit breaker 152

7.9 Overriding annotation parameter values using properties 154

7.10 Deploying to Kubernetes 155

8 Reactive in an imperative world 158

8.1 Reactive example 159

8.2 What is Reactive Streams? 160

Publisher, Subscriber, and Processor 161

The importance of back pressure 161

8.3 Reactive Messaging in Quarkus 163

Bridging from imperative to reactive with emitters 164

What about, blocking? 167

Testing "in memory" 169

8.4 How does it work? 172

MicroProfile Reactive Messaging specification 172

Message content and metadata 173

Messages in the stream 176

8.5 Deploying to Kubernetes 177

Apache Kafka in Minikube 177

Putting it all together 179

9 Developing Spring microservices with Quarkus 183

9.1 Quarkus/Spring API compatibility overview 184

9.2 Spring dependency injection and configuration compatibility 185

Setting up the Spring Cloud Config Server 185

Using the Spring Config Server as a configuration source 186

Converting the Bank service to use Spring Configuration APIs 187

9.3 Quarkus/Spring Web API compatibility 188

9.4 Quarkus/Spring DataJPA compatibility 192

9.5 Deploying to Kubernetes 196

9.6 How Quarkus implements Spring API compatibility 197

9.7 Common Quarkus/Spring compatibility questions 197

9.8 Comparing the Spring Boot and Quarkus startup processes 198

Part 3 Observability, API definition, and security of microservices 201

10 Capturing metrics 203

10.1 The role of metrics in a microservices architecture 204

10.2 Getting started with MicroProfile Metrics 204

Graphing metrics with Prometheus and Grafana 206

MicroProfile Metrics 211

Instrumenting the Account service 216

Instrumenting the TransactionService 217

Creating business metrics 223

MicroProfile Fault Tolerance and JAX-RS integration with MicroProfile Metrics 226

Micrometer metrics 228

Simulating a busy production system 230

11 Tracing microservices 232

11.1 How does tracing work? 233

11.2 Jaeger 234

Trace sampling 235

Setting up the Minikube environment 235

Installing Jaeger 235

Microservice tracing with Jaeger 237

11.3 Tracing specifications 242

OpenTracing 242

What is MicroProfile OpenTracing? 243

OpenTelemetry 243

11.4 Customizing application tracing 244

Using @Traced 244

Injecting a tracer 245

Tracing database calls 245

Tracing Kafka messages 249

12 API visualization 257

12.1 Viewing OpenAPI documents with Swagger UI 258

Enabling OpenAPI 258

Swagger UI 261

12.2 MicroProfile OpenAPI 263

Application information 263

Customizing the schema output 265

Defining operations 266

Operation responses 267

Tagging operations 271

Filtering OpenAPI content 272

12.3 Design-first development 273

OpenAPI file base 273

Mixing the file and annotations 274

12.4 Code first or OpenAPI first? 275

13 Securing a microservice 277

13.1 Authorization and authentication overview 278

13.2 Using file-based authentication and authorization 279

13.3 Authentication and authorization with OpenID Connect 284

Introduction to OpenID Connect (OIDC) 284

OIDC and Keycloak 284

Accessing a protected resource with OpenID Connect 286

Testing the Code Authorization Flow 289

13.4 Json Web Tokens (JWT) and MicroProfile JWT 292

JWT header 292

JWT payload 293

JWT signature 295

13.5 Securing the Transaction service using MicroProfile JWT 297

13.6 Propagating the JWT 299

Secure an Account service endpoint 299

Propagating JWT from the Transaction service to the Account service 300

13.7 Running the services in Kubernetes 301

Index 303

From the B&N Reads Blog

Customer Reviews