Mastering Microservices with Java - Third Edition

Book description

None

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Mastering Microservices with Java Third Edition
  3. Dedication
  4. About Packt
    1. Why subscribe?
    2. Packt.com
  5. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  6. 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. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  7. Section 1: Fundamentals
  8. A Solution Approach
    1. Services and SOA
      1. Monolithic architecture overview
      2. Limitations of monolithic architectures versus its solution with microservices architectures
        1. Traditional monolithic design
        2. Monolithic design with services
    2. Microservices, nanoservices, teraservices, and serverless
      1. One-dimension scalability
      2. Release rollback in case of failure
      3. Problems in adopting new technologies
      4. Alignment with agile practices
      5. Ease of development – could be done better
      6. Nanoservices
      7. Teraservices
      8. Serverless
    3. Deployment and maintenance
      1. Microservices build pipeline
      2. Deployment using a containerization engine such as Docker
        1. Containers
        2. Docker
          1. Docker's architecture
    4. Deployment
    5. Summary
  9. Environment Setup
    1. Spring Boot
      1. Adding Spring Boot to our main project
    2. REST
      1. Writing the REST controller class
        1. The @RestController annotation
        2. The @RequestMapping annotation
        3. The @RequestParam annotation
        4. The @PathVariable annotation
      2. Making a sample RESTapplication executable
    3. An embedded web server
    4. Maven build
      1. Running the Maven build from IDE
      2. Maven build from the Command Prompt
    5. Testing using Postman
      1. Some more positive test scenarios
      2. Negative test scenarios
    6. Summary
    7. Further reading
  10. Domain-Driven Design
    1. Domain-driven design (DDD) fundamentals
    2. The fundamentals of DDD
      1. Building blocks
        1. Ubiquitous language
        2. Multilayered architecture
          1. Presentation layer
          2. Application layer
          3. Domain layer
          4. Infrastructure layer
        3. Artifacts of DDD
          1. Entities
          2. Value objects
          3. Services
          4. Aggregates
          5. Repository
          6. Factory
          7. Modules
      2. Strategic design and principles
        1. Bounded context
        2. Continuous integration
        3. Context map
          1. Shared kernel
          2. Customer-supplier
          3. Conformist
          4. Anti-corruption layer
          5. Separate ways
          6. Open Host Service
          7. Distillation
    3. Sample domain service
      1. Entity implementation
      2. Repository implementation
      3. Service implementation
    4. Summary
  11. Implementing a Microservice
    1. OTRS overview
    2. Developing and implementing microservices
      1. Restaurant microservice
      2. OTRS implementation
      3. Restaurant service implementation
        1. Controller class
          1. API versioning
        2. Service classes
        3. Repository classes
        4. Entity classes
      4. Booking and user services
      5. Execution
    3. Testing
    4. Microservice deployment using containers
      1. Installation and configuration
        1. Docker Machine with 4 GB of memory
        2. Building Docker images with Maven
        3. Running Docker using Maven
        4. Integration testing with Docker
        5. Managing Docker containers
        6. Executing Docker Compose
    5. Summary
  12. Section 2: Microservice Patterns, Security, and UI
  13. Microservice Patterns - Part 1
    1. Service discovery and registration
      1. Spring Cloud Netflix Eureka Server
        1. Implementation
      2. Spring Cloud Netflix Eureka client
    2. Centralized configuration
      1. Spring Cloud Config Server
      2. Spring Cloud Config client
    3. Execution and testing of the containerized OTRS app
    4. Summary
    5. References
  14. Microservice Patterns - Part 2
    1. The overall architecture
    2. Edge server and API gateway
      1. Implementation
      2. Demo execution
    3. Circuit breaker
      1. Implementing Hystrix's fallback method
      2. Demo execution
    4. Centralized monitoring
      1. Enabling monitoring
      2. Prometheus
        1. Architecture
        2. Integration with api-service
      3. Grafana
    5. Summary
    6. Further reading
  15. Securing Microservices
    1. Secure Socket Layer
    2. Authentication and authorization
      1. OAuth 2.0
        1. Uses of OAuth
      2. OAuth 2.0 specification – concise details
        1. OAuth 2.0 roles
          1. Resource owner
          2. Resource server
          3. Client
          4. Authorization server
        2. OAuth 2.0 client registration
          1. Client types
          2. Client profiles
          3. Client identifier
          4. Client authentication
        3. OAuth 2.0 protocol endpoints
          1. Authorization endpoint
          2. Token endpoint
          3. Redirection endpoint
        4. OAuth 2.0 grant types
          1. Authorization code grant
          2. Implicit grant
          3. Resource owner password credentials grant
          4. Client credentials grant
    3. OAuth implementation using Spring Security
      1. Security microservice
      2. API Gateway as a resource server
      3. Authorization code grant
      4. Using the access token to access the APIs
      5. Implicit grant
      6. Resource owner password credential grant
      7. Client credentials grant
    4. Summary
    5. Further reading
  16. Consuming Services Using the Angular App
    1. Setting up a UI application
    2. Angular framework overview
      1. MVC and MVVM
      2. Angular architecture
        1. Modules (NgModules)
        2. Components
        3. Services and dependency injection (DI)
        4. Routing
        5. Directives
        6. Guard
    3. Developing OTRS features
      1. The home page
        1. src/app.module.ts (AppModule)
        2. src/app-routing.module.ts (the routing module)
        3. src/rest.service.ts (the REST client service)
        4. src/auth.guard.ts (Auth Guard)
        5. app.component.ts (the root component)
        6. app.component.html (the root component HTML template)
      2. Restaurants list page
        1. src/restaurants/restaurants.component.ts (the restaurants list script)
        2. src/restaurants/restaurants.component.html (the restaurants list HTML template)
        3. Searching for restaurants
      3. Login page
        1. login.component.html (login template)
        2. login.component.ts
      4. Restaurant details with a reservation option
        1. restaurant.component.ts (the restaurant details and reservation page)
        2. restaurant.component.html (restaurant details and reservation HTML template)
      5. Reservation confirmation
    4. Summary
    5. Further reading
  17. Section 3: Inter-Process Communication
  18. Inter-Process Communication Using REST
    1. REST and inter-process communication
    2. Load balanced calls and RestTemplate implementation
      1. RestTemplate implementation
    3. OpenFeign client implementation
    4. Java 11 HTTPClient
    5. Wrapping it up
    6. Summary
    7. Further reading
  19. Inter-Process Communication Using gRPC
    1. An overview of gRPC
      1. gRPC features
      2. REST versus gRPC
      3. Can I call gRPC server from UI apps?
      4. gRPC framework overview
        1. Protocol Buffer
    2. The gRPC-based server
      1. Basic setup
      2. Service interface and implementation
      3. The gRPC server
    3. The gRPC-based client
    4. Summary
    5. Further reading
  20. Inter-Process Communication Using Events
    1. An overview of the event-based microservice architecture
      1. Responsive
      2. Resilient
      3. Elastic
      4. Message driven
    2. Implementing event-based microservices
      1. Producing an event
      2. Consuming the event
    3. Summary
    4. Further reading
  21. Section 4: Common Problems and Best Practices
  22. Transaction Management
    1. Design Iteration
      1. First approach
      2. Second approach
    2. Two-phase commit (2PC)
      1. Voting phase
      2. Completion phase
      3. Implementation
    3. Distributed sagas and compensating transaction
      1. Feral Concurrency Control
      2. Distributed sagas
      3. Routing slips
    4. Distributed saga implementation
      1. Saga reference implementations
      2. Compensating transaction in the booking service
        1. Booking service changes
        2. Billing service changes
    5. Summary
    6. Further reading
  23. Service Orchestration
    1. Choreography and orchestration
      1. Choreography
      2. Orchestration
    2. Orchestration implementation with Netflix Conductor
      1. High-level architecture
      2. The Conductor client
        1. Basic setup
        2. Task definitions (blueprint of tasks)
        3. WorkflowDef (blueprint of workflows)
        4. The Conductor worker
        5. Wiring input and output
        6. Using Conductor system tasks such as DECISION
        7. Starting workflow and providing input
        8. Execution of sample workflow
    3. Summary
    4. Further reading
  24. Troubleshooting Guide
    1. Logging and the ELK Stack
      1. A brief overview
        1. Elasticsearch
        2. Logstash
        3. Kibana
      2. ELK Stack setup
        1. Installing Elasticsearch
        2. Installing Logstash
        3. Installing Kibana
          1. Running the ELK Stack using Docker Compose
          2. Pushing logs to the ELK Stack
          3. Tips for ELK Stack implementation
    2. Using a correlation ID for service calls
      1. Let's see how we can tackle this problem
        1. Using Zipkin and Sleuth for tracking
    3. Dependencies and versions
      1. Cyclic dependencies and their impact
        1. Analyzing dependencies while designing the system
      2. Maintaining different versions
      3. Let's explore more
    4. Summary
    5. Further reading
  25. Best Practices and Common Principles
    1. Overview and mindset
    2. Best practices and principles
      1. Nanoservice, size, and monolithic
      2. Continuous integration and continuous deployment (CI/CD)
      3. System/end-to-end test automation
      4. Self-monitoring and logging
      5. A separate data store for each microservice
      6. Transaction boundaries
    3. Microservice frameworks and tools
      1. Netflix Open Source Software (OSS)
        1. Build – Nebula
        2. Deployment and delivery – Spinnaker with Aminator
        3. Service registration and discovery – Eureka
        4. Service communication – Ribbon
        5. Circuit breaker – Hystrix
        6. Edge (proxy) server – Zuul
        7. Operational monitoring – Atlas
        8. Reliability monitoring service – Simian Army
        9. AWS resource monitoring – Edda
        10. On-host performance monitoring – Vector
        11. Distributed configuration management – Archaius
        12. Scheduler for Apache Mesos – Fenzo
    4. Summary
    5. Further reading
  26. Converting a Monolithic App to a Microservice-Based App
    1. Do you need to migrate?
      1. Cloud versus on-premise versus both cloud and on-premise
        1. Cloud-only solution
        2. On-premise only solution
        3. Both cloud and on-premise solution
    2. Approaches and keys to successful migration
      1. Incremental migration
      2. Process automation and tools setup
      3. Pilot project
      4. Standalone user interface applications
      5. Migrating modules to microservices
      6. How to accommodate a new functionality during migration
    3. Summary
    4. Further reading
  27. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Mastering Microservices with Java - Third Edition
  • Author(s):
  • Release date:
  • Publisher(s): Packt Publishing
  • ISBN: None