An effective guide to designing, building, and deploying enterprise Java microservices with Eclipse MicroProfile
Key Features
Create cloud-native microservices with ease using this detailed guide
Avoid vendor lock-in when implementing microservices using Eclipse MicroProfile
Discover why MicroProfile is a great specification for building microservices in multi-cloud environments
Book Description
Eclipse MicroProfile has gained momentum in the industry as a multi-vendor, interoperable, community-driven specification. It is a major disruptor that allows organizations with large investments in enterprise Java to move to microservices without spending a lot on retraining their workforce.
This book is based on MicroProfile 2.2, however, it will guide you in running your applications in MicroProfile 3.0. You'll start by understanding why microservices are important in the digital economy and how MicroProfile addresses the need for enterprise Java microservices. You'll learn about the subprojects that make up a MicroProfile, its value proposition to organizations and developers, and its processes and governance. As you advance, the book takes you through the capabilities and code examples of MicroProfile's subprojects - Config, Fault Tolerance, Health Check, JWT Propagation, Metrics, and OpenTracing. Finally, you'll be guided in developing a conference application using Eclipse MicroProfile, and explore possible scenarios of what's next in MicroProfile with Jakarta EE.
By the end of this book, you'll have gained a clear understanding of Eclipse MicroProfile and its role in enterprise Java microservices.
What you will learn
Understand why microservices are important in the digital economy
Analyze how MicroProfile addresses the need for enterprise Java microservices
Test and secure your applications with Eclipse MicroProfile
Get to grips with various MicroProfile capabilities such as OpenAPI and Typesafe REST Client
Explore reactive programming with MicroProfile Stream and Messaging candidate APIs
Discover and implement coding best practices using MicroProfile
Who this book is for
If you're a Java developer who wants to create enterprise microservices, this book is for you. Familiarity with Java EE and the concept of microservices will help you get the most out of this book.
Table of Contents
Introduction to Eclipse Microprofile
Governance and Contributions
MicroProfile Config and Fault Tolerance APIs/capabilities
MicroProfile Health Check and JWT Propagation
MicroProfile Metrics and Open Tracing APIs/capabilities
MicroProfile OpenAPI and Typesafe REST Client
Implementing and Developing Conference Application through Eclipse MicroProfile
A Working Eclipse MicroProfile Code Sample
Reactive Programming and Future Developments
MicroProfile in Multi-cloud Environments
About the Author
Cesar Saavedra has been working in the IT industry since 1990 and holds a Master of Science degree in Computer Science and a Master of Business Administration. He has worked as a developer, consultant, technical seller, and technical marketer throughout his career. He currently does technical product marketing for Red Hat JBoss Enterprise Application Platform (EAP), Eclipse MicroProfile, OpenJDK, Quarkus and Jakarta EE. He also manages the technical marketing for the runtimes, integration, BPM and rules management portfolio, and works closely with engineering and product management on thought leadership. Cesar has authored white papers, eBooks, and blogposts, and has been a conference and webinar speaker presenting to customers and partners.
Heiko W. Rupp is an open source enthusiast working for more than a decade at Red Hat in the area of middleware monitoring and management. In this role he has been project lead of the RHQ and Hawkular monitoring systems and has also been contributing to various other projects like Kiali.
Currently he helps defining the next way of Java Microservices with his work on Eclipse MicroProfile. As such he is the spec lead of the Eclipse MicroProfile Metrics effort and also contributing to other specifications. Heiko has written the first German book about JBossAS and one of the first German books on EJB3. He lives with his family in Stuttgart, Germany.
Jeff Mesnil is employed by Red Hat as a Senior Software Engineer and currently, works for JBoss, Red Hat's middleware division, on the WildFly and JBoss EAP application servers. He is a member of the core team in charge of developing the internals of the application servers and lead its messaging subsystem (which provides the JMS API).
Previously, he contributed to the HornetQ messaging broker that was integrated into WildFly and EAP.
He is a proponent of Open Source development and all the code he writes either professionally or privately is available under Open Source licenses, these days, it is mostly hosted on GitHub.
He has a keen interest on messaging systems and wrote several Open Source libraries related to messaging.
Pavol Loffay is Senior Software Engineer at Red Hat. Pavol is working on observability tools for microservice architectures. He is mostly involved in the tracing domain, where he is an active committer on the Jaeger and OpenTracing projects. He is also a member of the OpenTracing Specification Council (OTSC) and a lead for the MicroProfile-OpenTracing specification. He has authored many blog posts and presented at several conferences. In his free time, Pavol likes to climb mountains and ski steep slopes in the Alps.
Antoine Sabot-Durand is a Java Champion who works for Red Hat where he leads the Java EE, now Jakarta EE CDI spec. He is also involved in various projects linked to the CDI ecosystem, MicroProfile, and Jakarta EE. He is also Member of Devoxx France committee. He lives in France with his wife and 3 kids.
Scott Stark started in chemical engineering, got steered into parallel computers as part of his Ph.D. work, and then made software his career, starting with a stint in finance/wall street. He then got into open source with the fledgling JBoss company, working on the application server and Java EE. He has worked with microkernel efforts, IoT efforts, standards, Jakarta EE, Eclipse MicroProfile and Quarkus. He lives in the Pacific Northwest with his wife.
Author(s): Cesar Saavedra, Heiko W. Rupp et al.
Edition: 1
Publisher: Apress
Year: 2020
Language: English
Pages: 244
Tags: java eclipse microservices
Cover......Page 1
Title Page......Page 2
Copyright and Credits......Page 3
About Packt......Page 4
Contributors......Page 5
Table of Contents......Page 8
Preface......Page 13
Section 1: MicroProfile in the Digital Economy......Page 18
Enterprise Java microservices......Page 19
Forces that fuel the digital economy......Page 21
Multi-speed IT......Page 22
Introducing Eclipse MicroProfile......Page 23
MicroProfile value proposition......Page 28
Summary......Page 29
Questions......Page 30
Current Eclipse MicroProfile governance......Page 31
Sandbox approach to open contribution......Page 34
Umbrella releases versus projects outside the umbrella......Page 35
A quick tour of MicroProfile Starter......Page 36
Summary......Page 43
Questions......Page 44
Section 2: MicroProfile's Current Capabilities......Page 45
Understanding Eclipse MicroProfile Config......Page 46
Reading configuration from the MicroProfile Config API......Page 47
The Config object......Page 48
The @ConfigProperty annotation......Page 49
Default ConfigSources......Page 50
Custom ConfigSources implementations......Page 51
Using converters for high-level configuration......Page 52
Automatic converters......Page 53
Custom converters......Page 54
Understanding Eclipse MicroProfile Fault Tolerance......Page 55
MicroProfile Fault Tolerance in action......Page 56
The @Retry policy......Page 57
The @Fallback policy......Page 58
The @Bulkhead policy......Page 59
Tolerance with MicroProfile config......Page 60
Questions......Page 61
Further reading......Page 62
Chapter 4: MicroProfile Health Check and JWT Propagation......Page 63
Understanding health checks and how MicroProfile handles them......Page 64
The Health Check protocol and wire format......Page 65
The Health Check Java API......Page 66
Human operators......Page 70
Using JSON Web Token Propagation in MicroProfile......Page 71
Recommendations for interoperability......Page 72
Required MP-JWT claims......Page 73
The high-level description of the MP-JWT API......Page 74
Sample code that uses MP-JWT......Page 76
Injection of JsonWebToken information......Page 77
Injection of JWT claim values......Page 78
Configuring authentication of JWTs......Page 80
Running the samples......Page 81
Summary......Page 87
Questions......Page 88
MicroProfile Metrics......Page 89
Metadata......Page 90
Retrieving metrics from the server......Page 91
Supplying application-specific metrics......Page 93
Gauges......Page 94
Histograms......Page 95
Server-wide tags......Page 96
Using Prometheus to retrieve metrics......Page 97
New in MP-Metrics 2.0......Page 99
Tagging......Page 100
MicroProfile OpenTracing......Page 101
OpenTracing project......Page 102
Configuration properties......Page 103
JAX-RS......Page 104
Explicit instrumentation......Page 105
Tracer injection......Page 106
Tracing with Jaeger......Page 107
Questions......Page 110
Introduction to MicroProfile OpenAPI and its capabilities......Page 111
Configuration......Page 112
Generating the OpenAPI document......Page 113
Usage examples......Page 114
Static OpenAPI files......Page 116
Using a filter for updates......Page 118
Introduction to the MicroProfile REST Client and its capabilities......Page 119
Defining the endpoint Interface......Page 120
MicroProfile REST Client programmatic API usage......Page 121
MicroProfile REST Client CDI usage......Page 122
MicroProfile Config integration......Page 123
Simplifying configuration keys......Page 124
Dealing with client headers......Page 125
Provider registration for advanced usage......Page 126
Feature registration......Page 127
Exception mapping......Page 128
Default exception mapping......Page 129
Async support......Page 130
Summary......Page 131
Questions......Page 132
Section 3: MicroProfile Implementations and Roadmap......Page 133
Chapter 7: MicroProfile Implementations, Quarkus, and Interoperability via the Conference Application......Page 134
Current MicroProfile implementations......Page 135
Thorntail......Page 136
Open Liberty......Page 138
Payara Micro......Page 139
Hammock......Page 140
KumuluzEE......Page 141
Helidon......Page 142
Generating sample code for the current implementations......Page 143
Quarkus......Page 144
How to quark a generated MicroProfile project......Page 146
MicroProfile interoperability – the conference application......Page 151
Summary......Page 153
Questions......Page 154
Section 4: A Working MicroProfile Example......Page 155
Technical requirements......Page 156
Sample architecture of a multiservice MicroProfile application......Page 157
The Docker shell commands......Page 158
The Svcs2 shell command......Page 160
The Config tab......Page 161
The Health tab......Page 163
The Metrics tab......Page 165
The OpenTracing tab......Page 167
The OpenAPI tab......Page 170
The KeyCloak tab......Page 174
The JWT tab......Page 177
The RestClient tab......Page 179
Questions......Page 184
Further reading......Page 185
Section 5: A Peek into the Future......Page 186
Chapter 9: Reactive Programming and Future Developments......Page 187
An overview of Reactive Messaging......Page 188
MicroProfile reactive messaging architecture......Page 189
Message shapes......Page 190
MicroProfile reactive messaging examples......Page 193
Projects outside the umbrella......Page 198
Long Running Actions......Page 199
Context Propagation......Page 200
Differences between GraphQL and REST......Page 202
MicroProfile Boost......Page 203
Eclipse MicroProfile and Jakarta EE......Page 204
Summary......Page 205
Further reading......Page 206
Chapter 10: Using MicroProfile in Multi-Cloud Environments......Page 207
Microservices versus cloud native versus container native......Page 208
What about 12-factor applications?......Page 210
What about serverless and FaaS?......Page 211
Cloud-native application development......Page 212
Developing and running MicroProfile applications across clouds......Page 215
Considerations when using MicroProfile in a hybrid cloud deployment......Page 216
Challenges when using MicroProfile OpenTracing in a multi-cloud deployment......Page 217
Fallback......Page 218
Conclusion......Page 219
Summary......Page 220
Questions......Page 221
Chapter 1......Page 222
Chapter 2......Page 224
Chapter 3......Page 226
Chapter 5......Page 227
Chapter 7......Page 228
Chapter 9......Page 231
Chapter 10......Page 232
Other Books You May Enjoy......Page 237
Index......Page 240