Reader small image

You're reading from  Hands-On Enterprise Java Microservices with Eclipse MicroProfile

Product typeBook
Published inAug 2019
Reading LevelExpert
PublisherPackt
ISBN-139781838643102
Edition1st Edition
Languages
Right arrow
Authors (6):
Cesar Saavedra
Cesar Saavedra
author image
Cesar Saavedra

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.
Read more about Cesar Saavedra

Heiko W. Rupp
Heiko W. Rupp
author image
Heiko W. Rupp

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.
Read more about Heiko W. Rupp

Jeff Mesnil
Jeff Mesnil
author image
Jeff Mesnil

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.
Read more about Jeff Mesnil

Pavol Loffay
Pavol Loffay
author image
Pavol Loffay

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.
Read more about Pavol Loffay

Antoine Sabot-Durand
Antoine Sabot-Durand
author image
Antoine Sabot-Durand

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.
Read more about Antoine Sabot-Durand

Scott Stark
Scott Stark
author image
Scott Stark

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.
Read more about Scott Stark

View More author details
Right arrow

Assessments

Chapter 1

  1. An enterprise Java microservice has the following features:

    • It is written using the Java language.
    • It can use any Java framework.
    • It can use any Java APIs.
    • It must be enterprise-grade: reliable, available, scalable, secure, robust, and performant.
    • It must fulfill the characteristics of microservice architectures as listed at https://martinfowler.com/microservices/, which are as follows:
      • Componentization via services
      • Organized around business capabilities
      • Products not projects
      • Smart endpoints and dumb pipes
      • Decentralized governance
      • Decentralized data management
      • Infrastructure automation
      • Design for failure
      • Evolutionary design
  2. The terms digital economy and digital transformation describe the convergence of four different forces that are changing the needs of businesses: mobile, cloud, IoT, and open source.
  3. Businesses need to adapt to the new demands of the digital...

Chapter 2

  1. The main means of communication for the MicroProfile community is their Google Group, called Eclipse MicroProfile. You can post a message to it by sending an email to microprofile@googlegroups.com. Another great way to get your voice heard is by attending the bi-weekly MicroProfile Hangout call. Please check the MicroProfile Google Calendar to find out the exact date, time, and meeting information to join.
  2. The MicroProfile Hangout call serves as a forum where topics brought up by attendees are discussed and decisions are made, from sub-project statuses and release contents to release dates and sub-project creation approvals.
  1. A sub-project (MicroProfile specification) lead or a group of leads are usually subject-matter experts in the topic at hand and are designated to serve as its facilitators. One important aspect to note is that the lead or leads of a working group...

Chapter 3

  1. The default sources of configuration properties are environment variables, Java system properties, and the META-INF/microprofile-config.properties file.
  2. You can provide a custom ConfigSource implementation that maps property names to values in the custom source.
  3. Strings are not the only supported types, as MP-Config supports type conversion via a pluggable SPI, and provides several default conversions by default.
  4. You do not need to provide a value for an injected property if you have given a defaultValue, or have injected the property as an Optional<?> value.
  5. Complex property types can be handled using a custom Converter<?> implementation that takes a string and returns the complex type.
  6. When an annotation is specified at the class level, it applies to all methods of the class.
  7. False: there are currently six MP-FT policies.
  8. No: we can configure @Retry to...

Chapter 4

  1. The wire format is not usable in environments that only look at the HTTP status code to determine the HC status.
  2. An MP-HC response can include arbitrary properties using the HealthCheckResponse#withData() methods.
  3. You can create a HealthCheck implementation for each service, and the MP-HC feature will logically combine them to produce an overall status response.
  4. A JWT is a JSON Web Token, a JSON-formatted object that has a header, payload, and signature component.
  5. A claim is a single named value from the JWT payload.
  6. Anything that can be represented in JSON can be used in a JWT.
  7. The single main step in authenticating a JWT is validating that it is signed via the RS256 algorithm based on a configured public key.
  8. One could look at claims other that the groups claim to make checks to add application specific authorization decisions.
...

Chapter 5

  1. Distributed tracing provides a micro-view of what happened with a request from end to end, whereas metrics expose scalar numerical values from a single component.
  2. Distributed tracing systems usually provide features such as the root cause and critical path analysis, contextualized logging, distributed context propagation, and service dependency diagrams.
  3. Automatically traced are JAX-RS server endpoints and MicroProfile Rest clients. Some vendors can also automatically trace JAX-RS clients.
  4. These tags are added for every REST request http.method, http.status_code, http.url, component, span.kind and error if an exception is thrown.
  5. Explicit instrumentation can be added by using @Traced annotation or injecting the tracer and creating spans manually.
  6. There are three scopes: base for server metrics that apply to all runtimes, vendor for metrics that are server-specific,...

Chapter 6

  1. No: by default, any REST endpoint will have OpenAPI generated for it even if none of the MP OpenAPI annotations are used.
  2. Yes: you can choose to use as many or as few of the MP OpenAPI annotations as you wish, to represent the REST endpoints in your microservice.
  3. The notion is that you predefine the expected contracts of your endpoints and encapsulate these in OpenAPI documents that can be bundled with your microservice.
  4. No: you just need to know what the formats of the request and response are, and then you can create your own type-safe interface.
  5. By using the .../mp-rest/url MP Config setting, where ... is either the interface name of the type-safe interface or the configKey passed to the RegisterRestClient annotation.
  6. One way is to register a ClientHeadersFactory implementation. Another is to list the headers in the org.eclipse.microprofile.rest.client.propagateHeaders...

Chapter 7

  1. At the time of writing, there are eight implementations of Eclipse MicroProfile, all of which are open source. They are Thorntail, Open Liberty, Apache TomEE, Payara Micro, Hammock, KumuluzEE, Launcher, and Helidon. There is also Quarkus as the latest entrant.
  2. An application server is a container for Java EE applications. An application assembler only includes the functionality that the application needs, instead of requiring an application server to be up and running, and commonly generates an executable JAR. An application assembler can generate an uberjar, a self-contained runnable JAR file, or an application jar with its runtime dependencies located in a sub-directory, for example, an accompanying lib or libs sub-directory.
  3. Here is a short description of the current eight MicroProfile implementations on the market:
    1. Red Hat are the sponsors of the open source Thorntail...

Chapter 8

  1. We have seen many examples throughout the book and this chapter that MP-Config settings affect both application and MP features.
  2. As long as the path you supplied exists, you should be able to see a successful heath check with information about that path.
  3. It shows information about the KeyCloak server. If KeyCloak is stopped, it shows an error.
  4. It will not be found because the metric is generated lazily on first request.
  5. TBD.
  6. For unsecured methods the behavior should be similar. For secured methods, the Swagger-UI invocations fail.
  7. You will see error responses.
  8. That is the encoded MP-JWT. You can use that in a curl command as the Authorization: Bearer ... header value where you would replace the ... with the string found in the Access Base64 Token field.

Chapter 9

  1. MicroProfile Reactive Messaging is a great option for handling message sources via connectors, especially in situations where the source is generating messages at a high frequency and an asynchronous approach to processing them makes the most sense.
  2. MicroProfile Context Propagation best supports MicroProfile Reactive Streams Operators and MicroProfile Reactive Messaging in that it allows the propagation of context that was traditionally associated with the current thread across various types of units of work.
  3. The current specifications that support reactive programming are MicroProfile Reactive Streams Operators, MicroProfile Reactive Messaging, and MicroProfile Context Propagation.
  4. At the time of writing, the projects that sit outside the Eclipse MicroProfile umbrella release are as follows:
    • Reactive Streams Operators
    • Reactive Messaging
    • Long Running Actions
    • Context...

Chapter 10

  1. Eclipse MicroProfile provide one of the best approaches to develop microservices using enterprise Java. In turn, microservices developed using containers as their unit of deployment provide one of the best approaches to develop highly distributed systems in the cloud and on-premises, that is, cloud-native applications. Hence, MicroProfile-based microservices facilitate the development of cloud-native applications.
  2. There are two complementary aspects or components to cloud-native application development: application services and infrastructure services. Application services speed up the development of business logic of a cloud-native application, and infrastructure services speed up its delivery and deployment. These two aspects are complementary and integral to cloud-native application development.
  1. Cloud-native application development is an approach to building and...
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Enterprise Java Microservices with Eclipse MicroProfile
Published in: Aug 2019Publisher: PacktISBN-13: 9781838643102
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (6)

author image
Cesar Saavedra

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.
Read more about Cesar Saavedra

author image
Heiko W. Rupp

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.
Read more about Heiko W. Rupp

author image
Jeff Mesnil

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.
Read more about Jeff Mesnil

author image
Pavol Loffay

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.
Read more about Pavol Loffay

author image
Antoine Sabot-Durand

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.
Read more about Antoine Sabot-Durand

author image
Scott Stark

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.
Read more about Scott Stark