This is the 20th day of my participation in the November Gwen Challenge. Check out the details: The last Gwen Challenge 2021

Gateway components in SpringCloud

Zuul was the first Gateway component in SpringCloud to be developed for use by developers. After Zuul, Spring officially developed a new substitute based on Spring2.0, SpringBoot2.0, Project Reactor and other technologies, that is Gateway.

In the next series of articles, we will share our development experience with the Gateway component, which is based on the Zuul component.

Introduce the Gateway component

If you want to introduce the Gateway component, start with its features.

Gateway has the following features (you can also go to the official website to see the English documentation) :

  • Based on Spring Framework 5, Project Reactor and Spring Boot 2.0

  • A route that matches any requested attribute

  • Predicates and filters are specific to routes

  • Circuit breaker integration

  • Spring Cloud DiscoveryClient integration

  • Easy to write predicates and filters

  • Request rate limit

  • The path to rewrite

In order to avoid the summary is not enough in place, this is I took from the official website, we do not blame. After that, we’ll take a look at how these features are used in real development.

The gateway in microservices, as an API architecture, is used for unified management of THE API, and provides security, routing control, traffic control, and hidden internal specific implementation functions.

Some of the essentials in Gateway

SpringCloud Gateway distinguishes between routers and filters, and has a standard built-in usage, which will be described below.

Here are a few concepts, namely routing, assertion, filter, from these three concepts, you can basically enter the Gateway.

Routing the Router

The basic module function of the gateway to declare different forwarding rules for the API.

Assertions Predicate

Assertions are used to match anything from an HTTP request, such as header headers, cookies, URL-path links, etc., to get a matching forwarding rule. This function is also used with the Router.

Filter Filter

The Gateway provides two types of filters, Gateway Filter and Global Filter, to support basic functions of the Gateway.

What functions can the Gateway integrate?

So what functionality can Gateway integrate? Let’s count them out.

  1. monitoring

  2. Log Collection Statistics

  3. Certificate authority

  4. Service fusing

  5. Service degradation

  6. Load balancing

Microservices architecture, gateway as the entrance to all services, its own functions account for a lot of weight, coupled with the integration of many component functions, then not to mention.

conclusion

Today we begin to learn Gateway Gateway, very important knowledge points, I hope to better share with you.