Method for realizing business gateway service interface arrangement

By introducing the interface orchestration module of business gateway services into the microservice architecture, analyzing and aggregating request and response information, the problem of poor flexibility of microservice architecture in the existing technology is solved, and more efficient business implementation is achieved and development costs are reduced.

CN119094619APending Publication Date: 2024-12-06CCTV INT NETWORK WUXI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411351224.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The existing microservice architecture has poor flexibility and scalability when expanding business, resulting in low development efficiency and risks brought about by code adjustment. The existing service gateway service does not support interface orchestration functions and cannot effectively respond to business changes.

Method used

By introducing interface orchestration modules into the business gateway service, preparing orchestration configuration information, developing orchestration rule analysis programs, parsing in-registering and registering center communications, forwarding requests to basic domain services, aggregating response information, realizing custom service interface orchestration functions, reducing the Business aggregation layer.

Benefits of technology

It reduces development costs and server costs, shortens business implementation cycle, improves system flexibility and scalability, and reduces the risks brought by code adjustment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094619A_ABST
    Figure CN119094619A_ABST
Patent Text Reader

Abstract

The invention relates to a method for realizing business gateway service interface arrangement. The method comprises the following steps: preparing business interface arrangement configuration information; developing an arrangement rule analysis program used for analyzing the defined arrangement rule, analyzing deployment information, an IP and a port of an incoming parameter and registration center communication acquisition service, forwarding a request to a specified basic domain service according to the arrangement rule, and carrying out aggregation and recombination on responses returned in a plurality of steps according to the arrangement rule; taking the development program as a plug-in of a business gateway service, loading the development program into the gateway service, and then deploying the gateway service; and synchronizing the defined arrangement rule to an arrangement module of the gateway service, and caching the defined arrangement rule in a local memory for identifying a specific URL (Uniform Resource Locator) so as to realize a custom service interface arrangement function. The method has the advantages that an intermediate business aggregation layer is removed, the program development cost and the server cost can be reduced, and in the project business development process, only the service interface arrangement rule needs to be configured, the period can be shortened, and business landing can be accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for realizing service gateway service interface arrangement, belonging to the technical field of microservices. Background Art

[0002] As the complexity of software systems increases day by day, the original ALL-IN-ONE technical architecture can no longer meet actual needs. Robustness, scalability, maintainability, etc. have all been challenged. In order to meet actual needs, the microservice architecture has gradually been accepted by everyone.

[0003] In a large system, there will be many microservices that collaborate and communicate with each other to meet complex business scenarios. In actual implementation, it will be divided into subsystems according to different business areas. Each subsystem will contain a series of independent microservices, including an independent storage database.

[0004] Common microservice architectures such as Figure 1 As shown in the figure, common clients include App, H5, WEB, etc., which access the following business aggregation service through the gateway service. In a complex system, the information accessed by users in most cases cannot belong to only one field, but is the aggregation of information in multiple fields. For example, the billboard page of a large TV screen needs to access user information, menu information, video information, etc., which requires the aggregation of three independent domain modules of the underlying user domain, menu domain, and video domain, and returns them to the front end through the business aggregation service. Here, the gateway service only acts as a traffic entrance and request routing, and has other authentication functions. Currently, the commonly used business gateway services are Zuul and SpringCloudGateway, both of which can meet a common gateway function. All these microservices manage services through the registration center to achieve dynamic registration and discovery, thereby achieving the expansion and reduction of microservices.

[0005] As the business expands, the flexibility and scalability of the existing microservice architecture system will be poor. Because in actual projects, the business changes at any time and iterates continuously, high cohesion is an important idea in software, and the high cohesion of the underlying domain can be guaranteed. For example, in the user domain, menu domain, and video domain, the relevant domain capabilities can be cohesive in their respective domains and not scattered outside, and the capabilities are provided to the outside through standard interfaces to ensure the stability of the business. However, it is impossible to control the changes in the upper-level business, so it is necessary to add a business aggregation layer to shield such changes. In the aggregation service, the business logic is developed according to the addition or adjustment of the business. The core function of the business aggregation layer is to call the underlying basic domain services according to the business needs of the upper layer, perform simple aggregation of information, and then assemble it into a DTO object and return it to the front end. The above development model will lead to low efficiency, poor flexibility, and limited business development. At the same time, the continuous addition and adjustment of code will also introduce new risk factors.

[0006] To solve the above problems, under the premise of ensuring that the underlying domain functions remain unchanged, if the input of business requests and the output of responses can be controlled through parameter configuration, there is no need to manually develop business aggregation code, which will greatly reduce the workload and reduce the risk of code introduction. Based on this idea, consider transforming the business gateway service. In the prior art, open source business gateway services basically support service routing, and generally implement functions such as request authentication and current limiting through slightly integrated extensions, but basically do not support the orchestration function of business interfaces. Summary of the invention

[0007] The present invention proposes a method for implementing service gateway service interface arrangement, which aims to overcome the above-mentioned deficiencies in the prior art, reduce cost investment, and shorten cycle time.

[0008] The technical solution of the present invention: a method for implementing the service gateway service interface arrangement, comprising the following steps: Step S1: Prepare the service interface orchestration configuration information; Step S2: Develop an orchestration rule parser for parsing the orchestration rules defined in step S1, parse the input parameters, communicate with the registration center to obtain the deployment information, IP and port of the service, forward the request to the specified basic domain service according to the orchestration rules, and aggregate and reorganize the responses returned in multiple steps according to the orchestration rules; Step S3: Load the orchestration rule parser developed in step S2 into the gateway service as a plug-in of the business gateway service, and then deploy the gateway service; Step S4: Synchronize the orchestration rules defined in step S1 to the orchestration module of the gateway service and cache them in the local memory for identifying the specific URL to implement the customized service interface orchestration function.

[0009] The advantages of the present invention are: 1) the intermediate business aggregation layer is removed, which can reduce the program development cost and server cost; 2) During the project business development process, you only need to configure the service interface orchestration rules, which can shorten the cycle and speed up business implementation. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 It is a schematic diagram of an embodiment of a prior art microservice architecture.

[0011] Figure 2 It is a schematic diagram of an embodiment of the overall architecture of the present invention for implementing service interface data orchestration and reconstruction through orchestration configuration.

[0012] Figure 3 It is a schematic diagram of an embodiment of the service orchestration module architecture of the present invention. DETAILED DESCRIPTION

[0013] The present invention is further described in detail below with reference to examples and specific implementation methods.

[0014] The logic of orchestration and reconstruction of service interface data implemented through orchestration configuration can be roughly divided into three steps: 1) Parse the input parameters of the request and call the underlying domain services according to steps and rules.

[0015] 2) After the underlying domain service returns the result, the result is parsed and then aggregated.

[0016] 3) Return to the front end.

[0017] The overall architecture is as follows Figure 2 As shown in the figure, by introducing the service orchestration module in the gateway service and removing the business aggregation service, the business request passes through the traffic entrance of the business gateway service, passes through the service orchestration module, and directly calls the underlying basic domain service, reducing the length of the service link. The returned response information is then aggregated and reconstructed and returned to the front end.

[0018] Specifically, it includes four role services: orchestration configuration service, gateway service orchestration, registration center service, and business service (user service, menu service, video service). Figure 3 As shown, an orchestration configuration service is added to manage and synchronize the orchestration configuration of the gateway service interface.

[0019] Then the request enters the gateway service, and the pre-configured orchestration configuration information is used to parse and disassemble the request input parameters, and then use them as input parameters for calling the underlying domain services. Through the registration center, we can know that the user service (user-service) is deployed on the 198.162.10.1 server, the menu service (menu-service) is deployed on the 198.162.10.2 server, and the video service (video-service) is deployed on the 198.162.10.3 server. Through the pre-configured service name and the information provided by the registration center, step 1, step 2, and step 3 can be organized to automatically call the user service, menu service, and video service respectively. The returned results are aggregated and reorganized through the pre-configured configuration information, so as to return the correct format to the front end. Example

[0020] Assume that the scenario is a video playback platform, including a user center, menu system, video system, etc. The framework uses the SpringBoot and SpringCloud microservice architecture. This method is only for business query scenarios. Specific steps of the complete development process are described in detail.

[0021] If there is a large screen for video playback, it is necessary to display user information, video menu information, video program posters and introduction information. The unified URL for front-end access is: / video / v1 / big-screen, The URL for calling the user service (user-service) to query user information is: / user / v1 / user-info, The URL for calling menu service (menu-service) to query menu information is: / menu / v1 / menu-list, The URL for calling the video service (video-service) to query video program information is: / video / v1 / video-list.

[0022] The process steps are as follows: Step S1: Prepare a business interface orchestration configuration information as shown below: { "path": " / video / v1 / big-screen", "method": "POST", "upstream": { "steps": [ { "id": "step1", "path": " / user / v1 / user-info", "method": "GET", "target": "user-service", "request": { "type": "json", "mappings": { "userId": "${reqJson}.userId" } }, "protocol": "http", "nextSteps": [ "step2" ] }, { "id": "step2", "path": " / menu / v1 / menu-list", "method": "POST", "target": "menu-service", "protocol": "http", "request": { "type": "json", "mappings": { "userId": "${reqJson}.userId", "provinceId": "${step1#resp}.user.province.id", "roleId": "${step1#resp}.user.role.id" } }, "nextSteps": [ "step3" ] }, { "id": "step3", "path": " / video / v1 / video-list", "method": "GET", "target": "video-service", "request": { "type": "json", "paramMappings": { "userId": "${reqJson}.userId", "proviceId": "${step1#resp}.user.province.id", "roleId": "${step1#resp}.user.role.id" } }, "protocol": "http" } ], "response": { "type": "json", "mappings": { "code": "${httpStatus}", "data": { "userInfo": "${step1#resp}.user", "menuList": "${step2#resp}.data", "videoList": "${step3#resp}.data" }, "message": "${errorMsg}" } } } Rule syntax description: path: request path method: the HTTP method of the request, such as GET, POST, PUT, etc. upstream.steps: the step array of the business interface API orchestration upstream.steps[].id: custom unique identifier upstream.steps[].protocol: communication protocol upstream.steps[].path: the path to call the subservice upstream.steps[].target: the service name to be called upstream.steps[].request: request format upstream.response: The format of the response.

[0023] Field mapping instructions: ${reqJson}: Get the value of the request json ${step1#resp}: indicates the value of the response returned by the step with id step1 ${reqParam}: Get the param parameter of the request ${httpStatus}: Get the http status code returned by the backend service. In API orchestration, multiple backend services will be called to return multiple status codes. If all backend services return 200, this value will also be 200. If there is an abnormal status code in the backend service, the abnormal status code will be taken. ${errorMsg}: exception information, which will be the body information when the backend service returns a non-200 status code.

[0024] The arrangement rules can be defined according to habits or situations, as long as they can be recognized by the main programs.

[0025] Step S2: Develop an orchestration rule parser to parse the orchestration rules defined in S1, so that it can parse the input parameters, communicate with the registration center to obtain the deployment information, IP and port of the service, and forward the request to the specified basic domain service according to the orchestration rules. It can also aggregate and reorganize the responses returned in multiple steps according to the orchestration rules.

[0026] Step S3: Load the program for parsing orchestration rules developed in S2 into the gateway service as a plug-in for the business gateway service, and then deploy the gateway service.

[0027] Step S4: Synchronize the orchestration rules defined in step S1 to the orchestration module of the gateway service and cache them in the local memory, so that the specific URL can be identified and the customized service interface orchestration function can be implemented.

[0028] It should be noted that 1) The service interface orchestration rule definition should be accurate and syntactically correct. It needs to be verified in a test or grayscale environment before production to avoid synchronization with production and causing production failures.

[0029] 2) As the business progresses and iterates, there will be more and more orchestration rules. It is impossible to manage these rules by humans alone, so it is best to create an operations background to manage all service interface orchestration rule information and do a good job of permission management.

[0030] 3) Because the service orchestration function is added to the business gateway service, the resources and performance of the gateway service will be depleted. It is necessary to estimate the server resource situation in advance and do a good job of monitoring and expansion.

[0031] The above is only a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several modifications and improvements without departing from the inventive concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. Method for implementing business gateway service interface orchestration, It is characterized in that The following steps are involved: Step S1: Prepare the service interface orchestration configuration information; Step S2: Develop an orchestration rule parser for parsing the orchestration rules defined in step S1, parse the input parameters, communicate with the registration center to obtain the deployment information, IP and port of the service, forward the request to the specified basic domain service according to the orchestration rules, and aggregate and reorganize the responses returned in multiple steps according to the orchestration rules; Step S3: Load the orchestration rule parser developed in step S2 into the gateway service as a plug-in of the business gateway service, and then deploy the gateway service; Step S4: Synchronize the orchestration rules defined in step S1 to the orchestration module of the gateway service and cache them in the local memory for identifying the specific URL to implement the customized service interface orchestration function.