Gateway core concepts

Gateway's three core concepts:

  • Route (Route)
路由是构建网关的基本模块,它由ID,目标URI,一系列的断言和过滤器组成,如果断言为true则匹配该路由
  • Predicate (assertion)
开发人员可以匹配HTTP请求中的所有内容(例如请求头或请求参数),如果请求与断言相匹配则进行路由
  • Filter (filter)
指的是Spring框架中GatewayFilter的实例,使用过滤器,可以在请求被路由前或者之后对请求进行修改

web request, through a number of matching condition, the real target serving node. And before and after the forwarding process, some fine control.

predicate is our matching condition;

The filter, it can be understood as an all-powerful interceptor. With these two elements, plus target url, you can achieve a specific route

The client makes a request to springcloud Gateway, and then find the matches the request of the routing Gateway Handler Mapping, send it to the Gateway Web Handler.
Handler then sent to our actual business logic Service Star by the specified filter in terms of the request, and then return. By the broken line between the filter because the filter may be ( "pre") or after ( "post") prior to sending the service logic execution request Alice, or to reinforce its process.

Filter the "pre" types of filters can be done checking the parameters, verification authority, traffic monitoring, log output, protocol conversion, etc.,
in the "post" type of filter may be done in response to the content, in response to the first modification, the log output, traffic monitoring has a very important role.

Summary: matching mode called assertions, the way to achieve this is called the filter, it is the performance of the external routing functions. , Description about the same thing three dimensions different dimensions; Gateway core logic is executed route forwarding filter chain +

(To put it plainly, predicate is to achieve a set of matching rules, make a request come to find the corresponding Route processing.)

Guess you like

Origin www.cnblogs.com/nineberg/p/12661628.html
Recommended