Unified aggregation analysis method, device and equipment for micro-service gateway and medium
By identifying and unified configuration of microservice identification, generating interface documents and aggregating, the problem of insufficient flexibility in microservice analysis technology is solved, flexible service combination and security management is realized, system maintenance is simplified, and system performance and security are improved.
Patent Information
- Application Number
- CN202510620585.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-14
- Publication Date
- 2025-07-18
AI Technical Summary
The existing microservice analysis technology has poor flexibility during aggregation, resulting in inconsistent interfaces, cumbersome maintenance, degraded system performance, and inability to flexibly manage dependencies, affecting the normal operation of microservices.
By identifying the microservice identifier, unified parameter configuration, generating interface documents, aggregating them according to the interface documents, calling the interface according to the caller's permissions, and verifying the interfaces, achieving flexible combination and security management of microservices.
It improves the flexibility of microservice aggregation analysis, simplifies system maintenance, reduces maintenance costs, and ensures the safety and reliability of downstream services.
Smart Images

Figure CN120343084A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of microservice architecture, and in particular, to a unified aggregation analysis method, device, equipment and medium for a microservice gateway. Background Art
[0002] With the development and wide application of Internet technology, as an agile, flexible and scalable software architecture, the microservice architecture has gradually been applied to various fields. With the continuous growth of business, the number of services in the distributed system is becoming increasingly large and independent, and the scale of interfaces provided externally is also increasing.
[0003] For example, in the field of medical and health, medical data comes from multiple different systems and devices, such as electronic medical record systems, inspection systems, imaging systems, etc., and the data formats and update frequencies of the systems are different. When the microservice gateway aggregates this data, data consistency problems may occur, resulting in the patient information in the inspection system not being updated in a timely manner.
[0004] For example, in the field of fintech business, there are complex dependencies between microservices in fintech business. If the microservice gateway cannot flexibly manage and coordinate the dependencies, the failure or upgrade of a microservice may affect the normal operation of other related microservices.
[0005] Existing microservice analysis technologies mainly involve that different microservices usually have their own independent interfaces. When the interfaces need to be exposed to external associated parties for invocation, it is necessary to manually maintain the interfaces of each microservice, write interface documents, interface signatures, interface authentication, etc., which is very cumbersome to maintain. Moreover, due to the non-uniform interfaces, services cannot be flexibly aggregated, resulting in problems such as a decline in the overall performance of the system and code redundancy, thus having poor flexibility in microservice aggregation. Summary of the Invention
[0006] The present invention provides a unified aggregation analysis method, device, equipment and medium for a microservice gateway to solve the technical problem of poor flexibility in microservice aggregation.
[0007] In a first aspect, a unified aggregation analysis method for a microservice gateway is provided, including:
[0008] Obtaining microservice identifiers in different business fields, identifying service interfaces corresponding to the microservice identifiers, and performing unified parameter configuration on the service interfaces;
[0009] Publishing the service interfaces with unified parameter configuration to a preset interface platform, and generating an interface document corresponding to the service interfaces according to the interface platform;
[0010] Aggregate the service interfaces according to the interface document to obtain business aggregation interfaces in different business domains;
[0011] Apply for permission to call the business aggregation interfaces in the interface document according to the business interfaces of the calling party, and extract the target requirement interfaces in the business aggregation interfaces according to the target business domain of the calling party;
[0012] Aggregate the target requirement interfaces to obtain a target requirement aggregation interface, and verify the target requirement aggregation interface;
[0013] Call the microservices corresponding to the target business domain through the target requirement aggregation interface that has passed the verification.
[0014] In a second aspect, a microservice gateway unified aggregation analysis device is provided, including:
[0015] A parameter configuration module, configured to obtain microservice identifiers in different business domains, identify the service interfaces corresponding to the microservice identifiers, and perform unified parameter configuration on the service interfaces;
[0016] An interface document generation module, configured to publish the service interfaces with unified parameter configuration to a preset interface platform, and generate an interface document corresponding to the service interfaces according to the interface platform;
[0017] A domain interface aggregation module, configured to aggregate the service interfaces according to the interface document to obtain business aggregation interfaces in different business domains;
[0018] A requirement interface aggregation module, configured to apply for permission to call the business aggregation interfaces in the interface document according to the business interfaces of the calling party, and extract the target requirement interfaces in the business aggregation interfaces according to the target business domain of the calling party;
[0019] An interface verification module, configured to aggregate the target requirement interfaces to obtain a target requirement aggregation interface, and verify the target requirement aggregation interface;
[0020] A microservice call module, configured to call the microservices corresponding to the target business domain through the target requirement aggregation interface that has passed the verification.
[0021] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above microservice gateway unified aggregation analysis method are implemented.
[0022] In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above microservice gateway unified aggregation analysis method are implemented.
[0023] In the solution implemented by the above microservice gateway unified aggregation analysis method, device, equipment and medium, the microservice identifiers in different business domains can be obtained through the client, and the service interfaces corresponding to the microservice identifiers are identified, and unified parameter configuration is performed on the service interfaces; the service interfaces after unified parameter configuration are published to a preset interface platform, and interface documents corresponding to the service interfaces are generated according to the interface platform; the service interfaces are aggregated according to the interface documents to obtain business aggregation interfaces in different business domains; the business aggregation interfaces in the interface documents are called according to the business interface application permissions of the caller, and the target demand interfaces in the business aggregation interfaces are extracted according to the target business domain of the caller; the target demand interfaces are aggregated to obtain a target demand aggregation interface, and the target demand aggregation interface is verified; the microservices corresponding to the target business domain are called through the target demand aggregation interface after passing the verification. In the present invention, the gateway allows different microservice interfaces to be aggregated according to requirements, thereby providing flexible service combination capabilities; different microservice interfaces can be combined and aggregated according to actual business needs without modifying the original code implementation; through the unified management and invocation of interfaces, interface documents are uniformly generated according to templates, and interfaces are aggregated according to business domains at the same time, which also reduces the number of interfaces provided externally, simplifies the system maintenance work, and reduces the system maintenance cost; through the unified authentication of the interfaces of the caller and the unified management of the caller and interface permissions, interface theft is prevented, and the security and reliability of downstream services are ensured, thereby improving the flexibility of microservice aggregation analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings without creative efforts based on these drawings.
[0025] Figure 1 is an application environment schematic diagram of the microservice gateway unified aggregation analysis method in an embodiment of the present invention;
[0026] Figure 2 is a flowchart of the microservice gateway unified aggregation analysis method in an embodiment of the present invention;
[0027] Figure 3 is Figure 2 a schematic flowchart of a specific implementation manner of step S2 in
[0028] Figure 4 is Figure 2Schematic flowchart of a specific implementation of step S4 in the present invention;
[0029] Figure 5 Schematic diagram of the structure of a microservice gateway unified aggregation analysis device in an embodiment of the present invention;
[0030] Figure 6 Schematic diagram of the structure of a computer device in an embodiment of the present invention;
[0031] Figure 7 Another schematic diagram of the structure of a computer device in an embodiment of the present invention. Specific implementation
[0032] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0033] The microservice gateway unified aggregation analysis method provided by the embodiments of the present invention can be applied, for example, in Figure 1In the application environment, the client communicates with the server through the network. The server can obtain the microservice identifiers in different business domains through the client, identify the service interfaces corresponding to the microservice identifiers, and perform unified parameter configuration on the service interfaces; publish the service interfaces with unified parameter configuration to a preset interface platform, generate interface documents corresponding to the service interfaces according to the interface platform; aggregate the service interfaces according to the interface documents to obtain business aggregation interfaces in different business domains; call the business aggregation interfaces in the interface documents according to the business interface application permissions of the caller, and extract the target demand interfaces in the business aggregation interfaces according to the target business domain of the caller; aggregate the target demand interfaces to obtain a target demand aggregation interface, and verify the target demand aggregation interface; call the microservices corresponding to the target business domain through the target demand aggregation interface that has passed the verification. In the present invention, the gateway allows aggregating different microservice interfaces according to requirements, thereby providing flexible service combination capabilities; it can combine and aggregate different microservice interfaces according to actual business needs without modifying the original code implementation; through unified management and invocation of interfaces, generating interface documents uniformly according to templates, and aggregating interfaces according to business domains, the number of interfaces provided externally is also reduced, the system maintenance work is simplified, and the system maintenance cost is reduced; through unified authentication and authorization of the interfaces of the caller, unified management of the caller and interface permissions, preventing interface theft and ensuring the security and reliability of downstream services, thereby enhancing the flexibility of microservice aggregation analysis. Among them, the client can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers. The present invention will be described in detail below through specific embodiments.
[0034] Please refer to Figure 2 as shown in Figure 2 FIG. is a schematic flowchart of a microservice gateway unified aggregation analysis method provided by an embodiment of the present invention, including the following steps:
[0035] S1. Obtain microservice identifiers in different business domains, identify the service interfaces corresponding to the microservice identifiers, and perform unified parameter configuration on the service interfaces.
[0036] In the embodiment of the present invention, the microservices in different business domains are split into multiple small and independent microservices according to different business functions, business modules, and business processes in the business domain. Each microservice focuses on processing tasks in a specific business domain, and the microservice identifier refers to a unique identifier assigned to each microservice. The business domain includes, but is not limited to, the e-commerce business domain, the social media business domain, and the financial service business domain.
[0037] Specifically, computer statements with data scraping functions (such as Java statements, Python statements, etc.) can be used to obtain microservice identifiers in different business domains from a pre-stored storage area, where the storage area includes but is not limited to databases and blockchains.
[0038] Furthermore, in order to accurately call the functions provided by microservices, it is necessary to clearly know what the interface corresponding to each microservice is, and use the microservice identifier to accurately find its corresponding service interface, so as to achieve effective communication and collaboration between microservices.
[0039] In the embodiments of the present invention, the service interface is an abstract definition of the functions provided by microservices externally, which stipulates the way for external systems or other microservices to interact with this microservice.
[0040] In the embodiments of the present invention, identifying the service interface corresponding to the microservice identifier includes:
[0041] Identifying the service function corresponding to the microservice identifier;
[0042] Querying the interface declarations and interface annotations corresponding to all microservice interfaces in a preset microservice code library;
[0043] Querying the target required interface corresponding to the service function according to the interface declaration and the interface annotation;
[0044] Taking the target required interface as the service interface corresponding to the microservice identifier.
[0045] Specifically, each microservice has its specific functions. For example, in an e-commerce system, the product microservice may be responsible for functions such as storing, querying, and modifying product information; the order microservice is responsible for functions such as creating orders, processing payments, and updating statuses. The microservice identifier is the unique identifier of this microservice, and the specific service functions undertaken by this microservice are clarified through the identifier; while the microservice code library is the place where microservice-related codes are stored. In the code, there will be corresponding declarations for interfaces. For example, in Java, the interface declaration will define the name of the interface, method signatures, etc. The interface annotation is the explanatory text added by developers to enable other people to better understand information such as the function of the interface, parameter requirements, and return values.
[0046] Specifically, based on the service function corresponding to the microservice identifier and the declaration and annotation information of the interface, according to the description of the service function, search for the corresponding interface in the interface declaration and annotation, so as to determine the target required interface, and associate the target required interface with the microservice identifier, indicating that the target required interface is the service interface corresponding to the microservice representation. If interaction with this microservice is required, the corresponding functions can be achieved by calling this service interface.
[0047] Exemplarily, in a medical scenario, there is a patient information management microservice. The microservice is mainly responsible for functions such as storing, querying, modifying the basic information of patients, and managing the medical records of patients. For example, if it is necessary to implement functions such as querying the basic information and past medical records of a patient according to the patient ID, and updating the latest diagnosis information of the patient, relevant code of the patient information management microservice can be found in the microservice code library of the hospital information system. When the function of querying the detailed information of a patient needs to be implemented, it can be known from the interface declaration and annotation that the interface where function A is located is the target requirement interface. For example, when the medical billing microservice needs to obtain patient information for fee calculation, it can obtain relevant information by calling function A.
[0048] Furthermore, the business capabilities provided by different backend interfaces are different, and the request methods, return message formats, etc. are also different. In some scenarios, both the request and the return are in json format and do not require encryption. In some call scenarios, it is a form request and the parameters need to be encrypted for transmission. The aggregation gateway platform provides a general configuration ability to adapt to different business scenarios, and different business scenarios are configured as needed.
[0049] In the embodiments of the present invention, unified parameter configuration means configuring the parameters of different service interfaces according to the same specifications and standards.
[0050] In the embodiments of the present invention, the unified parameter configuration of the service interface includes:
[0051] Extracting the interface parameters corresponding to each service interface;
[0052] Matching the interface parameters according to the interface specifications in the preset common configuration template;
[0053] Performing parameter configuration on the matched interface parameters according to the interface specifications.
[0054] Specifically, each service interface has its specific input and output parameters. For example, in the medical scenario, the getPatientDetails interface of the service-001 microservice may have an input parameter patientId, which is used to specify the unique identifier of the patient to be queried; in the financial scenario, the transferFunds interface of the service-002 microservice may have input parameters such as fromAccount (transferring account), toAccount (receiving account), and amount (transfer amount).
[0055] Specifically, a complete and general configuration template is provided, with a built-in common configuration section. The specifications include: interface request method (form / json), whether to encrypt, whether to sign, whether token authentication is required, and the fixed json format of the returned message includes fixed error codes, error messages, format, etc. Then, the interface parameters are compared one by one with the various requirements regarding interface specifications in the common configuration template (such as request method, encryption, signing, etc.). For example, after extracting the parameters of an interface, check whether its request method conforms to the form or json format specified in the template, whether the parameters need to be encrypted, signed, and whether a token needs to be carried for authentication, etc. When it is confirmed that the interface parameters conform to all the specifications in the common configuration template, the parameters are configured accordingly. If the specification requires the interface request method to be in json format, and the parameters need to be encrypted and signed, then the parameters are encrypted and signed accordingly, and the request data is organized and sent in json format.
[0056] Furthermore, an API (Application Programming Interface) management platform is provided: To facilitate developers in managing and maintaining APIs, an API management platform is provided. This platform can implement functions such as API registration, viewing, editing, deletion, and interface permission application. At the same time, it automatically generates interface APIs according to the configured interfaces for developers to consult.
[0057] S2. Publish the service interface after unified parameter configuration to a preset interface platform, and generate an interface document corresponding to the service interface according to the interface platform.
[0058] In the embodiments of the present invention, the service interface with configured parameters is deployed to a specified operating environment so that it can be accessed and called by external systems or other clients. That is, the interface after standardized configuration is deployed to the interface platform, enabling it to be better managed and called with the help of various functions of the platform, and realizing interaction with other systems or clients, thereby providing stable and reliable interface services for the entire business system. For example, the interfaces published to the platform can be centrally managed, including registering the interfaces, registering relevant information (such as interface name, function description, parameter description, etc.), version management, etc.
[0059] Furthermore, through the unified management and invocation of interfaces, the interface documents are uniformly generated according to the template, and at the same time, interface aggregation is performed according to the business domain, which also reduces the number of interfaces provided externally, simplifies the system maintenance work, and reduces the system maintenance cost.
[0060] In the embodiments of the present invention, the interface document refers to a complete interface description document. Developers can intervene in the development according to the description in the document and make calls in the demo format, including descriptions such as the url of the interface request, the call method, input and output parameters, and common return codes.
[0061] In the embodiments of the present invention, with reference to Figure 3 as shown, generating the interface document corresponding to the service interface according to the interface platform includes:
[0062] S31. Extract the call description and interface parameters of the service interface through the interface platform;
[0063] S32. Determine the call method, return method, and protocol content of each service interface according to the call description;
[0064] S33. Generate the interface document corresponding to the service interface according to the interface parameters, the call method, the return method, and the protocol content.
[0065] Specifically, as a system for centrally managing service interfaces, the interface platform stores the detailed information of each service interface. The call description is a description of how to use the service interface, including the call method, return method, and protocol content. The call method specifies how the client should send requests to the service interface, such as methods like GET and POST. The return method includes the json format (including fixed error codes, error messages, and formats). The protocol content refers to protocol conversion, which can aggregate and return the interfaces, add public signature information to the interface message. The interface parameters are the specific data information that needs to be passed when calling the interface, including attributes such as the name of the parameter, data type, whether it is required, and value range.
[0066] Specifically, after collecting information such as interface parameters, call methods, return methods, and protocol content, the interface platform will organize this information into a document according to a certain format and specification, including interface basic information, interface parameter details, call method description, return method description, and protocol description.
[0067] Furthermore, in order to simplify the development and call process of the client and improve the development efficiency of the client, unified aggregated interfaces can be provided externally according to each business domain, reducing the management of interfaces by the callers, and selecting specific microservice interfaces in the business domain according to business functions.
[0068] S3. Aggregate the service interfaces according to the interface document to obtain business aggregated interfaces in different business domains.
[0069] In the embodiment of the present invention, the business aggregation interface refers to a new interface formed by integrating and encapsulating multiple related service interfaces in the same business field, and is provided to the client in the form of a unified aggregation interface.
[0070] In the embodiment of the present invention, the aggregating the service interfaces according to the interface documents to obtain business aggregation interfaces of different business fields includes:
[0071] Classify the service interfaces after unified parameter configuration according to the same business field;
[0072] Determine the aggregation format of the classified service interfaces according to the interface design specifications in the interface document;
[0073] The classified service interfaces are encapsulated according to the aggregation format to obtain business aggregation interfaces in different business fields.
[0074] In detail, these interfaces are classified according to different business areas. Business areas can be divided according to the company's business functions, business modules or business processes. For example, in the drug management business area, there are drug inventory query interfaces, drug procurement interfaces, drug distribution interfaces, etc.; in the account management business area, there are account opening interfaces, account information query interfaces, account funds change notification interfaces, etc.
[0075] Specifically, the interface document contains interface design specifications, which describe various attributes and requirements of the interface, including interface parameters, calling methods, return values, etc. The aggregation format is determined by the interface specification. The aggregation format specifies how to combine multiple service interfaces to form an aggregate interface. For example, in medical scenario A, the microservices included are A1, A2, and A3, and the aggregation format is / A1 / A2 / A3 / A. The classified service interfaces are encapsulated according to the aggregation format. The encapsulation process is to combine and package multiple service interfaces according to the requirements of the aggregation format to form a new interface, namely the business aggregation interface. That is, interface aggregation can reduce the interface maintenance of the requester and manage specific interfaces according to interface identifiers. The service provider can classify the interface (business field) according to the interface identifier, and manage different public business attributes in a targeted manner. Each business can manage different processing logic.
[0076] Furthermore, the API gateway allows different microservice interfaces to be aggregated according to demand, thereby providing flexible service composition capabilities. Different microservice interfaces can be combined and aggregated according to actual business needs without modifying the original code implementation.
[0077] S4. Call the business aggregation interface in the interface document according to the business interface application authority of the caller, and extract the target requirement interface in the business aggregation interface according to the target business domain of the caller.
[0078] In the embodiment of the present invention, calling the business aggregation interface means that the caller, after passing the legal authority application and verification, sends a request to the integrated interface in accordance with the method and requirements specified in the interface document to obtain business data or perform specific business operations.
[0079] In the embodiment of the present invention, referring to Figure 4 As shown, the calling of the business aggregation interface in the interface document according to the calling party's business interface application permission includes:
[0080] S41, extracting the business requirements corresponding to the business interface application authority of the caller;
[0081] S42, verifying the permission to apply for the business interface according to the business requirements;
[0082] S43: When the authority verification is passed, the business aggregation interface corresponding to the business requirement is called in the interface document according to the authority of the business interface that has passed the verification.
[0083] In detail, when the caller calls the business aggregation interface in the interface document, it needs to apply for permission to call the business interface. The business interface permission application will be applied for according to business needs. For example, in a medical scenario, a medical data analysis system (caller) submits an application for permission to the hospital's patient information business aggregation interface. The business need may be to obtain the patient's disease diagnosis history data. In some scenarios, the request return is in json format and does not need to be encrypted. In some calling scenarios, the request is form request and the parameters need to be encrypted for transmission. The aggregation gateway platform provides general configuration capabilities to adapt to different business scenarios.
[0084] Specifically, the caller's business interface application permission is verified, that is, check whether the caller's identity is legal (whether it is an authorized system or user), whether the caller has the permission to access a specific business aggregation interface, and whether the business requirement is within the scope of the caller's authorization, etc. If the caller does not have the corresponding permission, the permission verification will fail and the business aggregation interface cannot be called. When the caller's business interface application permission passes the permission verification, the business aggregation interface corresponding to the business requirement is found in the interface document and called.
[0085] Furthermore, the caller (such as a software system, application or other microservice) usually has a specific business purpose when initiating a request, such as selecting A1 and A2 as the target demand interface in the business aggregation interface / A1 / A2 / A3 / A according to the target business domain of the caller.
[0086] Exemplarily, there are many different business systems (components) in each business area. A unified external interface url will be assigned to different areas. The caller can call the interface according to the corresponding business area, and then map to the interface of the specific component according to the apiCode parameter. For example: / incubator-open-platform / outer / merchant / activity?api_code=GET_ACTLIST - - Business in the activity area - - Get the activity list; / incubator-open-platform / outer / merchant / pay?api_code=--Business in the payment area--UNFREEZE_AND_PUR_BAL - - Unfreeze and purchase the balance of Wangcai.
[0087] Furthermore, the API gateway can aggregate the API interfaces of multiple backend services according to the client's requirements and provide a single interface to the client, thereby simplifying the development and call process of the client and improving the development efficiency of the client.
[0088] S5. Aggregate the target requirement interfaces to obtain a target requirement aggregated interface, and verify the target requirement aggregated interface.
[0089] In the embodiment of the present invention, the target requirement aggregated interface refers to the aggregated interface unified after aggregating the target requirement interfaces determined based on the target business area of the caller. For example, if A1 and A2 are selected as the target requirement interfaces according to the target business area of the caller, the target requirement aggregated interface is / A1 / A2 / A.
[0090] Specifically, the step of aggregating the target requirement interfaces to obtain a target requirement aggregated interface is the same as the step of aggregating the service interfaces according to the interface document in S3 to obtain the business aggregated interfaces of different business areas, and will not be elaborated here.
[0091] Further, when an interface request is made, the aggregation gateway will perform corresponding processing (such as verifying the caller, verifying the interface, signature verification, decryption, etc.) according to the interface area and interface identifier, and distribute the interface to the corresponding business system in the background.
[0092] In the embodiment of the present invention, interface verification refers to performing a series of inspection and verification operations on the interface to ensure the availability, security, and integrity of the interface.
[0093] In the embodiment of the present invention, the verification of the target requirement aggregated interface includes:
[0094] Identify the interface identifiers of each service interface in the target requirement aggregated interface;
[0095] Verify the interface status of each service interface in the target requirement aggregation interface according to the said interface identifier;
[0096] Perform signature verification on the interface request of the target requirement aggregation interface according to the said interface identifier;
[0097] Determine the interface verification result corresponding to the target requirement aggregation interface according to the interface status and the verification result after signature verification.
[0098] Specifically, the target requirement aggregation interface is composed of multiple service interfaces, and each service interface has its unique interface identifier. For example, in a complex medical information system, there may be interfaces for querying patient information, entering medical records, managing drug inventory, etc., that is, the detailed interfaces corresponding to each interface identifier, and each interface identifier corresponds to different business service areas, and there will be many different microservice components under the business service area.
[0099] Specifically, after identifying the interface identifier of each service interface, identify the current status of each service interface according to the interface identifier. For example, in a financial transaction system, interfaces such as transfer interfaces and account query interfaces need to be in a normal running state to ensure the normal business process of the system. If the transfer interface is in a maintenance state, then when verifying the target requirement aggregation interface, the status of this interface does not meet the requirements.
[0100] Further, when the caller sends an interface request to the target requirement aggregation interface, the request will contain key information such as the identity information of the caller, the content of the requested operation, the timestamp, etc. It is possible to perform identity verification on the request interface, add information such as headers, authentication, and token users before the interface is forwarded for direct use by the microservice interface. Thus, after receiving the request, it will find the corresponding signature verification rule according to the interface identifier, and use the same signature algorithm to recalculate the signature of the request, and compare the calculated signature with the signature carried in the request. If the two are consistent, it means that the request has not been tampered with during the transmission process and is sent by a legitimate caller; if they are inconsistent, it means that the request may have problems, such as being maliciously tampered with or coming from an illegal caller, and the request will be rejected for processing, thereby ensuring the security of the interface. Then, determine the interface verification result corresponding to the target requirement aggregation interface according to the interface status and the verification result after signature verification. The interface verification result is the final conclusion obtained by comprehensively considering the interface status and the signature verification result.
[0101] S6. Invoke the microservices corresponding to the target business area through the target requirement aggregation interface that has passed the verification.
[0102] In the embodiments of the present invention, if the statuses of all service interfaces in the target aggregation interface are normal and the signature verification of the interface request also passes, then the interface verification result is successful, indicating that the target aggregation interface can normally process the requests sent by the invoker; conversely, if the status of any one service interface is abnormal or the signature verification fails, then the interface verification result is failed.
[0103] Specifically, when the interface verification result is verification passed, a request is sent to the target aggregation interface to trigger it to execute the corresponding function, thereby invoking the microservices corresponding to the target business domain. For example, in the order processing business domain, there are microservices such as order generation microservice, order payment microservice, and order logistics tracking microservice. When the target aggregation interface passes the verification, it will invoke the corresponding microservices according to the requirements of the target business domain. For example, when the target aggregation interface for order processing is invoked, the order generation microservice is invoked to create a new order, the order payment microservice is invoked to process the payment process, and the order logistics tracking microservice is invoked to obtain the logistics status information of the order, etc.
[0104] It can be seen that in the above solution, the gateway allows aggregating different microservice interfaces according to requirements, thus providing flexible service combination capabilities; different microservice interfaces can be combined and aggregated according to actual business needs without modifying the original code implementation; through the unified management and invocation of interfaces, the interface documents are uniformly generated according to templates, and at the same time, interface aggregation is performed according to business domains, which also reduces the number of interfaces provided externally, simplifies the system maintenance work, and reduces the system maintenance cost; through the unified authentication and authorization of the interfaces of the invoker, the invoker and interface permissions are uniformly managed, preventing interface theft and ensuring the security and reliability of downstream services, thereby enhancing the flexibility of microservice aggregation analysis.
[0105] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution is prior or posterior. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0106] In one embodiment, a microservice gateway unified aggregation analysis device is provided, and this microservice gateway unified aggregation analysis device corresponds one-to-one with the microservice gateway unified aggregation analysis method in the above embodiment. As Figure 5 shown, this microservice gateway unified aggregation analysis device includes a parameter configuration module 101, an interface document generation module 102, a domain interface aggregation module 103, a demand interface aggregation module 104, an interface verification module 105, and a microservice invocation module 106. The detailed descriptions of each functional module are as follows:
[0107] A parameter configuration module 101, configured to obtain microservice identifiers in different business domains, identify service interfaces corresponding to the microservice identifiers, and perform unified parameter configuration on the service interfaces;
[0108] An interface document generation module 102, configured to publish the service interfaces after unified parameter configuration to a preset interface platform, and generate interface documents corresponding to the service interfaces according to the interface platform;
[0109] A domain interface aggregation module 103, configured to aggregate the service interfaces according to the interface documents to obtain business aggregation interfaces in different business domains;
[0110] A requirements interface aggregation module 104, configured to call the business aggregation interfaces in the interface documents according to the business interface application permissions of the caller, and extract target requirements interfaces from the business aggregation interfaces according to the target business domain of the caller;
[0111] An interface verification module 105, configured to aggregate the target requirements interfaces to obtain a target requirements aggregation interface, and verify the target requirements aggregation interface;
[0112] A microservice call module 106, configured to call the microservices corresponding to the target business domain through the target requirements aggregation interface after passing the verification.
[0113] In one embodiment, when the parameter configuration module 101 executes to identify the service interfaces corresponding to the microservice identifiers, it is configured to:
[0114] Identify the service functions corresponding to the microservice identifiers;
[0115] Query the interface declarations and interface comments corresponding to all microservice interfaces in a preset microservice code library;
[0116] Query the target requirements interfaces corresponding to the service functions according to the interface declarations and the interface comments;
[0117] Use the target requirements interfaces as the service interfaces corresponding to the microservice identifiers.
[0118] In one embodiment, when the parameter configuration module 101 executes to perform unified parameter configuration on the service interfaces, it is further configured to:
[0119] Extract the interface parameters corresponding to each service interface;
[0120] Match the interface parameters according to the interface specifications in a preset common configuration template;
[0121] Perform parameter configuration on the matched interface parameters according to the interface specifications.
[0122] In one embodiment, when the interface document generation module 102 executes to generate the interface document corresponding to the service interface according to the interface platform, it is used for:
[0123] Extract the call description and interface parameters of the service interface through the interface platform;
[0124] Determine the call method, return method, and protocol content of each service interface according to the call description;
[0125] Generate the interface document corresponding to the service interface according to the interface parameters, the call method, the return method, and the protocol content.
[0126] In one embodiment, when the domain interface aggregation module 103 aggregates the service interfaces according to the interface document to obtain the business aggregation interfaces of different business domains, it is used for:
[0127] Classify the service interfaces with unified parameter configuration according to the same business domain;
[0128] Determine the aggregation format of the classified service interfaces according to the interface design specifications in the interface document;
[0129] Package the classified service interfaces according to the aggregation format to obtain the business aggregation interfaces of different business domains.
[0130] In one embodiment, when the requirement interface aggregation module 104 invokes the business aggregation interface in the interface document according to the business interface application permission of the caller, it is used for:
[0131] Extract the business requirements corresponding to the business interface application permission of the caller;
[0132] Perform permission verification on the business interface application permission according to the business requirements;
[0133] When the permission verification passes, invoke the business aggregation interface corresponding to the business requirements in the interface document according to the verified business interface application permission.
[0134] In one embodiment, when the interface verification module 105 performs interface verification on the target requirement aggregation interface, it is used for:
[0135] Identify the interface identifiers of each service interface in the target requirement aggregation interface;
[0136] Verify the interface status of each service interface in the target requirement aggregation interface according to the interface identifier;
[0137] Perform signature verification on the interface requests of the target requirement aggregation interface according to the interface identifier;
[0138] Determine the interface verification result corresponding to the target requirement aggregation interface according to the interface status and the verification result after signature verification.
[0139] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 6 shown. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, it realizes the functions or steps on the server side of a microservice gateway unified aggregation analysis method.
[0140] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as Figure 7 shown. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it realizes the functions or steps on the client side of a microservice gateway unified aggregation analysis method
[0141] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0142] Obtain microservice identifiers in different business domains, identify service interfaces corresponding to the microservice identifiers, and perform unified parameter configuration on the service interfaces;
[0143] Publish the service interfaces with unified parameter configuration to a preset interface platform, and generate interface documents corresponding to the service interfaces according to the interface platform;
[0144] Aggregate the service interfaces according to the interface documents to obtain business aggregation interfaces in different business domains;
[0145] Apply for permission to call the business aggregation interface in the interface document according to the business interface of the caller, and extract the target requirement interface in the business aggregation interface according to the target business field of the caller;
[0146] Aggregate the target requirement interfaces to obtain a target requirement aggregation interface, and verify the target requirement aggregation interface;
[0147] Call the microservice corresponding to the target business field through the target requirement aggregation interface that has passed the verification.
[0148] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0149] Obtain the microservice identifiers under different business fields, identify the service interfaces corresponding to the microservice identifiers, and perform unified parameter configuration on the service interfaces;
[0150] Publish the service interfaces with unified parameter configuration to a preset interface platform, and generate an interface document corresponding to the service interfaces according to the interface platform;
[0151] Aggregate the service interfaces according to the interface document to obtain business aggregation interfaces for different business fields;
[0152] Apply for permission to call the business aggregation interface in the interface document according to the business interface of the caller, and extract the target requirement interface in the business aggregation interface according to the target business field of the caller;
[0153] Aggregate the target requirement interfaces to obtain a target requirement aggregation interface, and verify the target requirement aggregation interface;
[0154] Call the microservice corresponding to the target business field through the target requirement aggregation interface that has passed the verification.
[0155] It should be noted that the functions or steps that the above computer-readable storage medium or computer device can implement can be correspondingly referred to the relevant descriptions on the server side and the client side in the foregoing method embodiments. To avoid repetition, they will not be described in detail here.
[0156] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0157] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the above-mentioned division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0158] It should be noted that if non-company software tools or components appear in the embodiments of the present application, they are only used for example introduction and do not represent actual use.
[0159] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A unified aggregation analysis method for a microservice gateway, characterized in that, Including: Obtain microservice identifiers under different business domains, identify the service interfaces corresponding to the microservice identifiers, and perform unified parameter configuration on the service interfaces; Publish the service interfaces with unified parameter configuration to a preset interface platform, and generate interface documents corresponding to the service interfaces according to the interface platform; Aggregate the service interfaces according to the interface documents to obtain business aggregation interfaces for different business domains; Call the business aggregation interfaces in the interface documents according to the business interface application permissions of the caller, and extract the target requirement interfaces in the business aggregation interfaces according to the target business domain of the caller; Aggregate the target requirement interfaces to obtain a target requirement aggregation interface, and verify the target requirement aggregation interface; Call the microservices corresponding to the target business domain through the target requirement aggregation interface passed the verification.
2. The unified aggregation analysis method of the microservice gateway according to claim 1, characterized in that The identifying the service interfaces corresponding to the microservice identifiers includes: Identify the service functions corresponding to the microservice identifiers; Query the interface declarations and interface comments corresponding to all microservice interfaces in a preset microservice code library; Query the target requirement interfaces corresponding to the service functions according to the interface declarations and the interface comments; Use the target requirement interfaces as the service interfaces corresponding to the microservice identifiers.
3. The unified aggregation analysis method of the microservice gateway according to claim 1, wherein The performing unified parameter configuration on the service interfaces includes: Extract the interface parameters corresponding to each service interface; Match the interface parameters according to the interface specifications in a preset common configuration template; Perform parameter configuration on the matched interface parameters according to the interface specifications.
4. The unified aggregation analysis method of the microservice gateway according to claim 1, wherein, The generating the interface documents corresponding to the service interfaces according to the interface platform includes: Extract the call instructions and interface parameters of the service interfaces through the interface platform; Determine the call method, return method, and protocol content of each service interface according to the call instructions; Generate the interface documents corresponding to the service interfaces according to the interface parameters, the call method, the return method, and the protocol content.
5. The unified aggregation analysis method for the microservice gateway according to claim 1, wherein The aggregating the service interfaces according to the interface documents to obtain business aggregation interfaces for different business domains includes: Classify the service interfaces with unified parameter configuration according to the same business domain; Determine the aggregation format of the classified service interfaces according to the interface design specifications in the interface documents; Package the classified service interfaces according to the aggregation format to obtain business aggregation interfaces for different business domains.
6. The unified aggregation analysis method for the microservice gateway according to claim 1, characterized in that, The calling calling business aggregation interfaces in the interface documents according to the business interface application permissions of the caller includes: Extract the business requirements corresponding to the business interface application permissions of the caller; Perform permission verification on the business interface application permissions according to the business requirements; When the permission verification passes, call the business aggregation interfaces corresponding to the business requirements in the interface documents according to the verified business interface application permissions.
7. The unified aggregation analysis method of the microservice gateway according to claim 1, wherein The verifying the target requirement aggregation interface includes: Identify the interface identifiers of each service interface in the target requirement aggregation interface; Verify the interface status of each service interface in the target requirement aggregation interface according to the interface identifiers. Perform signature verification on the interface request of the target requirement aggregation interface according to the said interface identifier; Determine the interface verification result corresponding to the target requirement aggregation interface according to the interface status and the verification result after signature verification.
8. A unified aggregation analysis device for a microservice gateway, characterized in that, Including: A parameter configuration module, configured to obtain microservice identifiers in different business domains, identify service interfaces corresponding to the microservice identifiers, and perform unified parameter configuration on the service interfaces; An interface document generation module, configured to publish the service interfaces with unified parameter configuration to a preset interface platform, and generate interface documents corresponding to the service interfaces according to the interface platform; A domain interface aggregation module, configured to aggregate the service interfaces according to the interface documents to obtain business aggregation interfaces in different business domains; A requirement interface aggregation module, configured to call the business aggregation interfaces in the interface documents according to the business interface application permission of the caller, and extract target requirement interfaces in the business aggregation interfaces according to the target business domain of the caller; An interface verification module, configured to aggregate the target requirement interfaces to obtain a target requirement aggregation interface, and verify the target requirement aggregation interface; A microservice call module, configured to call the microservice corresponding to the target business domain through the target requirement aggregation interface after passing the verification.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the microservice gateway unified aggregation analysis method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the microservice gateway unified aggregation analysis method according to any one of claims 1 to 7.
Citation Information
Cited By
De-trust and de-dependency intelligent service implementation method
CN121098624A