A method, device, equipment and medium for monitoring and managing a three-party interface request

By identifying target interfaces and performing dynamic proxying, combined with circuit breaking and degradation strategies, the problem of lack of supervision of third-party interface calls is solved, achieving efficient monitoring and management of third-party interfaces and improving the stability and reliability of the system.

CN119728663BActive Publication Date: 2025-10-17E-SURFING DIGITAL LIFE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411869356.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-10-17
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

The lack of an effective monitoring mechanism for third-party interface calls in existing technologies results in a lack of unified calling patterns and fault tolerance for third-party interface calls, making it difficult to monitor and manage third-party interfaces.

Method used

By identifying the target interface, performing dynamic proxying based on preset annotation information, creating a local proxy instance, and combining circuit breaker and degradation strategies, request parameters are generated to achieve monitoring and management of third-party interfaces.

Benefits of technology

It enables effective monitoring and management of third-party interface calls, improves the system's interoperability and collaborative capabilities, provides detailed monitoring data to understand the system's operating status and performance, and enables timely detection and resolution of problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728663B_ABST
    Figure CN119728663B_ABST
Patent Text Reader

Abstract

The application discloses a kind of three-party interface request monitoring and management method, device, equipment and medium, the application is identified target interface from target item by responding to the start information of target item;Target interface is defined based on preset annotation information;Based on target interface, create the local proxy instance of target interface by dynamic proxy;In response to the HTTP request of the method of calling target interface, target component instance is constructed;In response to HTTP request, generate request input parameter based on preset HTTP request template;Request input parameter is transmitted to target client, so that target client executes HTTP request based on request input parameter and generates response output parameter.The application can effectively monitor and manage the state and performance of three-party interface call, and can realize the supervision and fault-tolerant processing of three-party interface call, and can be widely applied in data processing technical field.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and in particular to a three-party interface request monitoring and management method, device, equipment and medium. BACKGROUND

[0002] In modern computer networks and software engineering, with the increasing complexity and frequency of interaction between systems, interface calling has become a key technical link. Interface calling allows different systems or modules to communicate and cooperate with each other to achieve specific functions and services. However, in practical applications, the complexity, unpredictability and instability of interface calling make it a difficult point in system design and development.

[0003] In the prior art, there are perfect technical implementation schemes in the process of internal system and two-party interface calling. However, there is a lack of effective supervision mechanism in the three-party interface calling of different companies. The existing three-party interface calling technology uses HTTP protocol, and developers usually encapsulate HTTP calling tool classes to realize the calling of three-party interfaces, which makes the three-party calling have no unified and standardized calling mode, and cannot realize three-party interface calling supervision and fault handling. SUMMARY

[0004] The present application provides a three-party interface request monitoring and management method, device, equipment and medium, which aims to at least solve one of the technical problems in the related art. The present application embodiment can effectively realize three-party interface request monitoring and management.

[0005] In one aspect, the present application embodiment provides a three-party interface request monitoring and management method, comprising:

[0006] In response to the start information of the target project, a target interface is identified from the target project; the target interface is defined based on preset annotation information;

[0007] Based on the target interface, a local proxy instance of the target interface is created by dynamic proxying; the local proxy instance is used to complete the HTTP request to the target interface;

[0008] In response to the HTTP request calling the method of the target interface, a target component instance is constructed; the target component instance carries a fuse strategy and a degradation strategy;

[0009] In response to the HTTP request, a request input parameter is generated based on a preset HTTP request template;

[0010] The request input parameter is transmitted to the target client, so that the target client executes the HTTP request based on the request input parameter and generates a response output parameter.

[0011] Optionally, the method further comprises the following steps:

[0012] In response to the interface creation instruction, obtaining registration content information of the target three-party interface; the registration content information comprises an external company name, a request address, and a request method;

[0013] Embedding the registration content information into a preset registration configuration template to obtain a template file;

[0014] Reading the template file through a service discovery mechanism to implement interface registration, and then obtaining the target interface through definition of preset annotation information; the preset annotation information comprises a registration center address, a degradation strategy, a fuse strategy, and an opening condition of the degradation strategy, and an interface link identifier.

[0015] Optionally, the preset annotation information carries the registration center address; based on the target interface, a local proxy instance of the target interface is created, comprising the following steps:

[0016] Based on the registration center address carried in the preset annotation information of the target interface, registration center data is read and obtained;

[0017] According to the registration center data, a local proxy instance of the target interface is created by using a preset dynamic proxy mechanism.

[0018] Optionally, the preset annotation information carries a degradation strategy and an opening condition of a fuse strategy and a degradation strategy; in response to an HTTP request for calling a method of the target interface, a target component instance is constructed, comprising the following steps:

[0019] Making the HTTP request for calling the method of the target interface pass through a preset reflection mechanism interface, so that the reflection mechanism interface constructs the target component instance based on the preset annotation information.

[0020] Optionally, in response to the HTTP request, a request parameter is generated based on a preset HTTP request template, comprising the following steps:

[0021] Inputting the HTTP request into a preset request template constructor;

[0022] Generating the request parameter of the HTTP request in the request template constructor by reflection.

[0023] Optionally, the preset annotation information carries the opening condition of the fuse strategy; when the fuse strategy is in an open state, the method further comprises the following steps:

[0024] When an abnormal condition occurs in the execution of the HTTP request by the target client based on the request parameter, triggering the fuse strategy through the target component instance;

[0025] The abnormal condition comprises a request timeout, a client error, or a server error.

[0026] Optionally, the preset annotation information carries a definition condition and an opening condition of the degradation policy; after the fuse policy is triggered, the method further includes the following steps:

[0027] When the degradation policy is in an opening state and there is a pre-defined degradation method in the definition condition of the degradation policy, the degradation policy is executed by the target component instance; otherwise, an exception condition is thrown.

[0028] Optionally, the method further includes the following steps:

[0029] The response out parameter is fed back to the initiator of the HTTP request by the target client through the target component instance and the local proxy instance in turn.

[0030] In another aspect, the embodiment of the present application provides a device for monitoring and managing three-party interface requests, comprising:

[0031] A first module is configured to identify a target interface from a target project in response to start information of the target project; the target interface is defined based on preset annotation information;

[0032] A second module is configured to create a local proxy instance of the target interface based on the target interface to perform dynamic proxying; the local proxy instance is used to complete an HTTP request for the target interface;

[0033] A third module is configured to construct a target component instance in response to an HTTP request for a method of calling the target interface; the target component instance carries a fuse policy and a degradation policy;

[0034] A fourth module is configured to generate request input parameters based on a preset HTTP request template in response to the HTTP request;

[0035] A fifth module is configured to transmit the request input parameters to a target client, so that the target client executes the HTTP request based on the request input parameters and generates response output parameters.

[0036] Optionally, the device further includes:

[0037] A sixth module is configured to obtain registration content information of a target three-party interface in response to an interface creation instruction; the registration content information includes an external company name, a request address, and a request method;

[0038] A seventh module is configured to embed the registration content information into a preset registration configuration template to obtain a template file;

[0039] The eighth module is configured to read a template file to realize interface registration through a service discovery mechanism, and then obtain a target interface through definition of preset annotation information, wherein the preset annotation information includes a registration center address, a degradation strategy, a fuse strategy, an opening condition of the degradation strategy, and an interface link identifier.

[0040] Optionally, the preset annotation information carries the opening condition of the fuse strategy.

[0041] The ninth module is configured to trigger the fuse strategy through the target component instance when an abnormal condition occurs in execution of an HTTP request based on a request input parameter by the target client.

[0042] The abnormal condition includes a request timeout, a client error, or a server error.

[0043] Optionally, the preset annotation information carries a definition condition and an opening condition of the degradation strategy.

[0044] The tenth module is configured to execute the degradation strategy through the target component instance when the degradation strategy is in an open state and the predefined degradation method exists in the definition condition of the degradation strategy, or otherwise, an exception condition is thrown.

[0045] In another aspect, an electronic device is provided, which includes a processor and a memory, the memory is configured to store a program, and the processor is configured to execute the program to implement the method for monitoring and managing the three-party interface request.

[0046] In another aspect, a computer storage medium is provided, which stores a program executable by a processor, and the program executable by the processor is configured to implement the method for monitoring and managing the three-party interface request when executed by the processor.

[0047] The embodiment of the application identifies a target interface from the target item in response to the starting information of the target item; the target interface is defined based on preset annotation information; a local proxy instance of the target interface is created based on the dynamic proxy of the target interface; the local proxy instance is used to complete the HTTP request for the target interface; the target component instance is constructed in response to the HTTP request of calling the method of the target interface; the target component instance carries the fuse strategy and the degradation strategy; the request input parameter is generated based on the preset HTTP request template in response to the HTTP request; the request input parameter is transmitted to the target client, so that the target client executes the HTTP request based on the request input parameter and generates the response output parameter. The application realizes the registration of the three-party interface through the definition of the preset annotation information, and then plans the specification of the three-party interface calling mode through the local proxy instance, the target component instance and the request input parameter, so that the state and performance of the three-party interface calling can be effectively monitored and managed, and the supervision and fault handling of the three-party interface calling can be realized. BRIEF DESCRIPTION OF DRAWINGS

[0048] The accompanying drawings are included to provide a further understanding of the technical scheme of the application, and constitute a part of the specification, and are used together with the embodiments of the application to explain the technical scheme of the application, and do not constitute a limitation on the technical scheme of the application.

[0049] Figure 1 An implementation environment schematic diagram for the three-party interface request monitoring and management provided by the embodiment of the application;

[0050] Figure 2 A flow schematic diagram of the three-party interface request monitoring and management method provided by the embodiment of the application;

[0051] Figure 3 An extended flow schematic diagram of the three-party interface request monitoring and management method provided by the embodiment of the application;

[0052] Figure 4 A schematic diagram of the expanded flow of step S200 provided by the embodiment of the application;

[0053] Figure 5 A schematic diagram of the expanded flow of step S400 provided by the embodiment of the application;

[0054] Figure 6 A flow architecture schematic diagram of the interface registration provided by the embodiment of the application;

[0055] Figure 7 An application example flow schematic diagram of the three-party interface request monitoring and management method provided by the embodiment of the application;

[0056] Figure 8 An architecture schematic diagram of the client request provided by the embodiment of the application;

[0057] Figure 9 A structural schematic diagram of the device for monitoring and managing three-party interface requests provided by an embodiment of the present application is shown in the figure.

[0058] Figure 10 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0059] In order to make the objectives, technical solutions and advantages of the present application clearer and more comprehensible, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.

[0060] It should be noted that although the functional modules are divided in the system schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a manner different from the module division in the system or the order in the flowchart. The terms "first / S100", "second / S200" and the like in the specification and claims and the above drawings are used to distinguish similar objects and do not necessarily describe a specific order or sequence.

[0061] In the present application, the term "embodiment" means that the specific features, structures or characteristics described in combination with the embodiment can be included in at least one embodiment of the present application. The appearance of this phrase at various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment to other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in the present application can be combined with other embodiments.

[0062] In order to facilitate the understanding of the technical solutions of the present application, the following explains and describes the specific names of the technical features that may appear in the technical solutions of the present application:

[0063] RPC, which stands for Remote Procedure Call, is a computer communication protocol. It allows remote services to be called like local services.

[0064] HTTP, which stands for Hypertext Transfer Protocol, is an application layer protocol for distributed, collaborative and hypermedia information systems.

[0065] SPI, which stands for Service Provider Interface, is a service discovery mechanism provided by Java. It allows classes that implement specific interfaces to be dynamically loaded at runtime, and provides a flexible extension method for application programs.

[0066] ZooKeeper is a distributed, open-source distributed application coordination service, an open source implementation of Google's Chubby, an important component of Hadoop and Hbase. It is a software that provides consistent service for distributed applications, and provides functions including configuration maintenance, domain name service, distributed synchronization, group service, etc.

[0067] Redis, which stands for Remote Dictionary Server, is an open source Key-Value database written in ANSI C, supporting network, based on memory or persistent log, and providing APIs in multiple languages.

[0068] Elasticsearch, a search server, is a distributed search and analysis engine at the core of the Elastic Stack. Logstash and Beats help collect, aggregate, and enrich data and store it in Elasticsearch. Kibana enables interactive exploration, visualization, and sharing of insights into data, and manages and monitors the stack.

[0069] As shown in Figure 1 , it is an implementation environment schematic diagram provided by an embodiment of the application. Referring to Figure 1 , the implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected through wireless or wired network connection to complete data transmission and exchange.

[0070] The server 101 can be a standalone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms.

[0071] In addition, the server 101 can also be a node server in a blockchain network. The blockchain is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, and other computer technologies.

[0072] The terminal 102 can be a smartphone, tablet computer, notebook computer, desktop computer, smart speaker, smart watch, etc., but is not limited thereto. The terminal 102 and the server 101 can be directly or indirectly connected through wired or wireless communication, and the embodiments of the application do not limit this.

[0073] Exemplarily based on Figure 1 As shown in the implementation environment,

[0074] Referring to Figure 2 , Figure 2 A flowchart of the method for monitoring and managing a three-party interface request applied to a terminal is provided for the embodiments of the present application, and the execution subject of the method for monitoring and managing a three-party interface request can be any one of the computer devices (including a server or a terminal) described above. Referring to Figure 2 , the method comprises the following steps:

[0075] S100, identifying a target interface from a target project in response to start-up information of the target project;

[0076] The target interface is defined based on preset annotation information.

[0077] Exemplarily, in some specific embodiments, an interface with an @HystrixClient annotation is identified at the start-up of a project, so as to facilitate the subsequent generation of a proxy implementation of the interface. In some specific application scenarios, when an HTTP request interface is created, an @HystrixClient annotation can be added to the method in advance. The present application will execute a specified method after the service is started, and the method will scan all methods with the @HystrixClient annotation.

[0078] It should be noted that, in some embodiments, as shown in Figure 3 , the method can further comprise the following steps: T100, obtaining registration content information of the target three-party interface in response to an interface creation instruction; the registration content information comprises an external company name, a request address, and a request method; T200, embedding the registration content information into a preset registration configuration template to obtain a template file; T300, reading the template file to implement interface registration through a service discovery mechanism, and then obtaining the target interface through the definition of the preset annotation information; the preset annotation information comprises a registration center address, a degradation policy, a circuit breaking policy, an opening condition of the degradation policy, and an interface link identifier.

[0079] Exemplarily, in some specific embodiments, a three-party interface registration configuration template can be defined first, and the template contains the following contents: external company name, request address, request method, etc. Then, the template file is read based on SPI (service discovery mechanism) to implement interface registration. The registration center provides multiple technical means such as local file, zookeeper, redis, elasticsearch, etc. to achieve on-demand configuration. The @HystrixClient annotation can be further defined to implement API interface, which mainly includes:

[0080] url: registration center address;

[0081] fallbackFactory: custom fallback method, default fallback policy;

[0082] primary: whether to use the fuse degradation policy, default is to use;

[0083] traceId: define interface link identifier.

[0084] S200, based on the target interface, a local proxy instance of the target interface is created;

[0085] The local proxy instance is used to complete the HTTP request for the target interface;

[0086] It should be noted that the preset annotation information carries the registration center address; in some embodiments, as shown in Figure 4 The method can further include the following steps: S201, based on the registration center address carried in the preset annotation information of the target interface, registration center data is read and obtained; S202, according to the registration center data, a local proxy instance of the target interface is created by using the preset dynamic proxy mechanism.

[0087] Exemplarily, in some specific embodiments, the registration center data can be read according to the content carried by the annotation to create a local JDK Proxy proxy instance (i.e. local proxy instance) of the interface. Specifically, JDK Proxy dynamic proxy can be applied to identify the interface with @HystrixClient annotation at the project startup to generate a proxy implementation of the interface. It should be understood that when the interface method is called in the code, the actual HTTP request is completed by the instance of the Proxy proxy.

[0088] S300, in response to the HTTP request of calling the method of the target interface, a target component instance is constructed;

[0089] The target component instance carries the fuse policy and the degradation policy;

[0090] It should be noted that the preset annotation information carries a degradation policy and an opening condition of the degradation policy and the circuit breaking policy; in some embodiments, the step S300 can include the following steps: making the HTTP request for calling the method of the target interface pass through the preset reflection mechanism interface, so that the reflection mechanism interface constructs the target component instance based on the preset annotation information.

[0091] Exemplarily, in some specific embodiments, the HTTP request will first pass through the InvocationHandler processor (i.e., the reflection mechanism interface) and be wrapped into a HystrixCommand instance (i.e., the target component instance). Specifically, the InvocationHandler calling processor constructs the HystrixCommand instance in the Hystrix component to implement the circuit breaking and degradation of the request.

[0092] It should be noted that the InvocationHandler is an interface in the Java reflection mechanism and belongs to the java.lang.reflect package. Its main function is to provide the ability to handle method calls for dynamic proxies. When using Java dynamic proxies, the behavior of calling methods on proxy objects can be defined by implementing the InvocationHandler interface. The only method of the InvocationHandler interface is invoke, which is triggered every time a method of the proxy object is called. Additional logic such as logging, transaction management, etc. can be added here.

[0093] S400, in response to the HTTP request, generating request parameters based on a preset HTTP request template;

[0094] It should be noted that in some embodiments, as shown in Figure 5 S400 can include the following steps: S401, inputting the HTTP request into a preset request template constructor; S402, generating the request parameters of the HTTP request in the request template constructor by reflection.

[0095] Exemplarily, in some specific embodiments, the request parameters of the HTTP request can be generated in the RequestTemplate by reflection. Specifically, the RequestTemplate request template constructor processes the input and output parameters of the dynamic proxy post-processing interface to construct the request template.

[0096] It should be noted that RequestTemplate is an important component of Feign, which is used to create HTTP request templates. By using RequestTemplate, developers can easily build and send HTTP requests, enabling more flexible HTTP client development. RequestTemplate is a class in the Feign library used to build HTTP requests. Feign is a Java HTTP client development library that simplifies HTTP client development. The RequestTemplate class contains information related to HTTP requests, such as request URL, request method, request header, request body, etc., and provides rich APIs to set these information.

[0097] S500, transmit the request input parameter to the target client, so that the target client executes the HTTP request based on the request input parameter and generates the response output parameter.

[0098] Exemplarily, in some embodiments, the HTTP request is finally executed by the Client and the response (i.e., the response output parameter) is obtained. Specifically, the Client actual request code can use the OkHttp3 open source component to complete the URL request processing, while implementing the SPI mechanism to support extension.

[0099] It should be noted that the preset annotation information carries the opening condition of the circuit breaking policy; in some embodiments, when the circuit breaking policy is in an open state, the method can further include the following steps: when an abnormal condition occurs when the target client executes the HTTP request based on the request input parameter, triggering the circuit breaking policy through the target component instance; wherein the abnormal condition includes request timeout, client error or server error.

[0100] Exemplarily, in some embodiments, when the request occurs timeout or 4XX, 5XX exception, the circuit breaking measure will be triggered by HystrixCommand.

[0101] 4XX (Client Error): Generally refers to a problem with the machine sending the request (front end). 5XX (Server Error): Generally refers to a problem with the machine accepting and processing the request (back end).

[0102] It should be noted that the preset annotation information carries the definition condition and the opening condition of the degradation policy; in some embodiments, after the circuit breaking policy is triggered, the method can further include the following steps: when the degradation policy is in an open state and there is a pre-defined degradation method in the definition condition of the degradation policy, executing the degradation policy through the target component instance; otherwise, throwing an exception.

[0103] Exemplarily, in some specific embodiments, after triggering the fuse, if the fallbackFactory is defined, the degradation strategy is executed, otherwise an exception is thrown.

[0104] To explain the principle of the technical scheme of the present application, the overall process of the present application will be described below in combination with some specific embodiments. It should be easily understood that the following is an explanation of the technical principle of the present application and cannot be regarded as a limitation of the present application.

[0105] First of all, it needs to be pointed out that in order to solve the deficiency of three-party interface calling in actual scenarios and realize the supervision and fault-tolerant processing of three-party interface calling, the present application designs a zero-intrusion registration center, registers three-party interfaces through template configuration, designs an API mode calling component based on HTTP protocol, standardizes the three-party interface calling mode, can effectively monitor and manage the state and performance of three-party interface calling, realizes link reporting using Agent plug-in, realizes link tracking based on OpenTracing specification, and introduces Hystrix and sentinel components to make three-party interface calling also be able to realize fuse and degradation measures.

[0106] In order to achieve the above-mentioned purposes, the technical scheme of the present application mainly adopts the following technical means:

[0107] 1. As shown in Figure 6 , define a three-party interface registration configuration template, and the template content includes: external company name, request address, request method, etc., then read the template file based on SPI (service discovery mechanism) to realize interface registration, and the registration center provides multiple technical means such as local file, zookeeper, redis, elasticsearch, etc. to realize on-demand configuration.

[0108] 2. Through a series of encapsulation and processing, the ordinary HTTP request is defined as a remote calling API interface through the annotation method to realize the standardization of three-party interface calling.

[0109] The overall technical scheme is as shown in Figure 7 , which includes:

[0110] 1) Define @HystrixClient annotation to realize API interface, which mainly includes:

[0111] url: registration center address;

[0112] fallbackFactory: custom degradation method, default degradation strategy;

[0113] primary: whether to use fuse degradation strategy, default is to use;

[0114] traceId: define interface link identification.

[0115] 2) JDK Proxy dynamic proxy, identify the interface with @HystrixClient annotation at project startup, generate proxy implementation of the interface.

[0116] 3) InvocationHandler call processor, construct HystrixCommand instance in Hystrix component, implement request fuse and degradation;

[0117] 4) RequestTemplate request template constructor, process interface input and output parameters after dynamic proxy, construct request template;

[0118] 5) As shown in Figure 8 , the actual request code of the Client uses the OkHttp3 open source component to complete the URL request processing, and implements the SPI mechanism to support extension.

[0119] In some specific application scenarios, the overall processing flow can be implemented as follows:

[0120] First, create an HTTP request interface, and add @HystrixClient annotation on the method. The method will be executed after the service is started. The method will scan all methods with @HystrixClient annotation, read the registration center data according to the content carried by the annotation, create a local JDK Proxy proxy instance of the interface, and input these instances into the IOC(Inversion of Control, Inversion of Control) container.

[0121] When the interface method is called in the code, the actual HTTP request is completed by the Proxy proxy instance. First, the request will be processed by the InvocationHandler processor to wrap the HystrixCommand instance, then the HTTP request request parameter is generated in the RequestTemplate through reflection, and finally the HTTP request is executed by the Client and the response is obtained. When the request occurs timeout or 4XX, 5XX exception, the fuse measure is triggered by HystrixCommand, after triggering the fuse, if fallbackFactory is defined, the degradation strategy is executed, otherwise the exception is thrown.

[0122] Among them, 4XX (client error): generally refers to the problem of the machine (front end) that sends the request. 5XX (server error): generally refers to the problem of the machine (back end) that accepts and processes the request.

[0123] 3. The registration center manages visualization components, which collect data such as the requester, requested party, call protocol, duration, traceId, etc. during the data transmission process through defined annotations. After data processing, key information is extracted and stored in local files, Zookeeper, Redis, Elasticsearch, MySQL and other tools to achieve data visualization and perform operations such as viewing, modification, and active circuit breaking.

[0124] In summary, as the complexity and frequency of interactions between systems increase, interface calls have become a critical technical link. The technical solution of the present invention addresses the shortcomings of three-party interface calls in practical scenarios, enabling monitoring, circuit breaking, and degradation of three-party interface calls, thus meeting the market demand for efficient, stable, and reliable system interoperability.

[0125] Compared with the prior art, the present invention has at least the following beneficial effects:

[0126] 1) In the field of software development, this technical solution provides an API model calling component based on the HTTP protocol, standardizes the three-party interface calling model, and makes the design and development of the system simpler and more efficient.

[0127] 2) In the field of system integration, this technical solution solves the shortcomings of three-party interface calls in actual scenarios, fills the gaps in interface call modes between different companies, realizes effective monitoring and management of three-party interface calls, and improves the system's interoperability and collaborative working capabilities.

[0128] 3) In the field of network monitoring, this technical solution provides detailed monitoring data on third-party interface calls, helping enterprises better understand the operating status and performance of the system and promptly discover and resolve problems.

[0129] On the other hand, Figure 9 As shown, an embodiment of the present invention provides an apparatus 900 for monitoring and managing three-party interface requests, including:

[0130] The first module 901 is configured to identify a target interface from a target project in response to startup information of the target project; the target interface is defined based on preset annotation information;

[0131] The second module 902 is used to perform dynamic proxy based on the target interface and create a local proxy instance of the target interface; the local proxy instance is used to complete the HTTP request for the target interface;

[0132] The third module 903 is used to construct a target component instance in response to an HTTP request for calling a method of a target interface; the target component instance carries a circuit breaker strategy and a degradation strategy;

[0133] The fourth module 904 is configured to generate request input parameters based on a preset HTTP request template in response to an HTTP request.

[0134] The fifth module 905 is configured to transmit the request input parameters to a target client, so that the target client performs an HTTP request based on the request input parameters and generates response output parameters.

[0135] In some embodiments, the apparatus can further include:

[0136] The sixth module is configured to obtain registration content information of a target three-party interface in response to an interface creation instruction; the registration content information includes an external company name, a request address and a request method.

[0137] The seventh module is configured to embed the registration content information into a preset registration configuration template to obtain a template file.

[0138] The eighth module is configured to read the template file through a service discovery mechanism to implement interface registration, and further obtain a target interface through definition of preset annotation information; the preset annotation information includes a registration center address, a degradation policy, a fuse policy, an opening condition of the degradation policy and an interface link identifier.

[0139] In some embodiments, the preset annotation information carries the opening condition of the fuse policy; when the fuse policy is in an open state, the apparatus can further include:

[0140] The ninth module is configured to trigger the fuse policy through a target component instance when an abnormal condition occurs in the HTTP request performed by the target client based on the request input parameters.

[0141] The abnormal condition includes a request timeout, a client error or a server error.

[0142] In some embodiments, the preset annotation information carries a definition condition and an opening condition of the degradation policy; after the fuse policy is triggered, the apparatus can further include:

[0143] The tenth module is configured to execute the degradation policy through the target component instance when the degradation policy is in an open state and a predefined degradation method exists in the definition condition of the degradation policy; otherwise, an exception condition is thrown.

[0144] The content of the method embodiments of the application is applicable to the apparatus embodiments of the application, the apparatus embodiments of the application specifically implement the same functions as the above method embodiments, and achieve the same beneficial effects as the above method embodiments.

[0145] In another aspect, the embodiments of the present application also provide an electronic device, which comprises a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the sensitive information method. The electronic device can be any smart terminal, such as a tablet computer or a vehicle-mounted computer.

[0146] It can be understood that the contents in the above method embodiments are applicable to the device embodiments, the device embodiments specifically implement the functions of the above method embodiments, and achieve the same beneficial effects as the above method embodiments.

[0147] As shown in Figure 10 , Figure 10 a hardware structure of an electronic device 1000 in an embodiment is shown, the electronic device 1000 comprises:

[0148] The processor 1001 can be implemented in a general-purpose CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, etc., and is used to execute related programs to implement the technical solutions provided by the embodiments of the present application.

[0149] The memory 1002 can be implemented in the form of a ROM (Read Only Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory), etc. The memory 1002 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present application are implemented by software or firmware, the related program codes are stored in the memory 1002 and are called and executed by the processor 1001 to implement the network node population optimization method of the embodiments of the present application.

[0150] The input / output interface 1003 is used to realize information input and output.

[0151] The communication interface 1004 is used to realize the communication interaction between the device and other devices. The communication can be realized by a wired manner (such as a USB, a network cable, etc.) or a wireless manner (such as a mobile network, WIFI, Bluetooth, etc.).

[0152] The bus 1005 transmits information between various components (such as the processor 1001, the memory 1002, the input / output interface 1003, and the communication interface 1004) of the device.

[0153] The processor 1001, the memory 1002, the input / output interface 1003 and the communication interface 1004 are connected with each other through the bus 1005 to realize communication connection between devices inside.

[0154] The electronic device embodiments described above are only schematic, wherein the units described as separate components can or can not be physically separate, i.e., can be located in one place or can be distributed on a plurality of network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0155] The contents of the method embodiments of the present application are applicable to the electronic device embodiments, the electronic device embodiments specifically implement the functions of the above method embodiments, and the beneficial effects achieved by the electronic device embodiments are the same as the beneficial effects achieved by the above method.

[0156] Another aspect of the embodiment of the present application further provides a computer readable storage medium, the storage medium stores a program, and the program is executed by a processor to realize the above method.

[0157] It should be noted that the computer readable medium shown in the embodiments of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or component. In the present application, the computer readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer readable program code. Such a propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals or any suitable combination thereof. The computer readable signal medium can also be any computer readable medium other than the computer readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or component. The program code contained on the computer readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired or the like, or any suitable combination thereof.

[0158] The contents of the method embodiments of the present application are applicable to the computer readable storage medium embodiments of the present application. The computer readable storage medium embodiments specifically implement the same functions as the above-mentioned method embodiments, and achieve the same beneficial effects as the above-mentioned methods.

[0159] The embodiments of the present application also disclose a computer program product or computer program, which comprises computer instructions stored in a computer readable storage medium. The processor of the computer device can read the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to make the computer device execute the above method.

[0160] The computer program product of the present application can be a storage medium or a computer program product storing instructions which, when executed by one or more processors, cause the processor or processors to carry out the steps described herein. The computer program product can be embodied in one or more computer- readable media, which can be non-transitory. The computer-readable media can include computer- readable storage media, which can be tangible or in other forms. The computer-readable storage media include, but are not limited to, RAM, ROM, EEPROM, solid state drives (SSDs), flash memory, phase change memory, or any other memory technology, compact discs (CDs), digital versatile discs (DVDs), or any other optical disc storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information. Note that the computer-readable storage media can be distributed, networked, or located in whole or in part inside a computer system. The computer program product can also be loaded onto a computer and / or other programmable devices to cause a series of operations to be performed on the computer and / or other programmable devices to produce a computer-implemented process such that the instructions which execute on the computer or other programmable devices implement the functions / acts specified in the flowcharts and / or block diagram.

[0161] It should be noted that although several modules of the device for action execution are mentioned in the foregoing detailed description, such a division is not mandatory. Indeed, according to embodiments of the application, the features and functionalities of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functionalities of one module or unit described above can be further divided into a plurality of modules or units.

[0162] From the above description of the embodiments, those skilled in the art will readily perceive that the example embodiments described herein can be implemented by software and / or by hardware coupled with software. Accordingly, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, U disk, mobile hard disk, etc.) or network, and includes a number of instructions to enable a computing device (which can be a personal computer, server, touch terminal, or network device, etc.) to perform the methods according to the embodiments of the present application.

[0163] In some alternative embodiments, the functions / operations mentioned in the block diagrams can not occur in the order mentioned in the operation diagrams. For example, depending on the functions / operations involved, two blocks shown in succession can actually be executed substantially concurrently or the blocks can sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts are examples only. A person skilled in the art understands the present disclosure to extend to other structures, approaches, and flows that are equivalent in function, operation, and expression to the embodiments illustrated in the flowcharts. Alternative embodiments are contemplated where order of various operations is changed and where sub-operations of described larger operations are performed independently.

[0164] Furthermore, although the present application is described in the context of functional modules, it is to be understood that one or more of the functions and / or features of'can be integrated in a single physical device and / or software module, or one or more functions and / or features can be implemented in separate physical devices or software modules. It will also be understood that detailed discussion of the actual implementation of each module is unnecessary to an understanding of the present application. Rather, the actual implementation of the modules, in combination with their attributes, functions, and internal relationships, are to be understood within the context of the devices disclosed in the present application. Thus, those skilled in the art with access to the teachings presented herein will be able to devise variations of the application without the aid of experimentation. It is also to be understood that the particular conceptualization disclosed is illustrative only and not restrictive of the application, the scope of which is to be determined by the appended claims and equivalents thereof.

[0165] If the functions are implemented in software, the functions can be stored in or implemented as one or more software modules on a computer-readable storage medium. In terms of this understanding, the technical solutions of the present application, in essence, or the part of the technical solutions that make contributions to the prior art, or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0166] The logic and / or steps represented in the flowcharts, or otherwise described herein, for example, can be considered as a list of executable instructions for implementing logic functions, which can be specifically embodied in any computer-readable medium for use by an instruction execution device, device or equipment (such as a computer-based device, a device including a processor, or other devices that can fetch and execute instructions from an instruction execution device, device or equipment), or in conjunction with these instruction execution devices, devices or equipment. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transport programs for use by an instruction execution device, device or equipment, or in conjunction with these instruction execution devices, devices or equipment.

[0167] More specific examples (a non-exhaustive list) of the computer-readable medium include the following: an electrical connection (electronic) having one or more wires, a portable computer diskette (magnetic), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can also be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, for example, via optical scanning of the paper or other medium, then compiled, interpreted, or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.

[0168] It should be understood that aspects of the application can be implemented in hardware, software, firmware or combinations thereof. In the embodiments described above, various steps or methods can be implemented, for example, by software or firmware stored in memory and executed by a suitable instruction execution device. If implemented in hardware, for example, in another embodiment, any of the following techniques can be used in whole or in part: discrete logic circuitry having logic gates for implementing logic functions upon data signals, application specific integrated circuits having appropriate combinational logic gates, programmable gate arrays (PGA), field programmable gate arrays (FPGA), and so forth, as well as or instead of software instructions.

[0169] In the description of the specification, the description of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" and the like means that the specific feature, structure, material or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In the specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Also, the specific feature, structure, material or characteristic described can be combined in any appropriate manner in one or more embodiments or examples.

[0170] Although embodiments of the application have been shown and described, it would be recognized by those of ordinary skill in the art that various changes, modifications, substitutions, and alterations can be made hereto without departing from the spirit and scope of the application, which is defined by the following claims and their equivalents.

[0171] The above is a specific description of the preferred embodiment of the application, but the application is not limited to the embodiment, and those skilled in the art can make various equivalent modifications or replacements without departing from the spirit of the application, and these equivalent modifications or replacements are all included in the scope defined by the claims of the application.

Claims

1. A method for monitoring and managing three-party interface requests, characterized in that: The following steps are involved: identifying a target interface from the target project in response to startup information of the target project; The target interface is defined based on preset annotation information; Perform dynamic proxying based on the target interface to create a local proxy instance of the target interface; The local proxy instance is used to complete the HTTP request for the target interface; In response to the HTTP request for calling the method of the target interface, constructing and obtaining a target component instance; The target component instance carries a circuit breaker strategy and a degradation strategy; In response to the HTTP request, generating request input parameters based on a preset HTTP request template; Transmitting the request input parameters to a target client, so that the target client executes the HTTP request based on the request input parameters and generates response output parameters; The method further comprises the following steps: In response to the interface creation instruction, obtaining registration content information of the target third-party interface; the registration content information includes the name of the external company, the request address and the request method; Embedding the registration content information into a preset registration configuration template to obtain a template file; The interface registration is realized by reading the template file through the service discovery mechanism, and then the target interface is obtained through the definition of the preset annotation information; the preset annotation information includes the registration center address, the downgrade strategy, the circuit breaker strategy and the activation status of the downgrade strategy and the interface link identifier.

2. The method for monitoring and managing three-party interface requests according to claim 1, characterized in that: The preset annotation information carries the address of the registration center; and the dynamic proxy based on the target interface to create a local proxy instance of the target interface includes the following steps: Reading and obtaining registration center data based on the registration center address carried in the preset annotation information of the target interface; According to the registration center data, the local proxy instance of the target interface is created using a preset dynamic proxy mechanism.

3. The method for monitoring and managing three-party interface requests according to claim 1, wherein: The preset annotation information carries the downgrade strategy and the activation status of the circuit breaker strategy and the downgrade strategy; The step of constructing a target component instance in response to the HTTP request for calling the method of the target interface comprises the following steps: The HTTP request for calling the method of the target interface is passed through a preset reflection mechanism interface, so that the reflection mechanism interface constructs the target component instance based on the preset annotation information.

4. The method for monitoring and managing three-party interface requests according to claim 1, wherein: In response to the HTTP request, generating a request input parameter based on a preset HTTP request template includes the following steps: Input the HTTP request into a preset request template constructor; The request input parameter of the HTTP request is generated by reflection in the request template constructor.

5. The method for monitoring and managing three-party interface requests according to claim 1, characterized in that: The preset annotation information carries the activation status of the circuit breaker strategy; when the circuit breaker strategy is in the activated state, the method further includes the following steps: When an exception occurs when the target client executes the HTTP request based on the request input parameter, triggering the circuit breaker policy through the target component instance; The abnormal situation includes request timeout, client error or server error.

6. The method for monitoring and managing three-party interface requests according to claim 5, characterized in that: The preset annotation information carries the definition and activation status of the degradation policy; after the circuit breaker policy is triggered, the method further includes the following steps: When the downgrade strategy is in the enabled state and a predefined downgrade method exists in the definition of the downgrade strategy, the downgrade strategy is executed through the target component instance; otherwise, the exception is thrown.

7. A device for monitoring and managing three-party interface requests, characterized in that: include: A first module is configured to identify a target interface from the target project in response to startup information of the target project; The target interface is defined based on preset annotation information; The second module is used to perform dynamic proxy based on the target interface and create a local proxy instance of the target interface; The local proxy instance is used to complete the HTTP request for the target interface; A third module is configured to construct a target component instance in response to the HTTP request for calling the method of the target interface; The target component instance carries a circuit breaker strategy and a degradation strategy; The fourth module is used to generate a request input parameter based on a preset HTTP request template in response to the HTTP request; A fifth module is configured to transmit the request input parameters to a target client, so that the target client executes the HTTP request based on the request input parameters and generates response output parameters; Wherein, the device further includes: The sixth module is configured to obtain registration content information of the target third-party interface in response to the interface creation instruction; the registration content information includes the name of the external company, the request address, and the request method; The seventh module is used to embed the registration content information into a preset registration configuration template to obtain a template file; The eighth module is used to read the template file through the service discovery mechanism to realize interface registration, and then obtain the target interface through the definition of the preset annotation information; the preset annotation information includes the registration center address, the downgrade strategy, the circuit breaker strategy and the activation status of the downgrade strategy and the interface link identifier.

8. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 6.

9. A computer storage medium storing a program executable by a processor, characterized in that: The program executable by the processor is used to implement the method according to any one of claims 1 to 6 when executed by the processor.

Citation Information

Patent Citations

  • Interface definition-free Feign client remote calling method based on user-defined plug-in

    CN114401256A

  • Interface configuration method and device, electronic equipment and storage medium

    CN118193087A