0%

Book Description

Build microservices-based enterprise applications with the latest version of Java EE

Key Features

  • Create microservices in Spring and deploy them with Docker and Mesos
  • Examine a number of real-world use cases and hands-on code examples
  • Develop distributed applications based on microservices architecture

Book Description

Cloud-based applications have been increasingly in demand, and this has caused a shift from monolithic to microservice applications. With the help of Java EE 8 Microservices, you'll get to grips with the components of Java EE 8 and understand how they are used to implement microservices. This book explains how a monolithic application is transformed into a microservice application, then helps you connect it in a traditional way and use advanced approaches for asynchronous communication. Once you have learned the basics, you'll explore advanced topics to make your microservices robust, scalable, and secure. Microservices form distributed applications, and by the end of this book you'll have discovered how to develop, pack, ship, and support distributed applications using Java EE.

What you will learn

  • Build microservices from the ground up with Java EE 8
  • Implement and deploy microservices with Spring Boot
  • Develop reactive pipelines for asynchronous communication
  • Use caching mechanisms and JSON Web Token (JWT) to create scalable and secure microservices
  • Empower microservices with the Micro Profile effort and implement health checks, fault tolerance, and monitoring mechanisms
  • Use containers to build and deploy microservices
  • Create contract-first documentation with Swagger and API Blueprint

Who this book is for

Java EE 8 Microservices is for Java EE developers keen to build microservice-based enterprise applications.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Java EE 8 Microservices
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. About the reviewer(s)
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  6. From Monoliths to Microservices
    1. What is Monolith design?
      1. The challenges associated with Monolith design
    2. Service-oriented architecture
    3. Understanding Microservices
      1. Advantages of Microservices
      2. Challenges with Microservices
    4. Summary
  7. Creating your first Microservice
    1. Setting up the Development Environment
      1. Environment installation
        1. Installing Java Development Kit
        2. Installing Apache Maven
        3. Downloading development tools
          1. cURL
          2. Postman
        4. Creating the project with Maven
    2. Your very first Microservice
      1. A Java EE Microservice
        1. Coding the Microservice
        2. Configuring the Microservice
        3. Code summary
        4. Running the Microservice
        5. Building and running the Weather Microservice
        6. Invoking the Microservice
        7. A Spring Boot Microservice
          1. Creating the project with Maven
          2. Coding a Spring Boot Microservice
          3. Building the Spring Boot Weather Microservice
          4. Running the Spring Boot Weather Microservice
    3. Summary
  8. Connecting Microservices Together
    1. Building a client
      1. Using third-party reactive frameworks
    2. Connecting two Microservices together
      1. Creating and pooling web targets
      2. Making Microservices discoverable
        1. Snoop
          1. Running Snoop and registering our service
          2. Consuming registered services
        2. Eureka
          1. Installing Eureka Server
          2. Registering the service
          3. Discovering and invoking the service
    3. Summary
  9. Asynchronous Communication for Microservices
    1. Speeding up services with the Reactive API
      1. Collecting results of multiple parallel calls
      2. Completing a REST response asynchronously
      3. Asynchronous exceptions
      4. Specifying and handling asynchronous timeouts
      5. A complete reactive REST service
      6. Simplifying the code with a third-party reactive framework
    2. Streaming responses with SSE
      1. Building an asynchronous service
      2. Invoking the SSE service
      3. Invoking the SSE service from JavaScript
      4. Building an SSE Java client
      5. Automatically reconnecting of SSE clients
    3. Two-way asynchronous services with WebSocket
      1. A quick comparison between HTTP and WebSockets
    4. Decoupling services with message-oriented middleware
      1. An example of message-oriented middleware
    5. Summary
  10. Path to Robust Microservices
    1. Building for failure
    2. Isolating the failure
      1. The bulkhead pattern
      2. Stateless services
      3. The robustness principle
    3. Handling the failure
      1. Asynchronous communication
      2. Fail fast
      3. Timeouts
      4. Circuit breakers
        1. A circuit breaker code example
      5. Fan out and fastest response
    4. Recovering from failure
    5. Preparing for failure
    6. Summary
  11. Scaling Microservices
    1. What is scalability?
    2. Microservices and scalability
    3. Stateless versus Stateful scalability
    4. Scaling on the cloud
    5. Going serverless with microservices
    6. Scaling databases with Microservices
    7. Scaling Microservices with caching
    8. Summary
  12. Securing Microservices
    1. Securing Microservices with JWT
      1. Anatomy of a JWT
      2. How does JWT work for Authentication?
    2. Java Security API – JSR 375
      1. The HTTPAuthenticationMechanism API
        1. Basic HTTP Authentication
        2. Form-based Authentication
        3. Custom form-based Authentication
      2. Identity Store
        1. Built-in and Custom IdentityStores
      3. The security context API
    3. Spring Security with Spring-Boot-based Microservices
      1. Configuring Spring Security with the In-memory realm
      2. Configuring Spring Security with the database realm
    4. HTTPS – The Secured Protocol
    5. Summary
  13. Monitoring Microservices
    1. What is monitoring and why is it required?
      1. Monitoring Microservices
    2. Understanding core concepts and terms
    3. Taking a closer look using an example
      1. Creating the example services
      2. Monitoring Microservices with Zipkin
        1. Case 1 – service is unresponsive
        2. Case 2 – service responding slowly
    4. Tools for monitoring Microservices
      1. Prometheus for monitoring and alerting
      2. Elasticsearch, Logstash, and Kibana (ELK)
      3. Considering more tools
    5. Summary
  14. Building, Packaging, and Running Microservices
    1. Introduction to Java Packaging
      1. Understanding Archives
        1. Fat packages
          1. FatWAR packaging
          2. FatJAR packaging
    2. Java EE MicroService solutions
      1. OpenLiberty
        1. The OpenLiberty Maven plugin
        2. Configuring OpenLiberty
        3. The Weather Microservice with OpenLiberty
        4. The Gradle plugin
        5. WildFly Swarm
        6. The WildFly Swarm generator
        7. The WildFly Swarm Maven plugin
        8. HollowJAR
      2. Payara Micro
        1. The Payara Micro Maven plugin
        2. The Payara Micro UberJar
    3. The Deployment Architecture for Microservices
    4. Summary
  15. Documenting and Testing MicroServices
    1. Documenting Microservices
    2. Swagger
    3. APIdoc
    4. Additional Documentation Frameworks
    5. Testing Microservices
      1. Unit testing
      2. Integration Testing
      3. Service Testing
      4. End-to-end testing
    6. Levels of Testing
    7. Summary
  16. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
18.191.189.186