
技术领域technical field
本发明涉及服务网关技术领域,具体涉及一种基于Spring Cloud Gateway实现的动态路由编排方法及系统。The invention relates to the technical field of service gateways, in particular to a dynamic routing arrangement method and system based on Spring Cloud Gateway.
背景技术Background technique
在IT领域,最近微服务架构盛行,一个系统往往由数个系统组成,站在功能的角度,把业务逻辑抽象成可复用、可组装的服务,通过服务的编排实现业务的快速再生,从而把原先固有的业务功能转变为通用的业务服务,实现业务逻辑的快速复用,为了能对每一个服务都进行统一管理,网关应运而生,其目的是为提供一种简单而有效的统一的API路由管理方式。In the field of IT, the microservice architecture is prevalent recently. A system is often composed of several systems. From a functional point of view, the business logic is abstracted into reusable and assembleable services, and the rapid regeneration of the business is realized through the orchestration of services, thereby Transform the original inherent business functions into general business services to achieve rapid reuse of business logic. In order to manage each service in a unified way, the gateway came into being. Its purpose is to provide a simple and effective unified API route management method.
在网关的应用过程中,Spring Cloud Gateway较其他网关不仅提供了统一访问地址,还可运用filter策略,基于Netty的响应式开发模式实现更加高效。但现有的SpringCloud Gateway网关调用一般都是针对单一资源,且返回数据无法再次处理,为此,提出一种基于Spring Cloud Gateway实现的动态路由编排方法及系统。In the application process of the gateway, Spring Cloud Gateway not only provides a unified access address than other gateways, but also uses filter strategies, and the responsive development model based on Netty is more efficient. However, the existing Spring Cloud Gateway gateway calls are generally aimed at a single resource, and the returned data cannot be processed again. Therefore, a dynamic routing arrangement method and system based on Spring Cloud Gateway is proposed.
发明内容Contents of the invention
本发明所要解决的技术问题在于:如何基于Spring Cloud Gateway实现匹配路由过滤策略,执行动态路由编排功能,丰富了网关在管控上的维度,解决了Spring CloudGateway网关调用一般都是针对单一资源,且返回数据无法再次处理的问题,提供了一种基于Spring Cloud Gateway实现的动态路由编排方法。The technical problem to be solved by the present invention is: how to realize the matching routing filtering strategy based on Spring Cloud Gateway, execute the dynamic routing arrangement function, enrich the dimension of the gateway in management and control, solve the problem that the Spring CloudGateway gateway call is generally aimed at a single resource, and return To solve the problem that data cannot be processed again, a dynamic routing arrangement method based on Spring Cloud Gateway is provided.
本发明是通过以下技术方案解决上述技术问题的,本发明包括以下步骤:The present invention solves the above-mentioned technical problems through the following technical solutions, and the present invention comprises the following steps:
S1:注册动态路由规则信息S1: Register dynamic routing rule information
服务提供者提供所需注册的业务系统接口,完善基本服务信息,编排资源,确定动态路由流向及编排处理要求,并添加必要的过滤到动态路由中,作为服务网关的限制策略;The service provider provides the business system interface that needs to be registered, improves the basic service information, arranges resources, determines the dynamic routing flow direction and orchestration processing requirements, and adds necessary filters to the dynamic routing as the restriction strategy of the service gateway;
S2:启动加载监听动态路由配置S2: start loading and monitoring dynamic routing configuration
启动Spring Cloud Gateway系统,监听动态路由的配置,将规则信息加载到Spring Cloud Gateway路由中,并持续监听,当路由信息发生改变,实时刷新到路由中;Start the Spring Cloud Gateway system, monitor the configuration of dynamic routing, load the rule information into the Spring Cloud Gateway routing, and continue monitoring. When the routing information changes, it will be refreshed to the routing in real time;
S3:请求调用网关S3: request call gateway
消费方或系统管理员调用服务网关统一开放的地址,并拼接服务唯一编码,编码即标识,录入必要参数向服务网关发送请求;The consumer or system administrator calls the uniformly open address of the service gateway, and splices the unique code of the service, the code is the identification, and enters the necessary parameters to send the request to the service gateway;
S4:匹配路由过滤控制策略S4: Match routing filtering control policy
服务网关请求路径携带路由唯一标识,经过网关路由识别,匹配私有过滤规则,私有过滤规则不同网关各自独有,全局过滤器对于所有服务网关均有管控作用;The service gateway request path carries the unique identifier of the route. After the gateway route identification, it matches the private filtering rules. The private filtering rules are unique to different gateways. The global filter has a control effect on all service gateways;
S5:执行动态路由编排流程S5: Execute the dynamic routing orchestration process
服务网关请求处理过程中,将多个路由资源进行编排,适配http资源和groovy资源,进行不同路由的资源信息转换,并记录不同资源的响应日志信息;During the service gateway request processing, arrange multiple routing resources, adapt http resources and groovy resources, convert resource information of different routes, and record response log information of different resources;
S6:请求返回S6: request return
路由策略成功执行结束后,服务网关返回服务提供者提供的业务接口数据,并记录返回信息到日志,服务网关调用结束。After the routing policy is successfully executed, the service gateway returns the business interface data provided by the service provider, and records the returned information to the log, and the service gateway call ends.
更进一步地,在所述步骤S1中,服务提供者提供多个原始资源信息,对不同资源编排操作,确定资源的流向,指定服务名称、服务编码、服务所属系统、服务归属中心、服务请求方式,完成基本信息注册,即动态路由对外的唯一标识及特殊分类。Furthermore, in the step S1, the service provider provides a plurality of original resource information, arranges operations for different resources, determines the flow direction of resources, specifies the service name, service code, service system, service attribution center, and service request method , to complete the registration of basic information, that is, the unique identification and special classification of dynamic routing externally.
更进一步地,在所述步骤S1中,在注册完成后,根据路由编排需要进行全局过滤器和私有过滤器的配置,此处基于Spring Cloud Gateway路由规则,配置黑白名单、限流、熔断策略,为动态路由提供策略保障。Furthermore, in the step S1, after the registration is completed, the configuration of the global filter and the private filter needs to be performed according to the routing arrangement, here based on the Spring Cloud Gateway routing rules, configure the black and white lists, current limiting, and fusing strategies, Provide policy guarantee for dynamic routing.
更进一步地,在所述步骤S2中,启动Spring Cloud Gateway系统后,路由信息是从微服务动态配置服务nacos中获取,调用nacos提供的对外API完成动态路由变化的实时监听。Furthermore, in the step S2, after the Spring Cloud Gateway system is started, the routing information is obtained from the microservice dynamic configuration service nacos, and the external API provided by nacos is called to complete real-time monitoring of dynamic routing changes.
更进一步地,在所述步骤S2中,在nacos中建立一个缓存区,专门保存动态路由标识信息,并对此缓存区进行监听,完成对新增路由的监听,即完成了对动态路由配置的实时监听;动态路由信息监听的同时会执行动态路由服务DynamicRouteService,将路由信息按照Spring Cloud Gateway路由规则要求动态添加或修改新的路由信息。Furthermore, in the step S2, a cache area is established in nacos to specifically store the dynamic routing identification information, and the cache area is monitored to complete the monitoring of the newly added route, that is, the configuration of the dynamic route is completed. Real-time monitoring; dynamic routing service DynamicRouteService will be executed at the same time as dynamic routing information monitoring, and routing information will be dynamically added or modified according to the requirements of Spring Cloud Gateway routing rules.
更进一步地,在所述步骤S3中,动态路由提供了统一对外地址,消费方或者系统管理员拼接路由唯一标识endpoint请求调用,输入请求报文信息,请求调用过程中路由能够解析路由信息。Furthermore, in the step S3, the dynamic routing provides a unified external address, and the consumer or the system administrator concatenates the routing unique identifier endpoint to request and call, and inputs the request message information, and the routing can parse the routing information during the request calling process.
更进一步地,在所述步骤S4中,当请求进入动态路由内部,依据Spring CloudGateway路由规则,指定各类过滤器的执行顺序。Furthermore, in the step S4, when the request enters the dynamic routing, according to the Spring CloudGateway routing rules, specify the execution order of various filters.
更进一步地,在所述步骤S5中,在服务网关处理过程中,一个资源执行完成后,对资源响应信息进行处理,并将响应信息记录到日志中,获取到响应后的数据流向路由编排中的另一个资源,当此资源为HTTP资源时,将上一个资源响应数据作为下一个资源的入参,在路由内部完成调用;当另一个资源为groovy资源时,根据groovy资源脚本的不同逻辑输出不同结果。Furthermore, in the step S5, in the processing process of the service gateway, after a resource is executed, the response information of the resource is processed, and the response information is recorded in the log, and the data after the response is obtained flows into the routing arrangement Another resource, when this resource is an HTTP resource, the response data of the previous resource is used as the input parameter of the next resource, and the call is completed inside the route; when the other resource is a groovy resource, it is output according to the different logic of the groovy resource script different results.
更进一步地,在所述步骤S6中,请求网关在执行过滤及动态编排后,之前注册的业务接口返回数据按照编排处理及按照消费方的要求有了相应的变化,请求结束后返回数据的同时保存日志信息。Furthermore, in the step S6, after the requesting gateway performs filtering and dynamic arrangement, the previously registered business interface returns data according to the arrangement process and changes accordingly according to the requirements of the consumer, and returns the data after the request is completed. Save log information.
本发明还提供了一种基于Spring Cloud Gateway实现的动态路由编排系统,用于供上述的动态路由编排方法使用,包括服务提供者、服务消费者、微服务管控中心、动态路由监听模块、路由过滤规则匹配模块、动态路由编排模块、日志记录中心;The present invention also provides a dynamic routing arrangement system based on Spring Cloud Gateway, which is used for the above-mentioned dynamic routing arrangement method, including a service provider, a service consumer, a microservice control center, a dynamic routing monitoring module, and routing filtering Rule matching module, dynamic routing module, logging center;
所述服务提供者,用于注册动态路由基本信息,确定动态路由流向及处理要求;The service provider is used to register the basic information of dynamic routing, determine the flow direction and processing requirements of dynamic routing;
所述服务消费者,用于调用动态路由编排的服务网关,传递路由必要信息与路由进行适配;The service consumer is used to call the service gateway of the dynamic routing arrangement, and transmit the necessary routing information to adapt the routing;
所述微服务管控中心,用于缓存动态路由注册的基本信息,开放对外API供网关监听时调用获取;The micro-service management and control center is used for caching the basic information of dynamic routing registration, and opening an external API for calling and obtaining when the gateway monitors;
所述动态路由监听模块,用于监听动态路由的变化,将新增或修改的路由信息实时更新到Spring Cloud Gateway系统路由规则中;The dynamic routing monitoring module is used to monitor changes in dynamic routing, and the routing information added or modified is updated in the Spring Cloud Gateway system routing rules in real time;
所述路由过滤规则匹配模块,用于保证服务网关的安全可用,提供全局、私有、多维度的策略控制,维护管理整个路由的生命周期的安全策略,为管理人员提供全局管控的平台;The routing filtering rule matching module is used to ensure the security and availability of the service gateway, provide global, private, multi-dimensional policy control, maintain and manage the security policy of the entire routing life cycle, and provide a global management and control platform for managers;
所述动态路由编排模块,用于处理路由内部资源响应信息,编写脚本信息,指定资源流向,将响应信息按照服务提供者要求的格式输出;The dynamic routing module is used to process routing internal resource response information, write script information, specify resource flow, and output response information in a format required by the service provider;
所述日志记录中心,用于动态路由编排的运维,通过接收网关请求概要信息、编排过程中响应信息、请求返回信息,监控整个Spring Cloud Gateway系统的调用执行情况,供结果分析所用。The log recording center is used for the operation and maintenance of dynamic routing arrangement, and monitors the call execution of the entire Spring Cloud Gateway system by receiving summary information of gateway requests, response information during the arrangement process, and request return information for use in result analysis.
本发明相比现有技术具有以下优点:该基于Spring Cloud Gateway实现的动态路由编排方法,通过实现Spring Cloud Gateway动态路由的编排,完成了一个服务网关的从无到有,服务提供者无需关心动态路由编排细节,只须按要求配置对应的策略信息即可生成一个服务网关,服务网关统一调用地址前缀,依靠全局过滤器集中管控所有网关,根据私有过滤器隔离管控单独网关,调用过程中日志分阶段异步保存,请求返回结果准确可靠,网关性能高可用,值得被推广使用。Compared with the prior art, the present invention has the following advantages: the dynamic routing arrangement method based on Spring Cloud Gateway realizes the arrangement of Spring Cloud Gateway dynamic routing, and completes a service gateway from scratch, and the service provider does not need to care about dynamic routing. Routing arrangement details, you only need to configure the corresponding policy information as required to generate a service gateway. The service gateway uniformly calls the address prefix, relies on the global filter to centrally control all gateways, isolates and controls individual gateways according to the private filter, and logs during the call process. The stage is saved asynchronously, the result of the request is accurate and reliable, and the performance of the gateway is high and available, so it is worth promoting and using.
附图说明Description of drawings
图1是本发明实施例中基于Spring Cloud Gateway实现的动态路由编排方法的流程示意图。FIG. 1 is a schematic flowchart of a dynamic routing arrangement method implemented based on Spring Cloud Gateway in an embodiment of the present invention.
具体实施方式Detailed ways
下面对本发明的实施例作详细说明,本实施例在以本发明技术方案为前提下进行实施,给出了详细的实施方式和具体的操作过程,但本发明的保护范围不限于下述的实施例。The embodiments of the present invention are described in detail below. This embodiment is implemented on the premise of the technical solution of the present invention, and detailed implementation methods and specific operating procedures are provided, but the protection scope of the present invention is not limited to the following implementation example.
本实施例提供一种技术方案:一种基于Spring Cloud Gateway实现的动态路由编排方法,包括如下步骤:This embodiment provides a technical solution: a dynamic routing arrangement method based on Spring Cloud Gateway, including the following steps:
步骤S1:注册动态路由规则信息Step S1: Register dynamic routing rule information
服务提供者提供所需注册的业务系统接口,完善基本的服务信息,编排资源,确定动态路由流向及编排处理要求;添加必要的过滤到动态路由中,包括黑白名单、限流、熔断等,作为服务网关的限制策略;The service provider provides the business system interface that needs to be registered, improves the basic service information, arranges resources, determines the dynamic routing flow direction and arranges processing requirements; adds necessary filters to the dynamic routing, including black and white lists, current limiting, fuses, etc., as The restriction strategy of the service gateway;
步骤S2:启动加载监听动态路由配置Step S2: Start loading and monitoring dynamic routing configuration
启动Spring Cloud Gateway系统,系统自动监听动态路由的配置,会将规则信息加载到Spring Cloud Gateway路由中,并持续监听,一旦有路由信息发生改变,实时刷新到路由中;Start the Spring Cloud Gateway system, the system will automatically monitor the dynamic routing configuration, load the rule information into the Spring Cloud Gateway route, and continue to monitor, once the routing information changes, it will be refreshed to the route in real time;
步骤S3:请求调用网关Step S3: Request to call the gateway
消费方或系统管理员调用服务网关统一开放的地址,并拼接服务唯一编码,录入必要参数向服务网关发送请求;The consumer or system administrator calls the uniformly open address of the service gateway, splices the unique code of the service, and enters the necessary parameters to send a request to the service gateway;
步骤S4:匹配路由过滤控制策略Step S4: Match the route filtering control policy
服务网关请求路径携带路由唯一标识,经过网关路由识别,自动匹配私有过滤规则,私有过滤规则不同网关各自独有,全局过滤器对于所有服务网关均有管控作用;The service gateway request path carries the unique identifier of the route. After the gateway route identification, it automatically matches the private filtering rules. The private filtering rules are unique to different gateways. The global filter has a control effect on all service gateways;
步骤S5:执行动态路由编排流程Step S5: Execute the dynamic routing orchestration process
服务网关请求处理过程中,将多个路由资源进行编排,适配http资源和groovy资源,进行不同路由的资源信息转换,并记录不同资源的响应日志信息;During the service gateway request processing, arrange multiple routing resources, adapt http resources and groovy resources, convert resource information of different routes, and record response log information of different resources;
步骤S6:请求返回Step S6: Request return
路由策略成功执行结束后,服务网关返回服务提供者提供的业务接口数据,并记录返回信息到日志,服务网关调用结束。After the routing policy is successfully executed, the service gateway returns the business interface data provided by the service provider, and records the returned information to the log, and the service gateway call ends.
在本实施例中,步骤S1中,服务提供者提供多个原始资源信息,对不同资源编排操作,确定资源的流向,指定服务名称、服务编码、服务所属系统、服务归属中心、服务请求方式,完成一个基本信息注册,即动态路由对外的唯一标识及特殊分类。在注册完成后,根据路由编排需要进行全局过滤器和私有过滤器的配置,此处基于Spring Cloud Gateway路由规则,配置黑白名单、限流、熔断等策略,为动态路由提供策略保障。In this embodiment, in step S1, the service provider provides a plurality of original resource information, arranges operations for different resources, determines the flow direction of resources, specifies the service name, service code, service system, service attribution center, and service request method, Complete a basic information registration, that is, the unique identification and special classification of dynamic routing externally. After the registration is complete, configure the global filter and private filter according to the routing arrangement. Here, based on the Spring Cloud Gateway routing rules, configure strategies such as black and white lists, current limiting, and circuit breakers to provide policy protection for dynamic routing.
在本实施例中,步骤S2中,一旦启动网关系统(Spring Cloud Gateway系统),便自动监听动态路由信息,此处路由信息是从微服务动态配置服务nacos中获取,调用nacos提供的对外API完成动态路由变化的实时监听,nacos提供的API是无法监听动态路由新增问题,步骤S2中对此在nacos中建立了一个缓存区,专门保存动态路由标识信息,并对此缓存区进行监听,完成对新增路由的监听,也即完成了对动态路由配置的实时监听。动态路由信息监听的同时会执行动态路由服务DynamicRouteService,将路由信息按照Spring CloudGateway路由规则要求动态添加或修改新的路由信息。In this embodiment, in step S2, once the gateway system (Spring Cloud Gateway system) is started, it will automatically monitor the dynamic routing information, where the routing information is obtained from the microservice dynamic configuration service nacos, and the external API provided by nacos is called to complete For real-time monitoring of dynamic routing changes, the API provided by nacos is unable to monitor the problem of new dynamic routing. In step S2, a buffer area is established in nacos to specifically store dynamic routing identification information, and the buffer area is monitored. Completed The monitoring of the newly added route also completes the real-time monitoring of the dynamic routing configuration. While monitoring the dynamic routing information, the dynamic routing service DynamicRouteService will be executed, and the routing information will be dynamically added or modified according to the requirements of the Spring CloudGateway routing rules.
在本实施例中,步骤S3中,动态路由提供了统一对外地址,消费方或者系统管理员拼接路由唯一标识endpoint(即服务编码)请求调用,输入请求报文等信息,请求调用过程中路由能够解析路由信息,包括服务编码等,服务编码作为唯一标识,类似通行证进入动态路由编排网关。In this embodiment, in step S3, the dynamic routing provides a unified external address, and the consumer or the system administrator splices the routing unique identifier endpoint (that is, the service code) to request invocation, and enters information such as a request message. During the request invocation process, the routing can Parse routing information, including service codes, etc., service codes are used as unique identifiers, similar to passports to enter the dynamic routing orchestration gateway.
在本实施例中,步骤S4中,当请求进入动态路由内部,依据Spring Cloud Gateway路由规则,指定各类过滤器的执行顺序,重写过滤器getOrder方法如下:In this embodiment, in step S4, when the request enters the dynamic routing, according to the Spring Cloud Gateway routing rules, specify the execution order of various filters, and rewrite the getOrder method of the filter as follows:
返回结果越小越先执行,动态路由编排网关分别执行全局IP黑白名单过滤、全局限流处理、解析路由参数过滤、全局IP维度限流限流、全局应用黑白名单过滤、鉴权过滤、全局用户维度黑白名单过滤、私有服务维度IP黑白名单过滤、私有服务维度服务限流过滤、私有服务+IP组合限流过滤、私有服务维度服务熔断过滤等。其中IP黑白名单限制了只有某些IP能够调用或者某些IP无法调用;在路由参数解析中,解析token、fromIp、body等同时记录日志信息,便于后期统计动态路由调用使用;在鉴权中通过校验appKey,确保应用调用的安全性;在限流过滤中,防止网关路由短时间出现多次请求,超过网关服务承载导致崩溃的现象;在熔断过滤中,若某一个服务出现异常过多,或请求时间过长执行降级机制,保证其他网关的正常调用。The smaller the returned result, the earlier the execution. The dynamic routing orchestration gateway respectively performs global IP black and white list filtering, global current limiting processing, parsing routing parameter filtering, global IP dimension current limiting and current limiting, global application black and white list filtering, authentication filtering, and global user filtering. Dimension black and white list filtering, private service dimension IP black and white list filtering, private service dimension service current limiting filtering, private service + IP combination current limiting filtering, private service dimension service circuit breaker filtering, etc. Among them, the IP black and white list restricts that only some IPs can be called or some IPs cannot be called; in the routing parameter analysis, the token, fromIp, body, etc. are parsed and the log information is recorded at the same time, which is convenient for later statistical dynamic routing calls; Verify the appKey to ensure the security of application calls; in the current limiting filter, prevent multiple requests from the gateway route in a short period of time, exceeding the load of the gateway service and causing a crash; in the circuit breaker filter, if there are too many abnormalities in a certain service, Or the request time is too long to implement the downgrade mechanism to ensure the normal calls of other gateways.
在本实施例中,步骤S5中,在服务网关处理过程中,一个资源执行完成后,需要对资源响应信息进行处理,并将响应信息记录到日志中,保证了处理前数据的备份,获取到响应后的数据流向路由编排中的另一个资源,当此资源为HTTP资源时,将上一个资源响应数据作为下一个资源的入参,在路由内部完成调用;当另一个资源为groovy资源时,根据groovy资源脚本的不同逻辑输出不同结果,比如过滤响应数据或新增标识信息到响应数据中等。In this embodiment, in step S5, in the processing process of the service gateway, after a resource is executed, the response information of the resource needs to be processed, and the response information is recorded in the log, which ensures the backup of the data before processing, and obtains The data after the response flows to another resource in the routing arrangement. When the resource is an HTTP resource, the response data of the previous resource is used as the input parameter of the next resource, and the call is completed inside the route; when the other resource is a groovy resource, Output different results according to different logics of groovy resource scripts, such as filtering response data or adding identification information to response data, etc.
在本实施例中,步骤S6中,请求网关在执行过滤及动态编排后,之前注册的业务接口返回数据按照编排处理及按照消费方的要求有了相应的变化,并经过Spring CloudGateway系统的保护更加安全可用,请求结束后返回数据的同时保存日志信息。In this embodiment, in step S6, after the request gateway performs filtering and dynamic orchestration, the previously registered business interface returns data according to the orchestration processing and the corresponding changes according to the requirements of the consumer, and is more protected by the Spring CloudGateway system. It is safe and available, and saves log information while returning data after the request ends.
本发明基于Spring Cloud Gateway实现的动态路由编排方法的实现系统,包括服务提供者、服务消费者、微服务管控中心(即图1中的服务管控中心)、动态路由监听模块、路由过滤规则匹配模块、动态路由编排模块、日志记录中心;The present invention is based on the implementation system of the dynamic routing arrangement method realized by Spring Cloud Gateway, including a service provider, a service consumer, a microservice management and control center (that is, the service management and control center in Figure 1), a dynamic routing monitoring module, and a routing filtering rule matching module , dynamic routing module, logging center;
所述服务提供者,用于注册动态路由基本信息,包括唯一标识endpoint等,编排资源,确定动态路由流向及处理要求;The service provider is used to register the basic information of dynamic routing, including the unique identifier endpoint, etc., arrange resources, determine the flow direction and processing requirements of dynamic routing;
所述服务消费者,用于调用动态路由编排的服务网关,传递路由必要信息与路由进行适配;The service consumer is used to call the service gateway of the dynamic routing arrangement, and transmit the necessary routing information to adapt the routing;
所述微服务管控中心,用于缓存动态路由注册的基本信息,提供对外API便于网关监听时调用获取;The micro-service management and control center is used for caching the basic information of dynamic routing registration, and provides an external API to facilitate calling and obtaining when the gateway monitors;
所述动态路由监听模块,用于监听动态路由的变化,将新增或修改的路由信息实时更新到Spring Cloud Gateway系统路由规则中;The dynamic routing monitoring module is used to monitor changes in dynamic routing, and the routing information added or modified is updated in the Spring Cloud Gateway system routing rules in real time;
所述路由过滤规则匹配模块,用于保证服务网关的安全可用,提供全局、私有、多维度的策略控制,维护管理整个路由的生命周期的安全策略,保证了动态路由调用的高可用,为管理人员提供了全局管控的平台;The routing filter rule matching module is used to ensure the security and availability of the service gateway, provide global, private, and multi-dimensional policy control, maintain and manage the security policy of the entire routing life cycle, and ensure the high availability of dynamic routing calls. Personnel provide a platform for global management and control;
所述动态路由编排模块,用于处理路由内部资源响应信息,编写脚本信息,指定资源流向,将响应信息按照服务提供者要求的格式输出;The dynamic routing module is used to process routing internal resource response information, write script information, specify resource flow, and output response information in a format required by the service provider;
所述日志记录中心,用于动态路由编排的运维,通过接收网关请求概要信息、编排过程中响应信息、请求返回信息,监控整个Spring Cloud Gateway系统的调用执行情况,供结果分析所用。The log recording center is used for the operation and maintenance of dynamic routing arrangement, and monitors the call execution of the entire Spring Cloud Gateway system by receiving summary information of gateway requests, response information during the arrangement process, and request return information for use in result analysis.
值得注意的是,上述实施例中,所包括的各个单元只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本发明的保护范围。It is worth noting that in the above embodiments, the units included are only divided according to the functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are also It is only for the convenience of distinguishing each other, and is not intended to limit the protection scope of the present invention.
另外,本领域普通技术人员可以理解实现上述各实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,相应的程序可以存储于一计算机可读取存储介质中。In addition, those skilled in the art can understand that all or part of the steps in the methods of the above embodiments can be implemented by instructing related hardware through programs, and the corresponding programs can be stored in a computer-readable storage medium.
综上所述,上述实施例的基于Spring Cloud Gateway实现的动态路由编排方法,通过实现Spring Cloud Gateway动态路由的编排,完成了一个服务网关的从无到有,服务提供者无需关心动态路由编排细节,只须按要求配置对应的策略信息即可生成一个服务网关,服务网关统一调用地址前缀,依靠全局过滤器集中管控所有网关,根据私有过滤器隔离管控单独网关,调用过程中日志分阶段异步保存,请求返回结果准确可靠,网关性能高可用,值得被推广使用。To sum up, the dynamic routing arrangement method based on Spring Cloud Gateway implemented in the above embodiment completes the creation of a service gateway from scratch by realizing the arrangement of Spring Cloud Gateway dynamic routing, and the service provider does not need to care about the details of dynamic routing arrangement , you only need to configure the corresponding policy information as required to generate a service gateway. The service gateway uniformly calls the address prefix, relies on the global filter to centrally control all gateways, and isolates and controls individual gateways according to the private filter. During the call process, the logs are saved asynchronously in stages , the result returned by the request is accurate and reliable, and the performance of the gateway is high and available, so it is worth promoting and using.
尽管上面已经示出和描述了本发明的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本发明的限制,本领域的普通技术人员在本发明的范围内可以对上述实施例进行变化、修改、替换和变型。Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention, those skilled in the art can make the above-mentioned The embodiments are subject to changes, modifications, substitutions and variations.
| Application Number | Priority Date | Filing Date | Title | 
|---|---|---|---|
| CN202110920948.9ACN113794636B (en) | 2021-08-11 | 2021-08-11 | Dynamic routing arrangement method and system based on Spring Cloud Gateway | 
| Application Number | Priority Date | Filing Date | Title | 
|---|---|---|---|
| CN202110920948.9ACN113794636B (en) | 2021-08-11 | 2021-08-11 | Dynamic routing arrangement method and system based on Spring Cloud Gateway | 
| Publication Number | Publication Date | 
|---|---|
| CN113794636A CN113794636A (en) | 2021-12-14 | 
| CN113794636Btrue CN113794636B (en) | 2022-11-18 | 
| Application Number | Title | Priority Date | Filing Date | 
|---|---|---|---|
| CN202110920948.9AExpired - Fee RelatedCN113794636B (en) | 2021-08-11 | 2021-08-11 | Dynamic routing arrangement method and system based on Spring Cloud Gateway | 
| Country | Link | 
|---|---|
| CN (1) | CN113794636B (en) | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| CN114490324A (en)* | 2021-12-22 | 2022-05-13 | 山东浪潮工业互联网产业股份有限公司 | Gateway-based global exception handling method and device | 
| CN114584451B (en)* | 2022-01-18 | 2023-10-17 | 北京智象信息技术有限公司 | Method and device for debugging internal service interface based on micro-service environment | 
| CN115018655A (en)* | 2022-04-21 | 2022-09-06 | 江苏康众汽配有限公司 | Insurance company docking adaptation system and adaptation method based on dynamic expansion and process orchestration | 
| CN114866479A (en)* | 2022-04-24 | 2022-08-05 | 中电万维信息技术有限责任公司 | A Service Gateway-Based Service Fusion Method | 
| CN115102854B (en)* | 2022-07-21 | 2024-05-14 | 康键信息技术(深圳)有限公司 | Remote procedure call route management control method, system and equipment for micro-service | 
| CN115426219A (en)* | 2022-07-28 | 2022-12-02 | 海纳致远数字科技(上海)有限公司 | API gateway automated processing system and method | 
| CN115567442A (en)* | 2022-09-06 | 2023-01-03 | 山东浪潮智慧医疗科技有限公司 | A method and device for implementing Spring Cloud dynamic routing | 
| CN115658164B (en)* | 2022-09-26 | 2025-08-12 | 湖南大学 | Distributed serial arrangement service execution method and system | 
| CN115982484A (en)* | 2022-12-05 | 2023-04-18 | 华南理工大学 | Method, system and medium for flexibly responding to webpage requirements by using storage process | 
| CN115883353A (en)* | 2022-12-08 | 2023-03-31 | 普元信息技术股份有限公司 | Routing plug-in arranging and executing system based on Spring Cloud Gateway in trusted environment | 
| CN116091207A (en)* | 2023-01-17 | 2023-05-09 | 上海通联金融服务有限公司 | A Processing Scheme Based on Unified Management of Multiple Information Sources in Credit Card Business | 
| CN116614563A (en)* | 2023-05-26 | 2023-08-18 | 中国银行股份有限公司 | Service routing method, device, electronic equipment and storage medium | 
| CN116633727B (en)* | 2023-05-30 | 2025-09-23 | 北京洞悉网络有限公司 | Nacos service-based gateway dynamic routing method, device, computer equipment, and computer-readable storage medium | 
| CN116975477A (en)* | 2023-07-31 | 2023-10-31 | 山东浪潮科学研究院有限公司 | Application service calling method, device, equipment and storage medium | 
| CN118264614A (en)* | 2024-04-01 | 2024-06-28 | 福建天泉教育科技有限公司 | Dynamic route optimization method and system | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| CN111818182A (en)* | 2020-08-31 | 2020-10-23 | 四川新网银行股份有限公司 | Micro-service arranging and data aggregating method based on Spring closed gateway | 
| CN111930372A (en)* | 2020-08-06 | 2020-11-13 | 科大国创云网科技有限公司 | Service arrangement solution method and system realized through draggable flow chart | 
| CN112260876A (en)* | 2020-10-26 | 2021-01-22 | 欧冶云商股份有限公司 | Dynamic gateway route configuration method, platform, computer equipment and storage medium | 
| CN112804722A (en)* | 2020-12-31 | 2021-05-14 | 浪潮云信息技术股份公司 | Method for realizing micro-service gateway dynamic routing | 
| US11032160B1 (en)* | 2020-07-31 | 2021-06-08 | Boomi, Inc. | Serverless elastic scale API gateway management system and method of an API service control plane system | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| US9645811B2 (en)* | 2013-04-01 | 2017-05-09 | Oc Acquisition Llc | Fault tolerance for a distributed computing system | 
| US10917308B2 (en)* | 2018-12-20 | 2021-02-09 | Verizon Patent And Licensing Inc. | Virtualized network service management and diagnostics | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| US11032160B1 (en)* | 2020-07-31 | 2021-06-08 | Boomi, Inc. | Serverless elastic scale API gateway management system and method of an API service control plane system | 
| CN111930372A (en)* | 2020-08-06 | 2020-11-13 | 科大国创云网科技有限公司 | Service arrangement solution method and system realized through draggable flow chart | 
| CN111818182A (en)* | 2020-08-31 | 2020-10-23 | 四川新网银行股份有限公司 | Micro-service arranging and data aggregating method based on Spring closed gateway | 
| CN112260876A (en)* | 2020-10-26 | 2021-01-22 | 欧冶云商股份有限公司 | Dynamic gateway route configuration method, platform, computer equipment and storage medium | 
| CN112804722A (en)* | 2020-12-31 | 2021-05-14 | 浪潮云信息技术股份公司 | Method for realizing micro-service gateway dynamic routing | 
| Title | 
|---|
| 《Dragon: Data discovery and collection architecture for distributed IoT》;Roman Kolcun 等;《IEEE》;20140830;全文* | 
| 《Spring Cloud Gateway 多种思路实现动态路由》;yfgeek;《百度》;20210726;全文* | 
| 《基于微服务的虚拟机自动化编排系统的设计与实现》;黄科;《中国优秀硕士学位论文全文数据库》;20191215;全文* | 
| Publication number | Publication date | 
|---|---|
| CN113794636A (en) | 2021-12-14 | 
| Publication | Publication Date | Title | 
|---|---|---|
| CN113794636B (en) | Dynamic routing arrangement method and system based on Spring Cloud Gateway | |
| US12192246B2 (en) | Hardening of cloud security policies | |
| CA2898053C (en) | Deep packet inspection method, device, and coprocessor | |
| CN110692227B (en) | Identifying conflicting rules in network intent form peering failure | |
| CN111049695A (en) | Cloud gateway configuration method and system | |
| CN111752799A (en) | Service link tracking method, device, equipment and storage medium | |
| CN110780870A (en) | Service execution method, device, equipment and storage medium | |
| CN110096363B (en) | Method and device for associating network event with process | |
| EP3143728B1 (en) | Efficient cascading of flow tables in sdn | |
| CN111709023B (en) | An application isolation method and system based on a trusted operating system | |
| US20240305670A1 (en) | Used cached summaries for efficent access analysis for cloud provider entities | |
| CN115934202A (en) | Data management method, system, data service gateway and storage medium | |
| CN117156460A (en) | Network slice processing method and device, electronic equipment and storage medium | |
| CN114915656B (en) | Method, device, storage medium and electronic device for accessing a vehicle networking terminal | |
| Zerva et al. | Towards design support for provenance awareness: A classification of provenance questions | |
| WO2021128936A1 (en) | Message processing method and apparatus | |
| CN118101342B (en) | A cluster log audit and attack behavior blocking method and system | |
| CN112381498B (en) | Power grid business processing systems, devices, equipment and storage media | |
| US20250245091A1 (en) | System and method for ai based incident impact and root cause analysis | |
| CN112328451B (en) | Service monitoring method based on scene | |
| CN105871593A (en) | Method for implementing control mechanism of reliable and controllable network | |
| CN119090297A (en) | Event source collection method, device, electronic device and readable storage medium | |
| WO2019214374A1 (en) | Data processing method, terminal, and computer readable storage medium | |
| CN120301838A (en) | A service flow mapping method, device, electronic device and storage medium | |
| CN117938936A (en) | A method, system, computing device and medium for identifying tenant identification | 
| Date | Code | Title | Description | 
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee | Granted publication date:20221118 | |
| CF01 | Termination of patent right due to non-payment of annual fee |