Book Image

Mastering Spring Cloud

By : Piotr Mińkowski
Book Image

Mastering Spring Cloud

By: Piotr Mińkowski

Overview of this book

Developing, deploying, and operating cloud applications should be as easy as local applications. This should be the governing principle behind any cloud platform, library, or tool. Spring Cloud–an open-source library–makes it easy to develop JVM applications for the cloud. In this book, you will be introduced to Spring Cloud and will master its features from the application developer's point of view. This book begins by introducing you to microservices for Spring and the available feature set in Spring Cloud. You will learn to configure the Spring Cloud server and run the Eureka server to enable service registration and discovery. Then you will learn about techniques related to load balancing and circuit breaking and utilize all features of the Feign client. The book now delves into advanced topics where you will learn to implement distributed tracing solutions for Spring Cloud and build message-driven microservice architectures. Before running an application on Docker container s, you will master testing and securing techniques with Spring Cloud.
Table of Contents (22 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Index

A

  • Advanced Message Queueing Protocol (AMQP) / Consuming events from a message broker
  • advanced programming model
    • about / The advanced programming model
    • pending messages / Producing messages
    • transformation / Transformation
    • message consumption / Consuming messages conditionally
  • Apache Kafka
    • using / Using Apache Kafka
    • executing / Running Kafka
    • application settings, customizing / Customizing application settings
    • Streams API support / Kafka Streams API support
    • configuration properties / Configuration properties
  • application
    • integrating, with database / Integrating application with database
    • building / Building a sample application
    • executing / Running the application
  • application deployment, PCF
    • about / Deploying the application
    • CLI, using / Using CLI
    • services, binding to / Binding to services
    • Maven plugin, using / Using the Maven plugin
  • application development, with Spring Boot
    • about / Developing applications with Spring Boot
    • configuration files, customizing / Customizing configuration files
    • RESTful Web Services, creating / Creating RESTful Web Services
  • application integration, with ELK Stack
    • LogstashTCPAppender, using / Using LogstashTCPAppender
    • AMQP appender, using / Using AMQP appender and a message broker
    • message broker, using / Using AMQP appender and a message broker
  • automatic configuration reload
    • about / Reload configuration automatically
    • solution architecture / Solution architecture
    • @RefreshScope, using / Reload configuration with @RefreshScope
    • events, consuming from message broker / Consuming events from a message broker
    • repository changes, monitoring on Config Server / Monitoring repository changes on a Config Server

B

  • binder / Multiple binders
  • binding properties
    • consumer / The consumer
    • producer / The producer
  • BOM (bill of materials) / Release trains

C

  • circuit breaker pattern
    • about / Failures and circuit breakers
    • using, with Hystrix / The circuit breaker pattern with Hystrix
    • tripping circuit breaker / The tripping circuit breaker
    • using, with Feign / Failures and the circuit breaker pattern with Feign
  • client / Load balancing with Ribbon
  • client-side application
    • building / Building a client-side application
    • Eureka Server, adding / Adding a Eureka Server
  • client-side bootstrap approaches
    • about / Client-side bootstrap approaches
    • Config Server discovery / Config Server discovery
  • cloud-native development / Cloud-native development
  • cloud platform support / Cloud platform support
  • communication
    • styles / Different styles of communication 
    • synchronous communication, with Spring Cloud / Synchronous communication with Spring Cloud
  • component tests
    • about / Testing strategies, Component tests
    • running, with in-memory database / Running tests with an in-memory database
    • HTTP clients and service discovery, handling / Handling HTTP clients and service discovery
    • sample test, implementing / Implementing sample tests
  • config branch
    • reference / Native profile support
  • Config First Bootstrap / Client-side bootstrap approaches
  • Config Server discovery
    • reference / Config Server discovery
  • configuration options, Spring Cloud Stream
    • about / Configuration options
    • properties / Spring Cloud Stream properties
    • binding properties / Binding properties
  • configuration settings, Eureka
    • client / Advanced configuration settings
    • server / Advanced configuration settings
    • instance / Advanced configuration settings
  • config_vault branch
    • reference / Integration with Spring Cloud Config
  • Continuous Delivery (CD)
    • about / Continuous Delivery
    • Jenkins, integrating with Docker / Integrating Jenkins with Docker
    • pipelines, building / Building pipelines
  • Continuous Integration (CI) / Continuous Delivery
  • contract tests
    • about / Testing strategies, Contract tests
    • Pact, using / Using Pact
    • Spring Cloud Contract, using / Using Spring Cloud Contract
  • correlation IT / Spring Cloud Sleuth

D

  • deployment methods, Heroku
    • CLI, using / Using the CLI
    • GitHub repository, connecting to / Connecting to the GitHub repository
    • Docker Container Registry / Docker Container Registry
  • developer tools / Developer tools
  • discovery branch
    • reference / Building a server application
  • Discovery First Bootstrap / Client-side bootstrap approaches
  • distributed configuration, Spring Cloud Consul
    • distributed configuration / Distributed configuration
    • properties, managing / Managing properties in Consul
    • client customization / Client customization
    • configuration changes, viewing / Watching configuration changes
  • distributed tracing
    • with Sleuth / Distributed tracing with Sleuth
  • Docker
    • about / Introducing Docker
    • installing / Installing Docker
  • Docker commands
    • using / Commonly used Docker commands
    • container, running / Running and stopping a container
    • container, stopping / Running and stopping a container
    • containers, listing / Listing and removing containers
    • containers, removing / Listing and removing containers
    • images, pulling / Pulling and pushing images
    • images, pushing / Pulling and pushing images
    • image, building / Building an image
    • networking / Networking
  • Docker Container Registry / Docker Container Registry
  • Docker host / Introducing Docker
  • Docker image, creating with microservices
    • about / Creating a Docker image with microservices
    • Dockerfiles / Dockerfiles
    • containerized microservices, running / Running containerized microservices
    • image building, with Maven plugin / Building an image using the Maven plugin
    • advanced Docker images / Advanced Docker images
  • docker images command / Listing and removing containers
  • Docker Pipeline / Integrating Jenkins with Docker
  • docker ps command / Listing and removing containers
  • Docker registry / Introducing Docker
  • docker run command / Running and stopping a container
  • docker stop command / Running and stopping a container
  • domain-specific language (DSL) / Gatling

E

  • ElasticCache / Cloud platform support
  • ELK Stack
    • used, for centralizing logs / Centralizing logs with ELK Stack
    • setting, up on machine / Setting up ELK Stack on the machine
    • used, for integrating application / Integrating an application with ELK Stack
  • end-to-end tests / Testing strategies
  • Enterprise Integration Patterns (EIP) / Learning about Spring Cloud Stream
  • Eureka
    • running, on server side / Running Eureka on the server side
    • enabling, on client side / Enabling Eureka on the client side
    • deregistration, on shutdown / Deregistration on shutdown
    • discovery client, using programmatically / Using discovery client programmatically
    • configuration settings / Advanced configuration settings
    • registry, refreshing / Refreshing the registry
    • change instance identificator / Changing the instance identificator 
    • IP address / Preferring the IP address
    • response cache / Response cache
    • replication / Replication and high availability
    • high availability / Replication and high availability
    • sample solution, architecture / Architecture of the sample solution
    • example application, building / Building the example application
    • failover / Failover
  • Eureka, serving over HTTPS
    • about / Serving Eureka over HTTPS
    • keystore generation / Keystore generation
    • SSL configuration, for microservices and Eureka server / Configurating SSL for microservices and Eureka server
  • Eureka API / Eureka API
  • EurekaClientConfigBean class
    • reference / Advanced configuration settings

F

  • FaaS (Function-as-a-Service) / Cloud platform support
  • fallback / Failures and circuit breakers
  • fat JARs / Developing applications with Spring Boot
  • fault tolerance
    • monitoring / Monitoring latency and fault tolerance
  • features, libraries
    • security / Security
    • automated testing / Automated testing
    • Cluster features / Cluster features
  • features, Spring Boot Actuator
    • about / Spring Boot Actuator features
    • application information / Application information
    • health information / Health information
    • metrics / Metrics
  • features, Spring Cloud Config
    • retry / Fail on start and retry
    • secure client / Secure client
  • Feign
    • failures / Failures and the circuit breaker pattern with Feign
    • Hystrix's support / Hystrix's support for Feign
  • Feign client
    • using / Using Feign client
    • support, for different zones / Support for different zones
    • enabling, for application / Enabling Feign for an application
    • interfaces, building / Building Feign interfaces
    • microservices, launching / Launching microservices
    • inheritance support / Inheritance support
    • creating, manual method / Creating a client manually
    • customization / Client customization
  • Feign inheritance
    • reference / Inheritance support
  • feign_with_discovery
    • reference / Launching microservices
  • filesystem backend / Filesystem backend
  • functional tests / Testing strategies

G

  • Gatling
    • about / Gatling
    • enabling / Enabling Gatling
    • test scenario, defining / Defining the test scenario
    • test scenario, running / Running a test scenario
  • Git / Integrating Jenkins with Docker
  • Git backend
    • about / Git backend
    • different protocols / Different protocols
    • placeholders, using in URIs / Using placeholders in URIs
    • server application, building / Building a server application
    • client-side configuration / Client-side configuration
    • multiple repositories / Multiple repositories

H

  • Heroku Command Line Interface (CLI)
    • URL / Using the CLI
  • Heroku platform
    • about / The Heroku platform
    • deployment methods / Deployment methods
    • application, preparing / Preparing an application
    • deployments, testing / Testing deployments
  • HTTP API resources
    • about / Introduction to HTTP API resources
    • native profile support / Native profile support
  • HTTPS
    • enabling, for Spring Boot / Enabling HTTPS for Spring Boot
  • Hystrix
    • circuit breaker pattern, using / The circuit breaker pattern with Hystrix
    • used, for building application / Building an application with Hystrix
    • commands, implementing / Implementing Hystrix's commands
    • fallback implementation, with cached data / Implementing fallback with cached data
    • latency, monitoring / Monitoring latency and fault tolerance
    • fault tolerance, maintaining / Monitoring latency and fault tolerance
    • metrics stream, exposing / Exposing Hystrix's metrics stream
    • dashboard / Hystrix dashboard
    • application, building with dashboard / Building an application with the dashboard
    • metrics, monitoring on dashboard / Monitoring metrics on the dashboard
    • streams, aggregating with Turbine / Aggregating Hystrix's streams with Turbine

I

  • integration / Messaging and integration
  • integration tests
    • about / Testing strategies, Integration tests
    • categorizing / Categorizing tests
    • HTTP traffic, capturing / Capturing HTTP traffic

J

  • Java Cryptography Extension (JCE) / Encryption and decryption
  • Java Web Tokens (JWT) / Authorization with OAuth2

K

  • Kibana
    • about / Centralizing logs with ELK Stack
    • used, for searching events / Searching events using Kibana
  • kubelet / Concepts and components
  • Kubernetes
    • working with / Working with Kubernetes
    • concepts / Concepts and components
    • components / Concepts and components
    • running locally, via Minikube / Running Kubernetes locally via Minikube
    • application, deploying / Deploying an application
    • cluster, maintaining / Maintaining a cluster

L

  • latency
    • monitoring / Monitoring latency and fault tolerance
  • libraries
    • features / Other useful libraries
  • load balancer / Communication between services
  • load balancing rules
    • about / Load balancing rules
    • WeightedResponseTime rule / The WeightedResponseTime rule
  • Logstash / Centralizing logs with ELK Stack

M

  • maintenance, PCF application
    • about / Maintenance
    • deployment details, accessing / Accessing deployment details
    • application life cycles, managing / Managing application life cycles
    • scaling / Scaling
    • brokered services, provisioning / Provisioning brokered services
  • mapped diagnostic context (MDC) / Using LogstashTCPAppender
  • Maven integration / Integrating Jenkins with Docker
  • messaging / Messaging and integration
  • messaging system
    • building / Building a messaging system
    • Spring Cloud Stream, enabling / Enabling Spring Cloud Stream
    • channels, declaring / Declaring and binding channels
    • channels, binding / Declaring and binding channels
    • connectivity customization, with RabbitMQ broker / Customizing connectivity with the RabbitMQ broker
    • integration, with Spring Cloud projects / Integration with other Spring Cloud projects
  • microservices
    • features / The blessings of microservices
    • building, with Spring Framework / Building microservices with Spring Framework
    • logging, best practices / Best logging practices for microservices
  • microservices-testing strategies
    • unit tests / Testing strategies
    • integration tests / Testing strategies
    • end-to-end tests / Testing strategies
    • contract tests / Testing strategies
    • component tests / Testing strategies
    • about / Testing strategies
  • microservices architecture
    • about / Learning the microservices architecture
    • service discovery, need for / Understanding the need for service discovery
    • communication, between services / Communication between services
    • failures / Failures and circuit breakers
    • circuit breakers / Failures and circuit breakers
  • microservices performance testing
    • load tests / Testing strategies
    • stress tests / Testing strategies
  • modules
    • Spring Cloud AWS Core / Cloud platform support
    • about / Cloud platform support
  • mutual authentication / Serving Eureka over HTTPS

N

  • Netflix OSS
    • about / Netflix OSS
    • service discovery with Eureka / Service discovery with Eureka
    • routing, with Zuul / Routing with Zuul
    • load balancing, with Ribbon / Load balancing with Ribbon
    • Java HTTP clients, writing / Writing Java HTTP clients
    • latency and fault, tolerance with Hystrix / Latency and fault tolerance with Hystrix
    • configuration management, with Archaius / Configuration management with Archaius

O

  • OAuth2
    • authentication / Authorization with OAuth2
    • about / Introduction to OAuth2
    • resource owner / Introduction to OAuth2
    • authorization grant / Introduction to OAuth2
    • resource server / Introduction to OAuth2
    • authorization server / Introduction to OAuth2
    • access token / Introduction to OAuth2
    • authorization server, building / Building an authorization server
    • client configuration / Client configuration
    • JDBC backend store, using / Using the JDBC backend store
    • interservice authorization / Inter-service authorization
    • SSO, enabling on API gateway / Enabling SSO on the API gateway

P

  • PaaS (Platform as a Service) model / The Heroku platform
  • Pact
    • about / Using Pact
    • using / Using Pact
    • consumer side / Consumer side
    • producer side / Producer side
  • PCF App Autoscaler / Scaling
  • performance testing
    • about / Performance testing
    • Gatling / Gatling
  • Pipeline / Integrating Jenkins with Docker
  • Pivotal Cloud Foundry (PCF)
    • about / Pivotal Cloud Foundry, Usage models
    • usage models / Usage models
    • application, preparing / Preparing the application
    • application, deploying / Deploying the application
    • maintenance / Maintenance
  • publish/subscribe model
    • about / The publish/subscribe model
    • sample system, executing / Running a sample system
    • scaling / Scaling and grouping
    • grouping / Scaling and grouping
    • multiple instances, executing / Running multiple instances
    • consumer groups / Consumer groups
    • partitioning / Partitioning

R

  • @RefreshScope
    • used, for configuration reload / Reload configuration with @RefreshScope
  • Relational Database Service (RDS) / Cloud platform support
  • release trains / Release trains
  • repository backend types
    • about / Repository backend types
    • filesystem backend / Filesystem backend
    • Git backend / Git backend
    • vault backend / Vault backend
  • repository changes
    • change events, manually simulating / Simulating change events manually
    • local testing, with GitLab instance / Testing locally with a GitLab instance 
  • RestTemplate
    • using, with service discovery / Load balancing with Ribbon, Using RestTemplate together with service discovery
    • example application, building / Building example application
  • Ribbon
    • used, for retrying connection / Retrying the connection with Ribbon
  • Ribbon client
    • used, for enabling communication between microservices / Enabling communication between microservices using the Ribbon client
    • configuration / Static load balancing configuration
    • other services, calling / Calling other services
    • customizing / Customizing the Ribbon client
  • route configuration, Spring Cloud Netflix Zuul
    • registered services, ignoring / Ignoring registered services
    • explicity set service name / Explicity set service name 
    • route definition, with Ribbon client / Route definition with the Ribbon client
    • prefix, adding to path / Adding a prefix to the path
    • connection settings and timeouts / Connection settings and timeouts
    • secure headers / Secure headers

S

  • secure application
    • issues / Secure discovery
    • registering / Registering a secure application
    • Eureka, serving over HTTPS / Serving Eureka over HTTPS
  • secure communication
    • enabling, between client and server / Enabling secure communication between client and server
  • secure configuration server
    • about / Secure configuration server
    • decryption / Encryption and decryption
    • encryption / Encryption and decryption
    • authentication, configuring for client and server / Configuring authentication for a client and a server
  • secure service
    • registering / Registering a secure service
  • self-preservation mode / Deregistration on shutdown
  • server-side application
    • building / Building a server-side application
  • service-oriented architecture (SOA) / The blessings of microservices
  • service discovery
    • RestTemplate, using / Load balancing with Ribbon
  • service discovery, Spring Cloud Consul
    • health status, checking / Health check
    • zones / Zones
    • client settings customization / Client settings customization
    • executing, in clustered mode / Running in clustered mode
  • service discovery, Spring Cloud Zookeeper
    • client implementation / Client implementation
    • dependencies / Zookeeper dependencies
  • service discovery and distributed configuration management
    • about / Discovery and distributed configuration
    • Consul / An alternative – Consul
    • Apache Zookeeper / Apache Zookeeper
    • miscellaneous projects / Miscellaneous projects
  • Simple Notification Service (SNS) / Cloud platform support
  • Simple Queueing Service (SQS) / Cloud platform support
  • single sign-on (SSO) / Client configuration
  • Sleuth
    • used, for distributed tracing / Distributed tracing with Sleuth
  • Spring Boot
    • about / Introducing Spring Boot
    • used, for developing applications / Developing applications with Spring Boot
    • and Swagger 2, using / Using Swagger 2 together with Spring Boot
    • used, for logging / Logging with Spring Boot
    • HTTPS, enabling / Enabling HTTPS for Spring Boot
  • Spring Boot Actuator
    • features / Spring Boot Actuator features
  • Spring Boot applications
    • testing / Testing Spring Boot applications
    • sample application, building / Building the sample application
    • database integration / Integration with the database
  • Spring Cloud
    • about / Beginning with the basics, Cloud platform support
    • Netflix OSS / Netflix OSS
    • project overview / Projects overview 
    • used, for synchronous communication / Synchronous communication with Spring Cloud
  • Spring Cloud Config
    • features / Additional features
  • Spring Cloud Consul
    • using / Using Spring Cloud Consul
    • agent / Running Consul agent
    • client side, integration / Integration on the client side
    • service discovery / Service discovery
  • Spring Cloud Contract
    • about / Using Spring Cloud Contract
    • using / Using Spring Cloud Contract
    • subprojects / Using Spring Cloud Contract
    • contracts, defining / Defining contracts and generating stubs
    • stubs, generating / Defining contracts and generating stubs
    • verifying, on consumer side / Verifying a contract on the consumer side
    • scenarios, defining / Scenarios
  • Spring Cloud Gateway
    • using / Using Spring Cloud Gateway
    • route / Using Spring Cloud Gateway
    • filters / Using Spring Cloud Gateway
    • enabling, for project / Enable Spring Cloud Gateway for a project
    • built-in predicates and filters / Built-in predicates and filters
    • using, for microservices / Gateway for microservices
    • integration, with service discovery / Integration with service discovery
  • Spring Cloud Incubator
    • reference / Miscellaneous projects
  • Spring Cloud Netflix Zuul
    • using / Using Spring Cloud Netflix Zuul
    • gateway application, building / Building a gateway application
    • integration, with service discovery / Integration with service discovery
    • route configuration, customizing / Customizing route configuration
    • management endpoints / Management endpoints
    • Hystrix fallback, providing / Providing Hystrix fallback
  • Spring Cloud Services (SCS) / Usage models
  • Spring Cloud Sleuth
    • about / Spring Cloud Sleuth
    • integrating, with application / Integrating Sleuth with an application
    • events, searching with Kibana / Searching events using Kibana
    • integrating, with Zipkin / Integrating Sleuth with Zipkin
  • Spring Cloud Sleuth and Zipkin integration
    • about / Integrating Sleuth with Zipkin
    • Zipkin server, executing / Running the Zipkin server
    • client application, building / Building the client application
    • data analyzing with Zipkin UI / Analyze data with the Zipkin UI
    • via message broker / Integration via message broker
  • Spring Cloud Stream / Learning about Spring Cloud Stream
  • Spring Cloud Zookeeper
    • using / Using Spring Cloud Zookeeper
    • executing / Running Zookeeper
    • operations / Running Zookeeper
    • service discovery / Service discovery
    • distributed configuration / Distributed configuration
  • Spring Cloud Zuul filters
    • route filter / Zuul filters
    • pre filter / Zuul filters
    • post filters / Zuul filters
    • error filters / Zuul filters
    • predefined filters / Predefined filters
    • custom implementations / Custom implementations
  • Spring Expression Language (SpEL) / Consuming messages conditionally
  • Spring Framework
    • used, for building microservices / Building microservices with Spring Framework
  • Spring Initializr website
    • reference / Customizing configuration files
  • starter / Introducing Spring Boot
  • Swagger
    • documentation / API Documentation
  • Swagger 2
    • using, with Spring Boot / Using Swagger 2 together with Spring Boot
  • Swagger UI
    • used, for testing API / Testing API with Swagger UI

T

  • Turbine
    • enabling / Enabling Turbine
    • enabling, with streaming / Enabling Turbine with streaming
  • two-way SSL / Serving Eureka over HTTPS

U

  • unit tests / Testing strategies, Unit tests
  • usage models, PCF
    • PCF Dev / Usage models
    • Pivotal Web Services / Usage models

V

  • vault backend
    • using / Getting started with Vault
    • integration, with Spring Cloud Config / Integration with Spring Cloud Config
    • client-side configuration / Client-side configuration

W

  • Web Application Description Language (WADL) / Creating RESTful Web Services
  • WeightedResponseTime rule
    • Hoverfly, for testing / Introducing Hoverfly for testing
    • testing / Testing the rule

Z

  • Zipkin
    • Sleuth, integrating with / Integrating Sleuth with Zipkin
  • zones
    • about / Zones
    • standalone server / Zones with a standalone server
    • example application, building / Building an example application
  • Zuul filters / Zuul filters