万本电子书0元读

万本电子书0元读

顶部广告

Mastering Microservices with Java电子书

售       价:¥

2人正在读 | 0人评论 9.8

作       者:Sourabh Sharma

出  版  社:Packt Publishing

出版时间:2019-02-26

字       数:52.9万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Master the art of implementing scalable and reactive microservices in your production environment with Java 11 Key Features * Use domain-driven designs to build microservices * Explore various microservices design patterns such as service discovery, registration, and API Gateway * Use Kafka, Avro, and Spring Streams to implement event-based microservices Book Description Microservices are key to designing scalable, easy-to-maintain applications. This latest edition of Mastering Microservices with Java, works on Java 11. It covers a wide range of exciting new developments in the world of microservices, including microservices patterns, interprocess communication with gRPC, and service orchestration. This book will help you understand how to implement microservice-based systems from scratch. You'll start off by understanding the core concepts and framework, before focusing on the high-level design of large software projects. You'll then use Spring Security to secure microservices and test them effectively using REST Java clients and other tools. You will also gain experience of using the Netflix OSS suite, comprising the API Gateway, service discovery and registration, and Circuit Breaker. Additionally, you'll be introduced to the best patterns, practices, and common principles of microservice design that will help you to understand how to troubleshoot and debug the issues faced during development. By the end of this book, you'll have learned how to build smaller, lighter, and faster services that can be implemented easily in a production environment. What you will learn * Use domain-driven designs to develop and implement microservices * Understand how to implement microservices using Spring Boot * Explore service orchestration and distributed transactions using the Sagas * Discover interprocess communication using REpresentational State Transfer (REST) and events * Gain knowledge of how to implement and design reactive microservices * Deploy and test various microservices Who this book is for This book is designed for Java developers who are familiar with microservices architecture and now want to effectively implement microservices at an enterprise level. Basic knowledge and understanding of core microservice elements and applications is necessary.
目录展开

Title Page

Copyright and Credits

Mastering Microservices with Java Third Edition

Dedication

About Packt

Why subscribe?

Packt.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Section 1: Fundamentals

A Solution Approach

Services and SOA

Monolithic architecture overview

Limitations of monolithic architectures versus its solution with microservices architectures

Traditional monolithic design

Monolithic design with services

Microservices, nanoservices, teraservices, and serverless

One-dimension scalability

Release rollback in case of failure

Problems in adopting new technologies

Alignment with agile practices

Ease of development – could be done better

Nanoservices

Teraservices

Serverless

Deployment and maintenance

Microservices build pipeline

Deployment using a containerization engine such as Docker

Containers

Docker

Docker's architecture

Deployment

Summary

Environment Setup

Spring Boot

Adding Spring Boot to our main project

REST

Writing the REST controller class

The @RestController annotation

The @RequestMapping annotation

The @RequestParam annotation

The @PathVariable annotation

Making a sample RESTapplication executable

An embedded web server

Maven build

Running the Maven build from IDE

Maven build from the Command Prompt

Testing using Postman

Some more positive test scenarios

Negative test scenarios

Summary

Further reading

Domain-Driven Design

Domain-driven design (DDD) fundamentals

The fundamentals of DDD

Building blocks

Ubiquitous language

Multilayered architecture

Presentation layer

Application layer

Domain layer

Infrastructure layer

Artifacts of DDD

Entities

Value objects

Services

Aggregates

Repository

Factory

Modules

Strategic design and principles

Bounded context

Continuous integration

Context map

Shared kernel

Customer-supplier

Conformist

Anti-corruption layer

Separate ways

Open Host Service

Distillation

Sample domain service

Entity implementation

Repository implementation

Service implementation

Summary

Implementing a Microservice

OTRS overview

Developing and implementing microservices

Restaurant microservice

OTRS implementation

Restaurant service implementation

Controller class

API versioning

Service classes

Repository classes

Entity classes

Booking and user services

Execution

Testing

Microservice deployment using containers

Installation and configuration

Docker Machine with 4 GB of memory

Building Docker images with Maven

Running Docker using Maven

Integration testing with Docker

Managing Docker containers

Executing Docker Compose

Summary

Section 2: Microservice Patterns, Security, and UI

Microservice Patterns - Part 1

Service discovery and registration

Spring Cloud Netflix Eureka Server

Implementation

Spring Cloud Netflix Eureka client

Centralized configuration

Spring Cloud Config Server

Spring Cloud Config client

Execution and testing of the containerized OTRS app

Summary

References

Microservice Patterns - Part 2

The overall architecture

Edge server and API gateway

Implementation

Demo execution

Circuit breaker

Implementing Hystrix's fallback method

Demo execution

Centralized monitoring

Enabling monitoring

Prometheus

Architecture

Integration with api-service

Grafana

Summary

Further reading

Securing Microservices

Secure Socket Layer

Authentication and authorization

OAuth 2.0

Uses of OAuth

OAuth 2.0 specification – concise details

OAuth 2.0 roles

Resource owner

Resource server

Client

Authorization server

OAuth 2.0 client registration

Client types

Client profiles

Client identifier

Client authentication

OAuth 2.0 protocol endpoints

Authorization endpoint

Token endpoint

Redirection endpoint

OAuth 2.0 grant types

Authorization code grant

Implicit grant

Resource owner password credentials grant

Client credentials grant

OAuth implementation using Spring Security

Security microservice

API Gateway as a resource server

Authorization code grant

Using the access token to access the APIs

Implicit grant

Resource owner password credential grant

Client credentials grant

Summary

Further reading

Consuming Services Using the Angular App

Setting up a UI application

Angular framework overview

MVC and MVVM

Angular architecture

Modules (NgModules)

Components

Services and dependency injection (DI)

Routing

Directives

Guard

Developing OTRS features

The home page

src/app.module.ts (AppModule)

src/app-routing.module.ts (the routing module)

src/rest.service.ts (the REST client service)

src/auth.guard.ts (Auth Guard)

app.component.ts (the root component)

app.component.html (the root component HTML template)

Restaurants list page

src/restaurants/restaurants.component.ts (the restaurants list script)

src/restaurants/restaurants.component.html (the restaurants list HTML template)

Searching for restaurants

Login page

login.component.html (login template)

login.component.ts

Restaurant details with a reservation option

restaurant.component.ts (the restaurant details and reservation page)

restaurant.component.html (restaurant details and reservation HTML template)

Reservation confirmation

Summary

Further reading

Section 3: Inter-Process Communication

Inter-Process Communication Using REST

REST and inter-process communication

Load balanced calls and RestTemplate implementation

RestTemplate implementation

OpenFeign client implementation

Java 11 HTTPClient

Wrapping it up

Summary

Further reading

Inter-Process Communication Using gRPC

An overview of gRPC

gRPC features

REST versus gRPC

Can I call gRPC server from UI apps?

gRPC framework overview

Protocol Buffer

The gRPC-based server

Basic setup

Service interface and implementation

The gRPC server

The gRPC-based client

Summary

Further reading

Inter-Process Communication Using Events

An overview of the event-based microservice architecture

Responsive

Resilient

Elastic

Message driven

Implementing event-based microservices

Producing an event

Consuming the event

Summary

Further reading

Section 4: Common Problems and Best Practices

Transaction Management

Design Iteration

First approach

Second approach

Two-phase commit (2PC)

Voting phase

Completion phase

Implementation

Distributed sagas and compensating transaction

Feral Concurrency Control

Distributed sagas

Routing slips

Distributed saga implementation

Saga reference implementations

Compensating transaction in the booking service

Booking service changes

Billing service changes

Summary

Further reading

Service Orchestration

Choreography and orchestration

Choreography

Orchestration

Orchestration implementation with Netflix Conductor

High-level architecture

The Conductor client

Basic setup

Task definitions (blueprint of tasks)

WorkflowDef (blueprint of workflows)

The Conductor worker

Wiring input and output

Using Conductor system tasks such as DECISION

Starting workflow and providing input

Execution of sample workflow

Summary

Further reading

Troubleshooting Guide

Logging and the ELK Stack

A brief overview

Elasticsearch

Logstash

Kibana

ELK Stack setup

Installing Elasticsearch

Installing Logstash

Installing Kibana

Running the ELK Stack using Docker Compose

Pushing logs to the ELK Stack

Tips for ELK Stack implementation

Using a correlation ID for service calls

Let's see how we can tackle this problem

Using Zipkin and Sleuth for tracking

Dependencies and versions

Cyclic dependencies and their impact

Analyzing dependencies while designing the system

Maintaining different versions

Let's explore more

Summary

Further reading

Best Practices and Common Principles

Overview and mindset

Best practices and principles

Nanoservice, size, and monolithic

Continuous integration and continuous deployment (CI/CD)

System/end-to-end test automation

Self-monitoring and logging

A separate data store for each microservice

Transaction boundaries

Microservice frameworks and tools

Netflix Open Source Software (OSS)

Build – Nebula

Deployment and delivery – Spinnaker with Aminator

Service registration and discovery – Eureka

Service communication – Ribbon

Circuit breaker – Hystrix

Edge (proxy) server – Zuul

Operational monitoring – Atlas

Reliability monitoring service – Simian Army

AWS resource monitoring – Edda

On-host performance monitoring – Vector

Distributed configuration management – Archaius

Scheduler for Apache Mesos – Fenzo

Summary

Further reading

Converting a Monolithic App to a Microservice-Based App

Do you need to migrate?

Cloud versus on-premise versus both cloud and on-premise

Cloud-only solution

On-premise only solution

Both cloud and on-premise solution

Approaches and keys to successful migration

Incremental migration

Process automation and tools setup

Pilot project

Standalone user interface applications

Migrating modules to microservices

How to accommodate a new functionality during migration

Summary

Further reading

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部