Intercepter dynamic configuration system, intercepter resource reading method and configuration method

By introducing a dynamic interceptor configuration system into microservices technology, the problem of redundant interceptor configuration is solved, and unified management and dynamic configuration of interceptor resources are achieved, reducing maintenance costs.

CN116846758BActive Publication Date: 2026-07-21CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2023-06-30
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In microservices, configuring a corresponding interceptor for each service instance leads to redundant interceptor configurations and a lack of unified management, increasing maintenance costs.

Method used

This paper provides a dynamic configuration system for interceptors, which achieves unified management and dynamic configuration of interceptor resources through the interceptor configuration device on the client side and the interceptor management device on the server side, thereby avoiding redundant configuration.

Benefits of technology

It enables unified management of interceptor resources, reduces development and maintenance costs, and improves system flexibility and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116846758B_ABST
    Figure CN116846758B_ABST
Patent Text Reader

Abstract

The application discloses an interceptor dynamic configuration system, an interceptor resource reading method and a configuration method. The system comprises a client and a server. The client is provided with an interceptor configuration device, which is used for obtaining interceptor resources from the server and configuring matched interceptor resources for each service instance running in the client. The server is provided with an interceptor management device connected with the interceptor configuration device, which is used for receiving an interceptor query request sent by the interceptor configuration device and sending interceptor resources according to the interceptor query request. The interceptor management device is also used for receiving an interceptor resource registration request sent by the interceptor configuration device and determining an interceptor matched with a service instance according to a preset matching rule after receiving the interceptor resource registration request. The application solves the technical problem of redundant configuration of interceptors caused by the configuration of corresponding interceptors for each service instance in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of microservices technology, and more specifically, to an interceptor dynamic configuration system, an interceptor resource reading method, and a configuration method. Background Technology

[0002] In related technologies, when configuring interceptors for multiple service instances, it is usually necessary to configure a corresponding interceptor for each service instance. However, there may be overlap between interceptors corresponding to different service instances, resulting in redundant interceptor configurations and the inability to manage interceptors in a unified manner, leading to high maintenance costs in the later stages.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This application provides an interceptor dynamic configuration system, an interceptor resource reading method, and a configuration method to at least solve the technical problem of redundant interceptor configuration caused by configuring a corresponding interceptor for each service instance in related technologies.

[0005] According to one aspect of the embodiments of this application, a dynamic configuration system for interceptors is provided, including a client and a server. The client is equipped with an interceptor configuration device, used to obtain interceptor resources of interceptors running on the server from the server, and configure interceptor resources matching each service instance running on the client. The server is equipped with an interceptor management device connected to the interceptor configuration device, used to receive interceptor query requests sent by the interceptor configuration device, and send interceptor resources to the interceptor configuration device according to the interceptor query requests. The interceptor management device is further used to receive interceptor resource registration requests sent by the interceptor configuration device, and, upon receiving the interceptor resource registration request, determine the interceptors matching the service instances according to preset matching rules, wherein the preset matching rules are matching rules set by the target object itself.

[0006] Optionally, the interceptor configuration device includes a connection module, an interceptor resource reading module, and an interceptor resource registration module. The connection module is used to obtain interceptor resources that match each service instance. The interceptor resource reading module is used to match the interceptor resources obtained by the connection module to the corresponding service instances and to manage the interceptor resources in a unified manner. The interceptor resource registration module is used to send an interceptor resource registration request to the interceptor management device.

[0007] Optionally, the connection module includes a transmission channel unit, a connection management unit, and an access authentication unit. The transmission channel unit is used to obtain the interceptor resources corresponding to each service instance based on the parameters of each service instance running in the client after the interceptor configuration device establishes a connection channel with the interceptor management device. The connection management unit is used to manage the connection channel between the interceptor configuration device and the interceptor management device, including establishing a connection channel, reclaiming a connection channel, and reconnecting to a connection channel. The access authentication unit is used to authenticate the service instance and determine the information of the interceptor resources that the service instance is allowed to operate on based on the authentication result.

[0008] Optionally, the interceptor resource reading module includes an interceptor matching unit, a rule engine unit, and a class library management unit. The interceptor matching unit is used to match interceptor resources to corresponding service instances; the rule engine unit is used to receive configuration data input from the target object, generate business rules based on the configuration data, and make business decisions based on the business rules; and the class library management unit is used to uniformly manage the interceptor processing classes corresponding to the interceptor resources.

[0009] Optionally, the interceptor resource registration module includes an attribute assembly unit, an interceptor registration management unit, and a response processing unit. The attribute assembly unit is used to encapsulate request parameters according to a preset data format protocol, wherein the request parameters are used to request the acquisition of interceptor resources. The interceptor registration management unit is used to register the acquired interceptor resources. The response processing unit is used to receive indication information returned by the interceptor resource management device, wherein the indication information is used to indicate whether the interceptor resource acquisition request or interceptor resource registration request sent by the interceptor configuration device has been approved.

[0010] Optionally, the interceptor management device includes an interceptor configuration module and a system management module. The interceptor configuration module is used to register and manage interceptors on the server and configure the configuration parameters of the interceptors on the server. The interceptor configuration module is also used to manage the application programming interfaces of the interceptors on the server. The system management module is used to record the running information of the interceptors on the server and the operation information of the target objects. The running information of the interceptors includes the usage of the interceptors, the call rate of the application programming interfaces of the interceptors, and the resource utilization rate of the interceptors.

[0011] Optionally, the interceptor configuration module includes an interceptor management unit, an interface management unit, a rule configuration unit, and an interceptor parameter configuration unit. The interceptor management unit is used to register and manage interceptors on the server side. The interface management unit is used to uniformly manage the application programming interfaces (APIs) of interceptors on the server side, and to generate and provide target interfaces based on these APIs. These target interfaces are used to call any interceptor on the server side. The rule configuration unit is used to configure application rules for interceptors in different application scenarios. The interceptor parameter configuration unit is used to construct a custom variable configuration file based on the data input from the target object, and to configure the parameters of the interceptors based on the custom variable configuration file.

[0012] Optionally, the system management module includes a log management unit and a resource statistics management unit. The log management unit is used to record the operation information of the target object and generate operation logs, including user authentication information, system startup information, system security information, email-related information, and service-related information. The resource statistics management unit is used to record the interceptor's running information.

[0013] According to another aspect of the embodiments of this application, an interceptor resource acquisition method is also provided, applicable to an interceptor dynamic configuration system, comprising: an interceptor management device receiving an interceptor resource acquisition request information sent by an interceptor configuration device; the interceptor management device parsing the interceptor resource acquisition request information to obtain interceptor resource acquisition parameters; the interceptor management device determining an interceptor resource matching the interceptor resource acquisition parameters based on the interceptor resource acquisition parameters, and sending the encapsulated interceptor resource to the interceptor configuration device.

[0014] According to another aspect of the embodiments of this application, an interceptor resource configuration method is also provided, applicable to an interceptor dynamic configuration system, comprising: setting an interceptor plugin in an interceptor management device, and configuring basic information of the interceptor corresponding to the interceptor plugin in the interceptor plugin, wherein the basic information includes an interceptor identifier, an interceptor platform identifier, an interceptor group, and an interceptor maintenance object; configuring interceptor parameters of the interceptor in the interceptor plugin, wherein the interceptor parameters include a package name, a class name, a method name, input parameters, and output parameters; configuring execution rules of the interceptor in the interceptor plugin, wherein the execution rules include the execution order and execution strategy of the interceptor in the target application scenario; retrieving the interceptor resource corresponding to the interceptor plugin in the interceptor resource library, and performing a write-to-library operation on the interceptor plugin based on the retrieval results after the retrieval is completed.

[0015] In this application embodiment, an interceptor dynamic configuration system is provided. The system includes a client and a server. The client is equipped with an interceptor configuration device, used to obtain interceptor resources of interceptors running on the server from the server, and configure interceptor resources matching each service instance running on the client. The server is equipped with an interceptor management device connected to the interceptor configuration device, used to receive interceptor query requests sent by the interceptor configuration device, and send interceptor resources to the interceptor configuration device according to the interceptor query requests. The interceptor management device is also used to receive interceptor resource registration requests sent by the interceptor configuration device, and in response to the requests,... Upon receiving an interceptor resource registration request, the system determines the interceptor that matches the service instance based on preset matching rules. These preset matching rules are set by the target object itself. In the dynamic interceptor configuration system provided in this application embodiment, the interceptor resource requests and interceptor resource matching of each service instance are managed by setting an interceptor configuration device on the client side, and the interceptor management device is set on the server side to manage the interceptor resources on the server side. This achieves the goal of unified management of interceptor resources, thereby avoiding the technical effect of redundant interceptor configuration and solving the technical problem of redundant interceptor configuration caused by configuring a corresponding interceptor for each service instance in related technologies. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0017] Figure 1 This is a schematic diagram of the structure of an interceptor configuration system based on relevant technologies;

[0018] Figure 2 This is a schematic diagram of the structure of an interceptor dynamic configuration system according to an embodiment of this application;

[0019] Figure 3 This is a schematic diagram of an interceptor configuration device according to an embodiment of this application;

[0020] Figure 4 This is a schematic diagram of the structure of an interceptor management device according to an embodiment of this application;

[0021] Figure 5 This is a flowchart illustrating an interceptor resource reading method according to an embodiment of this application;

[0022] Figure 6 This is a flowchart illustrating an interceptor resource query process according to an embodiment of this application;

[0023] Figure 7 This is a flowchart illustrating an interceptor resource configuration method according to an embodiment of this application;

[0024] Figure 8 This is a flowchart illustrating an interceptor resource configuration process according to an embodiment of this application;

[0025] Figure 9 This is a flowchart illustrating an interceptor resource registration process according to an embodiment of this application. Detailed Implementation

[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] To better understand the embodiments of this application, the technical terms involved in the embodiments of this application are explained below:

[0029] Interceptors: Interceptors primarily handle tasks such as parsing request parameters, assigning form parameters to corresponding properties in the value stack, performing functional checks, and debugging program exceptions. In actual development, it's often necessary to execute multiple interception actions simultaneously before an Action is executed, such as user login checks, login log recording, and permission checks. In this case, multiple interceptors can be grouped into an interceptor stack. An interceptor stack refers to a chain formed by interceptors corresponding to various functions arranged in a certain order. When using it, multiple interceptors in the stack can be referenced as a whole. When an interceptor stack is attached to an Action, each interceptor in the stack must be executed before the Action is executed. Typically, interceptors are invoked using a proxy method.

[0030] With the development of internet technology and the increase in the number of users, traditional application architectures can no longer meet current customer needs. In this context, microservice technology has gradually become the mainstream technology. Among microservice technologies, microservice preprocessing and message passing between microservices are the two most widely used techniques. Interceptor technology can be used for microservice preprocessing and message passing, allowing for clear identification of operations occurring at specific points in time. Interceptors can also act as bridges for message passing between microservices. Furthermore, the flexible use of interceptors can further optimize system functionality and ensure application-layer security.

[0031] Currently, the methods used in configuring interceptors in related technologies are as follows: Figure 1 As shown, each service instance is configured with a separate interceptor, leading to redundant configuration of the same interceptor across different service instance interceptor sets. Furthermore, when configuring interceptors, related technologies typically employ hard-coding or AOP + custom annotations. However, hard-coding requires manual configuration for each microservice instance, resulting in a large workload, inflexibility, and lack of dynamic adjustment. Additionally, the interceptor code is intertwined with business logic, leading to poor readability. While AOP + custom annotations decouple interceptors from business logic compared to hard-coding, it still requires additional annotations, resulting in similarly limited flexibility. Besides these issues, adding or modifying interceptor plugins typically requires a service restart to update the interceptors.

[0032] To address the aforementioned issues, this application provides relevant solutions, which are detailed below.

[0033] According to an embodiment of this application, a system embodiment of an interceptor dynamic configuration system is provided. Figure 2This is a structural diagram of the interceptor dynamic configuration system provided in the embodiments of this application. Figure 2 As can be seen, the system includes a client and a server. The client is equipped with an interceptor configuration device 10, which is used to obtain interceptor resources of the interceptors running on the server from the server and configure interceptor resources matching each service instance running on the client. The server is equipped with an interceptor management device 20, which is connected to the interceptor configuration device 10. The interceptor management device 20 is used to receive interceptor query requests sent by the interceptor configuration device 10 and send interceptor resources to the interceptor configuration device 10 according to the interceptor query requests. The interceptor management device 20 is also used to receive interceptor resource registration requests sent by the interceptor configuration device 10 and, after receiving the interceptor resource registration request, determine the interceptor matching the service instance according to the preset matching rules. The preset matching rules are the matching rules set by the target object itself.

[0034] from Figure 2 As can be seen, because this application sets up an interceptor configuration device 10 on the client side and manages the interceptor configuration and usage rules of each service instance through the interceptor configuration device 10, redundant configuration of the same interceptor in the interceptor sets corresponding to different service instances can be avoided. In addition, by setting up an interceptor management device 20 on the server side to manage the interceptors on the server side and receiving user-uploaded custom interceptor matching rules, dynamic configuration of interceptors can be realized.

[0035] It should be noted that, as an optional implementation, the aforementioned client can be a device cluster consisting of multiple electronic computing devices, each of which can run one or more service instances, and an interceptor configuration device 10 can uniformly manage the interceptor resources of each service instance. The interceptor configuration device 10 can be an SDK device. Furthermore, the aforementioned service instances can be microservice instances, each of which can be deployed independently and is loosely coupled. Each microservice focuses on completing only one task, and each microservice can achieve bidirectional communication with the interceptor management device 20 through the SDK client.

[0036] As an optional implementation, the interceptor configuration device 10 can set the target data source and configure connection parameters such as URL address, APPID, and APPKEY, and communicate bidirectionally with the interceptor management device 20 through these connection parameters. Furthermore, the data source can provide various database storage methods, including memory, MySQL, and Redis caching. The access party can choose a suitable data source storage method according to its specific business scenario. For example, it can adopt a MySQL data source storage and connection method. In this case, the access party configures parameters such as the MySQL connection driver, username, and password. After establishing a connection with the interceptor management device 20, the application service can call the resource server to query the interceptor resource API through the interceptor configuration device 10 and encapsulate the request parameters according to the agreed parameter specifications. The request input parameters include API interface address, APPID, APPKEY, request type, access party IP, platform identifier, and other parameters. After the interceptor management device 20 returns the response parameters, the interceptor configuration device 10 can parse and process the response parameters through the parameter parsing module and execute the interceptor according to the rules configured in the resource configuration.

[0037] In some embodiments of this application, a method such as... is also provided. Figure 3 The interceptor configuration device 10 is shown. From Figure 3 As can be seen from the diagram, the interceptor configuration device 10 includes a connection module 110, an interceptor resource reading module 120, and an interceptor resource registration module 130. The connection module 110 is used to obtain interceptor resources that match each service instance; the interceptor resource reading module 120 is used to match the interceptor resources obtained by the connection module 110 to the corresponding service instances and to manage the interceptor resources in a unified manner; and the interceptor resource registration module 130 is used to send an interceptor resource registration request to the interceptor management device 20.

[0038] It should be noted that each module in the interceptor configuration device 10 can be a program module (e.g., a set of program instructions that implements a certain function) or a hardware module. For the latter, it can be in the following forms, but is not limited to them: each of the above modules is in the form of a processor, or the function of each of the above modules is implemented by a processor.

[0039] As an optional implementation, the interceptor configuration device 10, also known as an SDK client, encapsulates the APIs of various resource manager servers. Application servers running multiple application instances can call the resource manager APIs through the interceptor configuration device 10, thus eliminating the cumbersome self-signing process and saving development costs. Simultaneously, by establishing a connection with the server through the interceptor configuration device 10, changes in server-side interceptor resource data can be dynamically detected, and changed interceptor data can be acquired and saved in real time, thereby achieving dynamic updates of interceptor data.

[0040] In some embodiments of this application, such as Figure 3 As shown, the connection module 110 is equipped with a transmission channel unit 112, a connection management unit 114, and an access authentication unit 116. The transmission channel unit 112 is used to obtain the interceptor resources corresponding to each service instance running in the client according to the parameters of each service instance after the interceptor configuration device 10 establishes a connection channel with the interceptor management device 20. The connection management unit 114 is used to manage the connection channel between the interceptor configuration and the interceptor management device 20. The management of the connection channel includes establishing a connection channel, reclaiming a connection channel, and reconnecting a connection channel. The access authentication unit 116 is used to authenticate the service instance and determine the information of the interceptor resources that the service instance is allowed to operate on based on the authentication result.

[0041] Specifically, the connection module 110 will preload relevant parameters set by the transmission channel unit 112. These parameters include the resource manager link address, authentication information (including username, password, and port number), application platform identifier, and resource version number of the service instance obtained from each service instance.

[0042] As an optional implementation, the transmission channel unit 112 may preset target connection parameters, namely the aforementioned related parameters. After the interceptor configuration device 10 and the interceptor management device 20 establish a connection, the transmission channel unit 112 can obtain the corresponding interceptor resources according to the preset target connection parameters. The target connection parameters can be manually entered into the transmission channel unit 112 by the user according to the specific situation of the service instance, or the service instance can transmit the target connection parameters to the transmission channel unit 112 itself. When the transmission channel unit 112 obtains interceptor resources according to the preset target connection parameters, it can filter from all the interceptor resources sent by the interceptor management device 20 according to the preset target connection parameters, filter out the interceptor resources corresponding to the target connection parameters, and determine the service instance corresponding to the target connection parameters, thereby establishing a correspondence between the service instance and the interceptor resources required by the service instance.

[0043] The connection management unit 114 can be used to create a connection channel between the interceptor configuration device 10 and the interceptor management device 20, and to reconnect the connection channel when it fails or is abnormally interrupted. The access authentication unit 116 can authenticate and authorize the identity of access objects, such as various service instances, determine the resources that the access object can operate on based on the identity of the access object, and grant corresponding permissions to ensure the security of interceptor resources.

[0044] In some embodiments of this application, such as Figure 3 As shown, the interceptor resource reading module 120 includes an interceptor matching unit 122, a rule engine unit 124, and a class library management unit 126. The interceptor matching unit 122 is used to match interceptor resources to corresponding service instances; the rule engine unit 124 is used to receive configuration data input from the target object, generate business rules based on the configuration data, and make business decisions based on the business rules; the class library management unit 126 is used to uniformly manage the interceptor processing classes corresponding to the interceptor resources.

[0045] Specifically, the interceptor resource reading module 120 can parse the interceptor matching rules configured in the interceptor management device 20, and the rule engine unit 124 can find the class file of the interceptor that matches the matching rules from the class library management unit 126 according to the rules.

[0046] As an optional implementation, the interceptor matching unit 122 can match interceptor resources to corresponding service instances based on encapsulated configuration parameters. The rule engine unit 124 can use user-defined semantic programs to write business decisions, receive data from users or service instances to generate and interpret business rules, and make business decisions based on these rules. The business rules include the interceptor resources corresponding to each service instance, and the method and order in which each service instance calls the interceptor resources to execute a certain business operation, including the input and output parameters when calling the interceptor resources. The input data refers to the information of the interceptors required by the service instance configured by the user, or the information of the interceptors required by the service instance itself. The class library management module is used to manage the class files of each interceptor and divide the class files according to the dimension of each application instance; for example, class files of each interceptor corresponding to a certain application instance can be divided into the same set.

[0047] In some embodiments of this application, such as Figure 3As shown, the interceptor resource registration module 130 includes an attribute assembly unit 132, an interceptor registration management unit 134, and a response processing unit 136. The attribute assembly unit 132 is used to encapsulate request parameters according to a preset data format protocol, wherein the request parameters are used to request the acquisition of interceptor resources. The interceptor registration management unit 134 is used to register the acquired interceptor resources. The response processing unit 136 is used to receive indication information returned by the interceptor resource management device, wherein the indication information is used to indicate whether the interceptor resource acquisition request or interceptor resource registration request sent by the interceptor configuration device 10 has been approved.

[0048] Specifically, users or service instances can customize the required interceptor resources through the interceptor resource registration module 130. Then, when registering resources, they can interact with the interceptor management device 20 to send a registration request to the resource manager. The request parameters of the registration request include data such as platform identifier, user identifier, class name, and parameters. After receiving and processing the resource registration request, the interceptor management device 20 will return the registration result to the interceptor resource registration module 130.

[0049] As an optional implementation, the attribute assembly unit 132 can encapsulate the request parameters according to a preset data format protocol, and the encapsulated data packet includes a request header and a request body. The interceptor registration management unit 134 can aggregate the interceptor requirements of each service instance and complete the unified registration of interceptor resources based on the aggregated requirements. The response processing unit 136 can receive response information sent by the interceptor configuration device 10 to indicate whether the registration request or the request was successful.

[0050] In some embodiments of this application, a method such as... is also provided. Figure 4 The interceptor management device 20 is shown. From Figure 4 As can be seen, the interceptor management device 20 is equipped with an interceptor configuration module 210 and a system management module 220. The interceptor configuration module 210 is used to register and manage the interceptors on the server and to configure the configuration parameters of the interceptors on the server. The interceptor configuration module 210 is also used to manage the application programming interfaces of the interceptors on the server. The system management module 220 is used to record the running information of the interceptors on the server and the operation information of the target objects. The running information of the interceptors includes the usage of the interceptors, the call rate of the application programming interfaces of the interceptors, and the resource utilization rate of the interceptors.

[0051] It should be noted that each module in the interceptor management device 20 can be a program module (e.g., a set of program instructions that implements a specific function) or a hardware module. For the latter, it can take the following forms, but is not limited to them: each of the above modules is represented by a processor, or the functions of each of the above modules are implemented by a processor.

[0052] In some embodiments of this application, such as Figure 4 As shown, the interceptor configuration module 210 includes an interceptor management unit 212, an interface management unit 214, a rule configuration unit 216, and an interceptor parameter configuration unit 218. The interceptor management unit 212 is used to register and manage interceptors on the server side. The interface management unit 214 is used to uniformly manage the application programming interfaces (APIs) of interceptors on the server side, and to generate and provide target interfaces based on these APIs. These target interfaces are used to call any interceptor on the server side. The rule configuration unit 216 is used to configure application rules for interceptors in different application scenarios. The interceptor parameter configuration unit 218 is used to construct a custom variable configuration file based on the data input from the target object, and to configure the parameters of the interceptors based on the custom variable configuration file.

[0053] Specifically, the interceptor configuration module 210 can provide the ability to customize interceptors. When a user wants to register a new interceptor resource on the server, they can initiate a registration request to the resource manager on the server through the interceptor configuration module 210 to register the new interceptor resource. The interceptor resource includes interceptor plugins, and the request parameters of the registration request include platform identifier, user identifier, interceptor class name, interceptor parameters, etc.

[0054] In some embodiments of this application, the specific process of registering interceptor resources can be completed by the interceptor management unit 212 in the interceptor configuration module 210.

[0055] In order to unify the invocation of various interceptors, the application programming interfaces (APIs) of each interceptor can be managed through the interface management unit 214 and the resource manager in the server, and the APIs of each interceptor can be aggregated to provide a unified API to the outside world.

[0056] When a user wants to dynamically update a registered interceptor, they can customize the variables within the interceptor through the interceptor parameter configuration unit 218. Specifically, the user can input the variable information they want to configure, such as variable name and variable type, into the interceptor parameter configuration unit 218. The interceptor parameter configuration unit 218 will then generate a variable configuration file based on the input data, and subsequently use a mirror image of the variable configuration file to configure the interceptor's parameters, such as customizing variables.

[0057] In some embodiments of this application, such as Figure 4 As shown, the system management module 220 is characterized by having a log management unit 222 and a resource statistics management unit 224. The log management unit 222 is used to record the operation information of the target object and generate an operation log. The operation information includes user authentication information, system startup information, system security information, email-related information, and service-related information. The resource statistics management unit 224 is used to record the operation information of the interceptor.

[0058] Specifically, the system management module 220 is mainly used for configuring various basic data of the backend management server, such as recording the operation logs of objects that call the interceptors, and statistics on the usage of each interceptor, API call rate and resource utilization.

[0059] In the interceptor dynamic configuration system provided in this application embodiment, by setting an interceptor configuration device 10 on the client to manage the interceptor resource requests and interceptor resource matching of each service instance, and setting an interceptor management device 20 on the server to manage the interceptor resources on the server, the purpose of unified management of interceptor resources is achieved, thereby realizing the technical effect of avoiding redundant interceptor configuration, and thus solving the technical problem of redundant interceptor configuration caused by configuring a corresponding interceptor for each service instance in related technologies.

[0060] Furthermore, in the interceptor dynamic configuration system provided in this application embodiment, when the application platform sends a request to the resource manager through the SDK client, and the resource manager receives the client request, the resource manager returns the relevant interceptor resources (JSON format data), and simultaneously records the operation log of the request, the resource usage, and the API call status. It can be seen that using the interceptor dynamic configuration system of this application embodiment eliminates the need for developers to rewrite business code; they only need to introduce this framework and perform some simple adaptive configurations to use it. This greatly reduces the amount of code modification required by developers and the subsequent maintenance costs, lowers the learning and maintenance costs, and is easy to implement and deploy.

[0061] According to an embodiment of this application, a method embodiment for interceptor resource reading is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0062] Under the above operating environment, this application embodiment provides a method for reading interceptor resources, such as... Figure 5 As shown, the method includes the following steps:

[0063] Step S502: The interceptor management device receives the interceptor resource acquisition request information sent by the interceptor configuration device;

[0064] Step S504: The interceptor management device parses the interceptor resource acquisition request information to obtain the interceptor resource acquisition parameters;

[0065] In step S506, the interceptor management device determines the interceptor resource that matches the interceptor resource acquisition parameters based on the interceptor resource acquisition parameters, and sends the encapsulated interceptor resource to the interceptor configuration device.

[0066] In some embodiments of this application, a method such as... is also provided. Figure 6 The interceptor resource query process shown includes the following steps:

[0067] Step S602: Preset data source;

[0068] In the technical solution provided in step S602, the data source includes various database storage methods, including memory, MySQL, and Redis cache. The access party can choose a suitable data source storage method based on its specific business scenario. For example, it can uniformly adopt MySQL data source storage and connection methods, configuring parameters such as the MySQL connection driver, username, and password to establish a connection with the resource manager.

[0069] Step S604: A connection is established between the interceptor configuration device and the interceptor management device;

[0070] Step S606, authentication and authorization;

[0071] After establishing a connection with the interceptor management device, the interceptor configuration device can initiate an authentication request to the interceptor management device based on the configured connection parameters such as the data source URL address, APPID, and APPKEY corresponding to the interceptor management device.

[0072] After successful authentication, the interceptor management device can return the authentication permission information token. The interceptor configuration device can then send an interceptor resource query request or an interceptor resource acquisition request to the interceptor management device. If authentication fails, step S606 will be executed again after a period of time.

[0073] Step S608: Assemble the query parameters;

[0074] The interceptor configuration device can encapsulate request parameters according to the agreed parameter specifications. The request input parameters include resource query parameters such as API interface address, APPID, APPKEY, request type, access party IP, and platform identifier.

[0075] Step S610: Initiate a query request;

[0076] In the technical solution provided in step S610, the query request includes a resource query request.

[0077] Step S612: The interceptor management device records logs;

[0078] In the technical solution provided in step S612, the interceptor management device can record the request operation log initiated by the interceptor configuration device, thereby tracking the system usage status.

[0079] Step S614, parse the parameters;

[0080] The interceptor management device can parse request parameters according to the agreed parameter specifications and convert the parameters into a data format that the server can recognize;

[0081] Step S616: Verify whether the data is valid;

[0082] Specifically, if the verification result is invalid, a "query parameter is incorrect" response message is returned to the interceptor configuration device, and the current request is terminated.

[0083] Step S618: Query interceptor resources.

[0084] Specifically, the corresponding interceptor resources can be matched based on the converted parameters.

[0085] Under the above operating environment, embodiments of this application provide an interceptor resource configuration method, such as... Figure 7 As shown, the method includes the following steps:

[0086] Step S702: Set up an interceptor plugin in the interceptor management device, and configure the basic information of the interceptor corresponding to the interceptor plugin in the interceptor plugin. The basic information includes the interceptor identifier, the platform identifier to which the interceptor belongs, the group to which the interceptor belongs, and the object to which the interceptor is maintained.

[0087] Step S704: Configure the interceptor parameters in the interceptor plugin, where the interceptor parameters include package name, class name, method name, input parameters, and output parameters;

[0088] Step S706: Configure the execution rules of the interceptor in the interceptor plugin, wherein the execution rules include the execution order and execution strategy of the interceptor in the target application scenario;

[0089] Step S708: Retrieve the interceptor resource corresponding to the interceptor plugin in the interceptor resource library, and perform a write-to-library operation on the interceptor plugin based on the retrieval results after the retrieval is completed.

[0090] Specifically, if the search result indicates that there is no corresponding interceptor resource in the resource repository, the configured interceptor resource is written to the repository. If the search result indicates that the resource already exists, the write operation is not performed.

[0091] This application also provides an interceptor resource configuration process in its embodiments. Figure 8 This is a flowchart illustrating the interceptor resource configuration process, such as... Figure 8 As shown, the process includes:

[0092] Step S802: Configure the interceptor plugin;

[0093] In the technical solution provided in step S802, when configuring the interceptor plugin, basic interceptor information can be configured, such as the Chinese name of the interceptor, the group to which it belongs, the platform identifier of the service instance corresponding to the interceptor, the maintenance personnel and contact information of the interceptor resources, etc.

[0094] Step S804, parameter settings;

[0095] Specifically, the specific execution parameters of the interceptor, such as package name, class name, method name, input parameters, and output parameters, can be configured.

[0096] Step S806: Configure execution rules;

[0097] Specifically, the execution rules include application rules for different interceptor resources in different business scenarios, such as the execution order and execution strategy of interceptors.

[0098] Step S808: Assemble registration parameters;

[0099] Specifically, request parameters can be encapsulated according to the agreed parameter specifications. Request parameters include API interface address, APPID, APPKEY, request type, access party IP, platform identifier, interceptor resource data object (Info), and other resource registration parameters.

[0100] Step S810, plugin debugging;

[0101] Specifically, by debugging the interceptor plugin, the accuracy of the data can be further verified.

[0102] Step S812: Initiate a registration request;

[0103] Specifically, the interceptor configuration device can initiate a registration request for interceptor resources to the interceptor management device;

[0104] Step S814, log recording;

[0105] Step S816: Register the interceptor resource.

[0106] In the technical solution provided in step S816, an internal API can be called to initiate a request to write the interceptor resource to the database. Specifically, before executing the write operation, the database can be checked to see if the resource exists. If it does not exist, the interceptor resource is registered, and then the write operation is performed. If the resource already exists in the database, a response message "This resource already exists, please do not register it again!" is generated and returned to the interceptor configuration device, thus ending the request.

[0107] After successfully registering the interceptor resource, users can also perform operations such as publishing and delisting the interceptor resource.

[0108] This application also provides an interceptor resource registration process. Figure 9 This is a flowchart illustrating the interceptor resource registration process, as follows: Figure 9 As shown, it includes the following steps:

[0109] Step S902: The interceptor configuration device establishes a connection with the interceptor management device;

[0110] In the technical solution provided in step S902, before establishing a connection, the interceptor configuration device also needs to configure the data source and select the transmission channel. The data source includes various database storage methods, such as memory, MySQL, and Redis cache. The access party can choose a suitable data source storage method based on its specific business scenario. For example, it can uniformly adopt MySQL data source storage and connection methods, configuring parameters such as the MySQL connection driver, username, and password to establish a connection with the resource manager.

[0111] Step S904, authentication and authorization;

[0112] After establishing a connection with the interceptor management device, the interceptor configuration device can initiate an authentication request to the interceptor management device based on the configured connection parameters such as the data source URL address, APPID, and APPKEY corresponding to the interceptor management device.

[0113] After successful authentication, the interceptor management device can return the authentication permission information token. The interceptor configuration device can then send an interceptor resource query request or an interceptor resource acquisition request to the interceptor management device. If authentication fails, step S904 will be executed again after a period of time.

[0114] Step S906: Assemble the registration parameters;

[0115] The interceptor configuration device can encapsulate request parameters according to the agreed parameter specifications. The request input parameters include resource query parameters such as API interface address, APPID, APPKEY, request type, access party IP, and platform identifier.

[0116] Step S908: Initiate a resource registration request;

[0117] In the technical solution provided in step S908, the resource registration request includes obtaining a resource registration request.

[0118] Step S910: The interceptor management device records logs.

[0119] In the technical solution provided in step S910, the interceptor management device can record the request operation log initiated by the interceptor configuration device, thereby tracking the system usage status.

[0120] Step S912, parse the parameters;

[0121] The interceptor management device can parse request parameters according to the agreed parameter specifications and convert the parameters into a data format that the server can recognize;

[0122] Step S914: Verify whether the data is valid;

[0123] Specifically, if the verification result is invalid, a "query parameter is incorrect" response message is returned to the interceptor configuration device, and the current request is terminated.

[0124] Step S916: Register the interceptor resource.

[0125] In the technical solution provided in step S916, an internal API can be called to initiate a request to write the interceptor resource to the database. Specifically, before executing the write operation, the database can be checked to see if the resource exists. If it does not exist, the interceptor resource is registered, and then the write operation is performed. If the resource already exists in the database, a response message "This resource already exists, please do not register it again!" is generated and returned to the interceptor configuration device, ending the request. After successful registration, the assembled response data can be returned to the interceptor resource configuration device.

[0126] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0127] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0128] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0129] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0130] If the integrated unit is implemented as 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 this application, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0131] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A dynamic configuration system for interceptors, characterized in that, Including client and server sides, among which, The client is equipped with an interceptor configuration device, which is used to obtain interceptor resources of the interceptors running in the server from the server, and configure interceptor resources matching the service instances running in the client. The server includes an interceptor management device connected to the interceptor configuration device. The interceptor management device receives interceptor query requests from the interceptor configuration device and sends interceptor resources to the interceptor configuration device based on the query requests. The interceptor management device also receives interceptor resource registration requests from the interceptor configuration device and, upon receiving the registration request, determines the interceptor that matches the service instance based on a preset matching rule. This preset matching rule is a matching rule set by the target object itself. The interceptor configuration device includes a connection module, an interceptor resource reading module, and an interceptor resource registration module, wherein... The connection module is used to obtain interceptor resources that match each service instance; The interceptor resource reading module is used to match the interceptor resources obtained by the connection module to the corresponding service instances, and to manage the interceptor resources in a unified manner. The interceptor resource registration module is used to send the interceptor resource registration request to the interceptor management device; The interceptor resource reading module includes an interceptor matching unit, a rule engine unit, and a library management unit. The interceptor matching unit is used to match the interceptor resource to the corresponding service instance; The rule engine unit is used to receive configuration data input by the target object, generate business rules based on the configuration data, and make business decisions based on the business rules. The class library management unit is used to uniformly manage the interceptor processing classes corresponding to the interceptor resources.

2. The interceptor dynamic configuration system according to claim 1, characterized in that, The connection module includes a transmission channel unit, a connection management unit, and an access authentication unit. The transmission channel unit is used to obtain the interceptor resources corresponding to each service instance based on the parameters of each service instance running in the client after the interceptor configuration device establishes a connection channel with the interceptor management device. The connection management unit is used to manage the connection channel between the interceptor configuration and the interceptor management device, wherein managing the connection channel includes establishing the connection channel, reclaiming the connection channel, and reconnecting the connection channel; The access authentication unit is used to authenticate the service instance and determine the information of the interceptor resources that the service instance is allowed to operate on based on the authentication result.

3. The interceptor dynamic configuration system according to claim 1, characterized in that, The interceptor resource registration module includes an attribute assembly unit, an interceptor registration management unit, and a response processing unit. The attribute assembly unit is used to encapsulate request parameters according to a preset data format protocol, wherein the request parameters are used to request the interceptor resource; The interceptor registration management unit is used to register the acquired interceptor resources; The response processing unit is configured to receive indication information returned by the interceptor resource management device, wherein the indication information is used to indicate whether the interceptor resource acquisition request or interceptor resource registration request sent by the interceptor configuration device has been approved.

4. The interceptor dynamic configuration system according to claim 1, characterized in that, The interceptor management device includes an interceptor configuration module and a system management module, wherein... The interceptor configuration module is used to register and manage the interceptors in the server, and to configure the configuration parameters of the interceptors in the server; the interceptor configuration module is also used to manage the application programming interfaces of the interceptors in the server. The system management module is used to record the operation information of the interceptors in the server and the operation information of the target object. The operation information of the interceptors includes the usage of the interceptors, the call rate of the application programming interface of the interceptors, and the resource utilization rate of the interceptors.

5. The interceptor dynamic configuration system according to claim 4, characterized in that, The interceptor configuration module includes an interceptor management unit, an interface management unit, a rule configuration unit, and an interceptor parameter configuration unit. The interceptor management unit is used to register and manage the interceptors in the server. The interface management unit is used to uniformly manage the application programming interfaces of the interceptors in the server, and generate and provide target interfaces to the outside world based on the application programming interfaces of the interceptors in the server, wherein the target interface is used to call any interceptor in the server. The rule configuration unit is used to configure the application rules of the interceptor in different application scenarios; The interceptor parameter configuration unit is used to construct a custom variable configuration file based on the data input by the target object, and to configure the parameters of the interceptor based on the custom variable configuration file.

6. The interceptor dynamic configuration system according to claim 4, characterized in that, The system management module includes a log management unit and a resource statistics management unit. The log management unit is used to record the operation information of the target object and generate operation logs, wherein the operation information includes user authentication information, system startup information, system security information, email-related information, and service-related information. The resource statistics management unit is used to record the operation information of the interceptor.

7. A method for reading interceptor resources, applicable to the dynamic configuration system of interceptors as described in any one of claims 1-6, characterized in that, include: The interceptor management device receives the interceptor resource acquisition request information sent by the interceptor configuration device; The interceptor management device parses the interceptor resource acquisition request information to obtain the interceptor resource acquisition parameters; The interceptor management device determines the interceptor resource that matches the interceptor resource acquisition parameters based on the interceptor resource acquisition parameters, and sends the encapsulated interceptor resource to the interceptor configuration device.

8. A method for configuring interceptor resources, applicable to the dynamic configuration system of interceptors as described in any one of claims 1-6, characterized in that, include: An interceptor plugin is set up in the interceptor management device, and the basic information of the interceptor corresponding to the interceptor plugin is configured in the interceptor plugin. The basic information includes the interceptor identifier, the platform identifier to which the interceptor belongs, the group to which the interceptor belongs, and the interceptor maintenance object. Configure the interceptor parameters in the interceptor plugin, wherein the interceptor parameters include package name, class name, method name, input parameters, and output parameters; The execution rules of the interceptor are configured in the interceptor plugin, wherein the execution rules include the execution order and execution strategy of the interceptor in the target application scenario; Search the interceptor resource library for the interceptor plugin corresponding to it, and then write the interceptor plugin to the library based on the search results.