Method, device, equipment and medium for monitoring and managing three-party interface request

By identifying and dynamically proxying target interfaces, combining fuse and downgrade strategies, the complexity and instability of tripartite interface calls are solved, and the supervision and fault-tolerant processing of interface calls are realized.

CN119728663AActive Publication Date: 2025-03-28E-SURFING DIGITAL LIFE TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The lack of effective regulatory mechanisms and fault-tolerant processing methods in the prior art has led to complex, unforeseeable and unstable calls from the three-party interface, making it difficult to achieve a unified and standardized calling mode.

Method used

By responsive to the startup information of the target project, identifying the target interface and performing dynamic proxying based on the preset annotation information, a local proxy instance is created to complete the HTTP request. In addition, the target component instance is constructed to carry the circuit breaker policy and the downgrade policy, and generate the request parameter based on the preset HTTP request template, and transmit it to the target client to execute the HTTP request.

Benefits of technology

It realizes effective monitoring and management of three-party interface requests, ensures the stability and reliability of interface calls, and has the fault-tolerant processing capabilities of circuit breaker and downgrade strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728663A_ABST
    Figure CN119728663A_ABST
Patent Text Reader

Abstract

The invention discloses a three-party interface request monitoring and management method and device, equipment and a medium, and the method comprises the steps: recognizing a target interface from a target project through responding to the starting information of the target project; the target interface is defined based on preset annotation information; performing dynamic proxy based on the target interface, and creating a local proxy instance of the target interface; in response to an HTTP request for calling a method of a target interface, constructing to obtain a target component instance; in response to the HTTP request, generating a request entry parameter based on a preset HTTP request template; and transmitting the request incoming parameter to the target client, so that the target client executes the HTTP request based on the request incoming parameter and generates a response outgoing parameter. The three-party interface calling state and performance can be effectively monitored and managed, supervision and fault-tolerant processing of three-party interface calling can be achieved, and the method can be widely applied to the technical field of data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method, device, equipment and medium for monitoring and managing three-party interface requests. Background Art

[0002] In modern computer networks and software engineering, as the complexity and frequency of interactions between systems increase, interface calls have become a key technical link. Interface calls allow different systems or modules to communicate and collaborate with each other to achieve specific functions and services. However, in practical applications, the complexity, unpredictability and instability of interface calls make them a difficult point in system design and development.

[0003] In the existing technology, there are complete technical implementation solutions for the company's internal system and two-party interface calling process. 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 the HTTP protocol. R&D personnel usually encapsulate the HTTP calling tool class to implement the three-party interface calling. This makes the three-party calling have no unified and standardized calling mode, and it is impossible to achieve three-party interface calling supervision and fault-tolerant processing. Summary of the invention

[0004] The present invention proposes a method, device, equipment and medium for monitoring and managing three-party interface requests, aiming to solve one of the technical problems in the related art at least to a certain extent. The embodiments of the present invention can effectively realize the monitoring and management of three-party interface requests.

[0005] On the one hand, an embodiment of the present invention provides a method for monitoring and managing a three-party interface request, including:

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

[0007] Based on the target interface, a dynamic proxy is performed 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;

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

[0009] In response to an HTTP request, generate request input parameters based on a preset HTTP request template;

[0010] Transmits the request input parameters to the target client so that the target client executes the HTTP request based on the request input parameters and generates response output parameters.

[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 includes the name of the external company, the request address and the request method;

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

[0014] Interface registration is achieved by reading the template file through the service discovery mechanism, and then the target interface is obtained through the definition of preset annotation information; the preset annotation information includes the registration center address, downgrade strategy, fuse strategy and the activation status of the downgrade strategy and the interface link identifier.

[0015] Optionally, the preset annotation information carries a registration center address; performing dynamic proxy based on the target interface to create a local proxy instance of the target interface includes the following steps:

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

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

[0018] Optionally, the preset annotation information carries the downgrade strategy and the activation status of the circuit breaker strategy and the downgrade strategy; in response to an HTTP request for calling a method of a target interface, constructing a target component instance includes the following steps:

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

[0020] Optionally, in response to an HTTP request, generating a request input parameter based on a preset HTTP request template includes the following steps:

[0021] Enter the HTTP request into the preset request template builder;

[0022] Generate the request input parameters of the HTTP request through reflection in the request template constructor.

[0023] Optionally, 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:

[0024] When an exception occurs when the target client executes an HTTP request based on the request input parameters, the circuit breaker policy is triggered through the target component instance;

[0025] Among them, abnormal situations include request timeout, client error or server error.

[0026] Optionally, the preset annotation information carries the definition and activation status of the downgrade strategy; after the circuit breaker strategy is triggered, the method further includes the following steps:

[0027] When the downgrade strategy is enabled and there is a predefined downgrade method in the definition of the downgrade strategy, the downgrade strategy is executed through the target component instance; otherwise, an exception is thrown.

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

[0029] The target client feeds back the response output parameters to the initiator of the HTTP request through the target component instance and the local proxy instance in sequence.

[0030] On the other hand, an embodiment of the present invention provides a device for monitoring and managing a three-party interface request, including:

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

[0032] 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;

[0033] The third module 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 fuse strategy and a degradation strategy;

[0034] The fourth module is used to generate a request input parameter based on a preset HTTP request template in response to the HTTP request;

[0035] The fifth module is used to transmit the request input parameters to the 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 comprises:

[0037] The sixth module is used to obtain the registration content information of the target three-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;

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

[0039] The eighth module is used to realize interface registration by reading the template file through the service discovery mechanism, and then obtain the target interface through the definition of preset annotation information; the preset annotation information includes the registration center address, downgrade strategy, fuse strategy and the activation status of the downgrade strategy and the interface link identifier.

[0040] Optionally, the preset annotation information carries the activation status of the fuse strategy; when the fuse strategy is in the activated state, the device further includes:

[0041] The ninth module is used to trigger the circuit breaker strategy through the target component instance when an exception occurs when the target client executes the HTTP request based on the request input parameter;

[0042] Among them, abnormal situations include request timeout, client error or server error.

[0043] Optionally, the preset annotation information carries the definition and activation status of the downgrade strategy; after the fuse strategy is triggered, the device further includes:

[0044] The tenth module is used to execute the downgrade strategy through the target component instance when the downgrade strategy is enabled and there is a predefined downgrade method in the definition of the downgrade strategy; otherwise, an exception is thrown.

[0045] On the other hand, an embodiment of the present invention provides an electronic device, including: a processor and a memory; the memory is used to store programs; the processor executes the program to implement the above-mentioned three-party interface request monitoring and management method.

[0046] On the other hand, an embodiment of the present invention provides a computer storage medium, in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to implement the above-mentioned method of monitoring and managing three-party interface requests.

[0047] The embodiment of the present invention identifies the target interface from the target project in response to the startup information of the target project; the target interface is defined based on the preset annotation information; a local proxy instance of the target interface is created based on the target interface for dynamic proxy; the local proxy instance is used to complete the HTTP request for the target interface; a target component instance is constructed in response to the HTTP request of calling the method of the target interface; the target component instance carries a fuse policy and a degradation policy; in response to the HTTP request, a request input parameter is generated based on a preset HTTP request template; 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. The present invention realizes the registration of the three-party interface through the definition of the preset annotation information, and then through the planning and specification of the three-party interface call mode of the local proxy instance, the target component instance and the request input parameter, the status and performance of the three-party interface call can be effectively monitored and managed, and the present invention can realize the supervision and fault-tolerant processing of the three-party interface call. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.

[0049] Figure 1 A schematic diagram of an implementation environment for monitoring and managing three-party interface requests provided by an embodiment of the present invention;

[0050] Figure 2 A flowchart of a method for monitoring and managing a three-party interface request provided by an embodiment of the present invention;

[0051] Figure 3 A schematic diagram of an extended process of a method for monitoring and managing a three-party interface request provided in an embodiment of the present invention;

[0052] Figure 4 A schematic diagram of the expansion process of step S200 provided in an embodiment of the present invention;

[0053] Figure 5 A schematic diagram of the expansion process of step S400 provided in an embodiment of the present invention;

[0054] Figure 6 A schematic diagram of the process architecture of interface registration provided by an embodiment of the present invention;

[0055] Figure 7 A schematic diagram of an application example flow of the method for monitoring and managing three-party interface requests provided by an embodiment of the present invention;

[0056] Figure 8 A schematic diagram of the architecture of a client request provided by an embodiment of the present invention;

[0057] Fig. 9 A schematic diagram of the structure of a device for monitoring and managing three-party interface requests provided by an embodiment of the present invention;

[0058] Fig.10 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[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 may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first / S100", "second / S200", etc. in the specification, claims and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0061] Reference to "embodiments" in the present invention means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in the present invention may be combined with other embodiments.

[0062] To facilitate the understanding of the technical solution of the present invention, the following is an explanation of the specific names of the technical features that may appear in the technical solution of the present invention:

[0063] RPC, the full name of which is Remote Procedure Call, is a computer communication protocol that allows remote services to be called just like local services.

[0064] HTTP, the full name of which is Hypertext Transfer Protocol, is an application layer protocol used in distributed, collaborative and hypermedia information systems.

[0065] SPI, the full name of which is 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 way for applications to expand.

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

[0067] Redis, the full name of which is Remote Dictionary Server, is an open source log-type, Key-Value database written in ANSI C language, supporting the network, which can be memory-based or persistent, and provides APIs in multiple languages.

[0068] Elasticsearch, the search server, is a distributed search and analytics 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 management and monitoring of the stack.

[0069] like Figure 1 FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention. 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 to a network wirelessly or wired to complete data transmission and exchange.

[0070] Server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

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

[0072] The terminal 102 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal 102 and the server 101 may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present invention.

[0073] Based on the example Figure 1 In the implementation environment shown, an embodiment of the present invention provides a method for monitoring and managing three-party interface requests. The following is explained using the example of the method for monitoring and managing three-party interface requests applied in terminal 102. It can be understood that the method for monitoring and managing three-party interface requests can also be applied to server 101.

[0074] Reference Figure 2 , Figure 2 A flowchart of a method for monitoring and managing a three-party interface request applied to a terminal provided in an embodiment of the present invention. The execution subject of the method for monitoring and managing a three-party interface request can be any of the aforementioned computer devices (including a server or a terminal). Figure 2 , the method comprises the following steps:

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

[0076] Wherein, the target interface is defined based on preset annotation information;

[0077] For example, in some specific implementations, interfaces annotated with @HystrixClient are identified when the project is started, so that the proxy implementation of the interface can be generated in the subsequent process. In some specific application scenarios, when creating an HTTP request interface, the @HystrixClient annotation can be added to the method in advance. The solution of the present invention will execute the specified method after the service is started, and the method will scan all methods annotated with @HystrixClient.

[0078] It should be noted that in some embodiments, Figure 3 As shown, the method may also include the following steps: T100, in response to an interface creation instruction, obtaining the registration content information of the target three-party interface; the registration content information includes the external company name, request address and request method; T200, embedding the registration content information into a preset registration configuration template to obtain a template file; T300, reading the template file through a service discovery mechanism to implement interface registration, and then obtaining the target interface through the definition of preset annotation information; the preset annotation information includes the registration center address, downgrade strategy, fuse strategy and the activation status of the downgrade strategy and the interface link identifier.

[0079] For example, in some specific implementations, you can first define a three-party interface registration configuration template, the template content includes: external company name, request address, request method, etc., and then read the template file based on SPI (service discovery mechanism) to implement interface registration. The registration center provides local files, zookeeper, redis, elasticsearch and other technical means to achieve on-demand configuration. You can also further define the @HystrixClient annotation to implement the API interface, which mainly includes:

[0080] url: registration center address;

[0081] fallbackFactory: custom downgrade method, default downgrade strategy;

[0082] primary: whether to use the circuit breaker downgrade strategy, the default is to use it;

[0083] traceId: defines the interface link identifier.

[0084] S200, dynamically proxy based on the target interface, and create a local proxy instance of the target interface;

[0085] Among them, 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 address of the registration center; in some embodiments, such as Figure 4 As shown, the method may also include the following steps: S201, based on the registration center address carried in the preset annotation information of the target interface, read and obtain the registration center data; S202, according to the registration center data, use the preset dynamic proxy mechanism to create a local proxy instance of the target interface.

[0087] For example, in some specific implementations, the registry data can be read according to the content carried by the annotation, and a local JDK Proxy proxy instance (i.e., a local proxy instance) of the interface can be created. Specifically, the JDK Proxy dynamic proxy can be applied to identify the interface with the @HystrixClient annotation when the project starts, and 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 Proxy proxy instance.

[0088] S300, in response to an HTTP request for calling a method of a target interface, construct a target component instance;

[0089] Among them, the target component instance carries a circuit breaker strategy and a degradation strategy;

[0090] It should be noted that the preset annotation information carries the downgrade strategy and the activation status of the circuit breaker strategy and the downgrade strategy; in some embodiments, step S300 may include the following steps: allowing the HTTP request that calls the method of the target interface to pass through the preset reflection mechanism interface, so that the reflection mechanism interface constructs a target component instance based on the preset annotation information.

[0091] Exemplarily, in some specific implementations, the HTTP request is first packaged into a HystrixCommand instance (i.e., a target component instance) through the InvocationHandler processor (i.e., the reflection mechanism interface). Specifically, the InvocationHandler calls the processor to construct a HystrixCommand instance in the Hystrix component to implement the fusing and downgrading of the request;

[0092] It should be noted that InvocationHandler is an interface in the Java reflection mechanism and belongs to the java.lang.reflect package. Its main function is to provide dynamic proxies with the ability to handle method calls. When using Java dynamic proxies, you can define the behavior when calling methods on proxy objects 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. You can add additional logic here, such as logging, transaction management, etc.

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

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

[0095] Exemplarily, in some specific implementations, HTTP request request input parameters (i.e. request input parameters) can be generated in RequestTemplate by reflection. Specifically, the RequestTemplate request template constructor processes the input parameters and output parameters of the interface after the dynamic proxy 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 to achieve more flexible HTTP client development. RequestTemplate is a class used to build HTTP requests in the Feign library. Feign is a Java HTTP client development library that simplifies the development of HTTP clients. The RequestTemplate class contains relevant information about HTTP requests, such as request URL, request method, request header, request body, etc., and provides a rich API to set this information.

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

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

[0099] It should be noted that the preset annotation information carries the activation status of the circuit breaker policy; in some embodiments, when the circuit breaker policy is in the activated state, the method may further include the following steps: when an abnormal situation occurs when the target client executes an HTTP request based on the request input parameters, the circuit breaker policy is triggered through the target component instance; wherein the abnormal situation includes request timeout, client error or server error.

[0100] For example, in some specific implementations, when a request times out or a 4XX or 5XX exception occurs, a fuse measure is triggered by HystrixCommand.

[0101] 4XX (Client Error): Generally refers to a problem with the machine that sends the request (front end). 5XX (Server Error): Generally refers to a problem with the machine that receives and processes the request (back end).

[0102] It should be noted that the preset annotation information carries the definition and activation status of the downgrade strategy; in some embodiments, after the circuit breaker strategy is triggered, the method may also include the following steps: when the downgrade strategy is in the activated state and there is a predefined downgrade method in the definition of the downgrade strategy, the downgrade strategy is executed through the target component instance; otherwise, an exception is thrown.

[0103] Exemplarily, in some specific implementations, after the circuit breaker is triggered, if the fallbackFactory is defined, the downgrade strategy is executed, otherwise an exception is thrown.

[0104] In order to explain the principle of the technical solution of the present invention in detail, the overall process of the present invention is described below in combination with some specific embodiments. It is easy to understand that the following is an explanation of the technical principle of the present invention and cannot be regarded as a limitation of the present invention.

[0105] First of all, it should be explained that in order to solve the shortcomings of three-party interface calls in actual scenarios and realize the supervision and fault-tolerant processing of three-party interface calls, the present invention designs a zero-intrusive registration center, registers the three-party interface through template configuration, designs an API mode calling component based on the HTTP protocol, standardizes the three-party interface calling mode, can effectively monitor and manage the status and performance of the three-party interface calls, uses the Agent plug-in to realize link reporting, realizes link tracking based on the OpenTracing specification, and introduces Hystrix and sentinel components so that the three-party interface calls can also achieve fuse and downgrade measures.

[0106] In order to achieve the above-mentioned purpose, the technical solution of the present invention mainly adopts the following technical means:

[0107] 1. If Figure 6 As shown in the figure, a three-party interface registration configuration template is defined. The template content includes: external company name, request address, request method, etc. Then, based on SPI (service discovery mechanism), the template file is read to implement interface registration. The registration center provides local files, zookeeper, redis, elasticsearch and other technical means to achieve on-demand configuration.

[0108] 2. Through a series of encapsulation and processing, ordinary HTTP requests are defined as remote call API interfaces through annotations to achieve standardization of three-party interface calls.

[0109] The overall technical solution is as follows Figure 7 As shown, including:

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

[0111] url: registration center address;

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

[0113] primary: whether to use the circuit breaker downgrade strategy, the default is to use it;

[0114] traceId: defines the interface link identifier.

[0115] 2) JDK Proxy dynamic proxy, which identifies the interface annotated with @HystrixClient when the project starts and generates a proxy implementation of the interface.

[0116] 3) InvocationHandler calls the processor to construct a HystrixCommand instance in the Hystrix component to implement the fuse and downgrade of the request;

[0117] 4) RequestTemplate request template constructor, which processes the input and output parameters of the interface after dynamic proxy and constructs the request template;

[0118] 5) If Figure 8 As shown in the figure, the actual request code of the Client uses the OkHttp3 open source component by default to complete 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 the @HystrixClient annotation to the method. The solution of the present invention will execute the specified method after the service is started. The method will scan all methods with the @HystrixClient annotation, read the registry 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) container.

[0121] When the interface method is called in the code, the real HTTP request is actually completed by the Proxy instance. First, the request will be packaged into a HystrixCommand instance through the InvocationHandler processor, and then the HTTP request request input will be generated through reflection in the RequestTemplate. Finally, the HTTP request is executed through the Client and the response is obtained. When the request times out or a 4XX or 5XX exception occurs, the HystrixCommand will trigger the circuit breaker. After the circuit breaker is triggered, if the fallbackFactory is defined, the downgrade strategy will be executed, otherwise an exception will be thrown.

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

[0123] 3. The registration center manages visualization components, which collects data such as the requester, requested party, calling protocol, time consumption, traceId, etc. in 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 fuse.

[0124] In summary, as the complexity and frequency of interactions between systems increase, interface calls have become a key technical link. The technical solution of the present invention solves the shortcomings of three-party interface calls in actual scenarios, realizes the monitoring, fusing and degradation functions of three-party interface calls, and meets 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 mode, and makes the system design and development 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 gap in interface calling 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 for third-party interface calls, helping enterprises to better understand the operating status and performance of the system and to discover and solve problems in a timely manner.

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

[0130] The first module 901 is used 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 fuse strategy and a degradation strategy;

[0133] The fourth module 904 is used to generate a request input parameter based on a preset HTTP request template in response to the HTTP request;

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

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

[0136] The sixth module is used to obtain the registration content information of the target three-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;

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

[0138] The eighth module is used to realize interface registration by reading the template file through the service discovery mechanism, and then obtain the target interface through the definition of preset annotation information; the preset annotation information includes the registration center address, downgrade strategy, fuse strategy and the activation status of the downgrade strategy and the interface link identifier.

[0139] In some embodiments, the preset annotation information carries the activation status of the fuse strategy; when the fuse strategy is in the activated state, the device may further include:

[0140] The ninth module is used to trigger the circuit breaker strategy through the target component instance when an exception occurs when the target client executes the HTTP request based on the request input parameter;

[0141] Among them, abnormal situations include request timeout, client error or server error.

[0142] In some embodiments, the preset annotation information carries the definition and activation status of the downgrade strategy; after the fuse strategy is triggered, the device may further include:

[0143] The tenth module is used to execute the downgrade strategy through the target component instance when the downgrade strategy is enabled and there is a predefined downgrade method in the definition of the downgrade strategy; otherwise, an exception is thrown.

[0144] The contents of the method embodiments of the present invention are all applicable to the device embodiments. The functions specifically implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0145] On the other hand, an embodiment of the present invention further provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above sensitive information method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0146] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0147] like Fig.10 As shown, Fig.10 A specific example of the hardware structure of an electronic device 1000 according to an embodiment is shown. The electronic device 1000 includes:

[0148] The processor 1001 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.

[0149] The memory 1002 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1002, and the processor 1001 calls and executes the network node population optimization method of the embodiment of the present invention;

[0150] Input / output interface 1003, used to implement 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 through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);

[0152] A bus 1005 , which transmits information between various components of the device (e.g., the processor 1001 , the memory 1002 , the input / output interface 1003 , and the communication interface 1004 );

[0153] The processor 1001 , the memory 1002 , the input / output interface 1003 and the communication interface 1004 are connected to each other in communication within the device via the bus 1005 .

[0154] The electronic device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0155] The contents of the method embodiments of the present invention are all applicable to the electronic device embodiments. The functions specifically implemented by the electronic device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

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

[0157] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 to Only Memory, CD to ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0158] The contents of the method embodiments of the present invention are all applicable to the computer-readable storage medium embodiments. The functions specifically implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0159] The embodiment of the present invention also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above method.

[0160] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0161] It should be noted that, although several modules of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0162] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD to ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present invention.

[0163] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of the technology. The disclosed method is not limited to the operation and logic flow presented by the present invention. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part described as a larger operation is performed independently.

[0164] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into 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 is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions and internal relationships of various functional modules in the device disclosed in the present invention, the actual implementation of the module will be understood within the conventional skills of engineers. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.

[0165] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0166] The logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable medium for use by an instruction execution device, apparatus or device (such as a computer-based device, a device including a processor, or other device that can fetch instructions from an instruction execution device, apparatus or device and execute the instructions), or in conjunction with such instruction execution device, apparatus or device. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution device, apparatus or device, or in conjunction with such instruction execution device, apparatus or device.

[0167] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0168] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution device. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0169] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0170] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

[0171] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A method for monitoring and managing three-party interface requests, characterized in that: The following steps are involved: In response to the startup information of the target project, identifying a target interface from the target project; The target interface is defined based on preset annotation information; Perform dynamic proxy 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 fusing strategy and a degradation strategy; In response to the HTTP request, generating a request input parameter based on a preset HTTP request template; The request input parameters are transmitted to a target client so that the target client executes the HTTP request based on the request input parameters and generates response output parameters.

2. The method for monitoring and managing three-party interface requests according to claim 1, characterized in that: The method further comprises the following steps: In response to the interface creation instruction, obtaining registration content information of the target three-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 fuse strategy and the activation status of the downgrade strategy and the interface link identifier.

3. 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; the dynamic proxy based on the target interface is created to obtain a local proxy instance of the target interface, including the following steps: Based on the registration center address carried in the preset annotation information of the target interface, reading and obtaining registration center data; According to the registration center data, the local proxy instance of the target interface is created by utilizing a preset dynamic proxy mechanism.

4. The method for monitoring and managing three-party interface requests according to claim 1, characterized in that: The preset annotation information carries the downgrade strategy and the activation status of the fuse 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.

5. The method for monitoring and managing three-party interface requests according to claim 1, characterized in that: The step of generating a request input parameter based on a preset HTTP request template in response to the HTTP request includes the following steps: Inputting 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.

6. 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, the circuit breaker strategy is triggered through the target component instance; The abnormal situation includes request timeout, client error or server error.

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

8. A device for monitoring and managing three-party interface requests, characterized in that: include: A first module is used 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 used 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 fusing 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; The fifth module is used to transmit the request input parameters to the target client, so that the target client executes the HTTP request based on the request input parameters and generates response output parameters.

9. 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 7.

10. 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 7 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 calling method and device, electronic equipment and storage medium

    CN114942855A

  • Remote calling method, system, equipment and medium

    CN117056103A

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

    CN118193087A