Gateway plug-in configuration method and device, equipment and storage medium
By adding interface routing-associated gateway plug-in logic in the gateway service node and using gateway plug-in identifier for configuration, the problem of global configuration cannot be differentiated is solved, and the flexible loading and dynamic configuration of gateway plug-in is realized.
Patent Information
- Application Number
- CN202510151804.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-05-13
AI Technical Summary
In the prior art, the globally configured gateway plug-ins cannot be configured differently to different interfaces, which affects the flexibility of gateway plug-ins loading.
Add the gateway plug-in logic associated with interface routing in the gateway service node, and use the gateway plug-in to identify the gateway plug-in that configures interface routing association in the interface proxy information to realize dynamic management of plug-in configuration information for interface routing.
It realizes the differentiated configuration of the gateway plug-in for interface routing, improves the flexibility of gateway plug-in loading, and realizes dynamic plug-in loading of the gateway plug-in through dynamic configuration.
Smart Images

Figure CN119996200A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a configuration method, device, equipment and storage medium of a gateway plug-in. Background Art
[0002] As a middleware, the gateway is responsible for processing requests from the client and forwarding them to the backend server for processing. As the business expands and the functions increase, the load on the gateway also increases. The gateway plug-in can modularize the functions of the gateway and achieve functional expansion and performance optimization through plug-ins.
[0003] In the related technology, in the large-scale application scenario of microservice architecture, the gateway plug-ins corresponding to most microservice interfaces are globally configured as the gateway service node is started. In other words, the configuration of the gateway plug-in in the development stage needs to restart the gateway service node to take effect. However, as the number of interfaces of the gateway agent increases, the service requirements corresponding to different interfaces will also increase, which requires multiple additions or modifications of gateway plug-ins, and the number of restarts of the gateway service node increases accordingly, making it impossible for the globally configured gateway plug-in to perform differentiated configurations for different interfaces, affecting the flexibility of gateway plug-in loading. Summary of the invention
[0004] In view of this, the present application provides a method and device for configuring a gateway plug-in, the main purpose of which is to solve the problem in the prior art that the globally configured gateway plug-in cannot perform differentiated configurations for different interfaces, affecting the flexibility of loading the gateway plug-in.
[0005] Add at least one gateway plug-in logic associated with the interface route in the gateway service node, wherein the gateway plug-in logic has a gateway plug-in identifier defined therein;
[0006] Using the gateway plug-in identifier, configuring the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node to obtain the plug-in configuration information of the interface route;
[0007] In response to the interface routing request of the gateway service node, traverse the access interface routing according to the interface proxy information;
[0008] When any interface route is accessed, at least one gateway plug-in logic associated with the interface route is executed according to the plug-in configuration information of the interface route.
[0009] Further, the adding at least one gateway plug-in logic associated with the interface routing in the gateway service node includes:
[0010] Predetermining at least one plug-in function associated with an interface route in a gateway service node and a plug-in dependency relationship described by the plug-in function;
[0011] Creating at least one gateway plug-in according to the at least one plug-in function, so as to encapsulate the gateway plug-in logic implemented by the corresponding plug-in function through the gateway plug-in;
[0012] The gateway plug-in logic encapsulated by the at least one gateway plug-in is added to the gateway service node according to the plug-in dependency.
[0013] Furthermore, before configuring the gateway plug-in associated with the interface routing in the interface proxy information of the gateway service node using the gateway plug-in identifier to obtain the plug-in configuration information of the interface routing, the method further includes:
[0014] Create interface proxy information of the gateway service node in a database, wherein the interface proxy information includes service configuration information of the interface route;
[0015] Correspondingly, the gateway plug-in identifier is used to configure the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node to obtain the plug-in configuration information of the interface route, including:
[0016] Using the gateway plug-in identifier, a mapping relationship field between the interface route and the gateway plug-in is established in the gateway service node, so as to store the state field of the gateway plug-in and the sequence field of the gateway plug-in through the mapping relationship field;
[0017] According to the status field of the gateway plug-in, the enabled state of the interface route corresponding to the gateway plug-in is configured in the interface proxy information of the gateway service node, and the configuration information of the plug-in state corresponding to the interface route is obtained;
[0018] According to the sequence field of the gateway plug-in, the activation sequence of the gateway plug-in corresponding to the interface route is configured in the interface proxy information of the gateway service node to obtain the configuration information of the plug-in sequence corresponding to the interface route.
[0019] Further, in response to the interface routing request of the gateway service node, traversing the access interface routing according to the interface proxy information includes:
[0020] Responding to the interface routing request of the gateway service node, parsing the key path information in the interface routing request;
[0021] Perform routing path matching in the interface proxy information according to the key path information to obtain a routing path applicable to the interface routing request;
[0022] The interface route is accessed by traversing the routing path applicable to the interface route request.
[0023] Further, after responding to the interface routing request of the gateway service node and traversing the access interface routing according to the interface proxy information, the method further includes:
[0024] Loading the plug-in configuration information of the routing interface into the memory according to the interface proxy information;
[0025] Correspondingly, when accessing any interface route, the gateway plug-in logic associated with the interface route is executed according to the plug-in configuration information of the interface route, including:
[0026] When accessing any interface route, judging whether the interface route is associated with a gateway plug-in according to the plug-in configuration information of the interface route;
[0027] If so, at least one gateway plug-in logic associated with the interface route is executed; otherwise, the next interface route is accessed.
[0028] Furthermore, before executing at least one gateway plug-in logic associated with the interface routing, the method further includes:
[0029] Determining the execution order of the gateway plug-in according to the plug-in configuration information of the interface routing;
[0030] Correspondingly, at least one gateway plug-in logic associated with the interface routing is executed according to the execution order of the gateway plug-ins.
[0031] Furthermore, when any interface route is accessed, after executing at least one gateway plug-in logic associated with the interface route according to the plug-in configuration information of the interface route, the method further includes:
[0032] In response to a change in the plug-in configuration information, obtaining the changed plug-in configuration information in the gateway service node;
[0033] The changed plug-in configuration information is broadcasted to all gateway service nodes connected to the database through a message component, so that all gateway service nodes replace the plug-in configuration information of the existing interface routing according to the changed plug-in configuration information.
[0034] According to a second aspect of the present application, a gateway plug-in configuration device is provided, comprising:
[0035] An adding unit, configured to add at least one gateway plug-in logic associated with an interface route in a gateway service node, wherein a gateway plug-in identifier is defined in the gateway plug-in logic;
[0036] A configuration unit, configured to configure a gateway plug-in associated with an interface route in the interface proxy information of the gateway service node using the gateway plug-in identifier, and obtain plug-in configuration information of the interface route;
[0037] An access unit, configured to respond to an interface routing request of a gateway service node and traverse the access interface routing according to the interface proxy information;
[0038] An execution unit is used to execute at least one gateway plug-in logic associated with any interface route according to the plug-in configuration information of the interface route when accessing the interface route.
[0039] Furthermore, the adding unit is specifically used for:
[0040] Predetermining at least one plug-in function associated with an interface route in a gateway service node and a plug-in dependency relationship described by the plug-in function;
[0041] Creating at least one gateway plug-in according to the at least one plug-in function, so as to encapsulate the gateway plug-in logic implemented by the corresponding plug-in function through the gateway plug-in;
[0042] The gateway plug-in logic encapsulated by the at least one gateway plug-in is added to the gateway service node according to the plug-in dependency.
[0043] Furthermore, the device also includes:
[0044] A creation unit, configured to create the interface proxy information of the gateway service node in a database before configuring the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node using the gateway plug-in identifier to obtain the plug-in configuration information of the interface route, wherein the interface proxy information includes the service configuration information of the interface route;
[0045] Accordingly, the configuration unit is specifically used for:
[0046] Using the gateway plug-in identifier, a mapping relationship field between the interface route and the gateway plug-in is established in the gateway service node, so as to store the state field of the gateway plug-in and the sequence field of the gateway plug-in through the mapping relationship field;
[0047] According to the status field of the gateway plug-in, the enabled state of the interface route corresponding to the gateway plug-in is configured in the interface proxy information of the gateway service node, and the configuration information of the plug-in state corresponding to the interface route is obtained;
[0048] According to the sequence field of the gateway plug-in, the activation sequence of the gateway plug-in corresponding to the interface route is configured in the interface proxy information of the gateway service node to obtain the configuration information of the plug-in sequence corresponding to the interface route.
[0049] Furthermore, the access unit is specifically used to:
[0050] Responding to the interface routing request of the gateway service node, parsing the key path information in the interface routing request;
[0051] Perform routing path matching in the interface proxy information according to the key path information to obtain a routing path applicable to the interface routing request;
[0052] The interface route is accessed by traversing the routing path applicable to the interface route request.
[0053] Furthermore, the device also includes:
[0054] A loading unit, configured to load the plug-in configuration information of the routing interface into the memory according to the interface proxy information after traversing the access interface route according to the interface proxy information in response to the interface routing request of the gateway service node;
[0055] Accordingly, the execution unit is specifically used for:
[0056] When accessing any interface route, judging whether the interface route is associated with a gateway plug-in according to the plug-in configuration information of the interface route;
[0057] If so, at least one gateway plug-in logic associated with the interface route is executed; otherwise, the next interface route is accessed.
[0058] Furthermore, the execution unit is further configured to:
[0059] Before executing at least one gateway plug-in logic associated with the interface route, determining the execution order of the gateway plug-ins according to the plug-in configuration information of the interface route;
[0060] Correspondingly, at least one gateway plug-in logic associated with the interface routing is executed according to the execution order of the gateway plug-ins.
[0061] Furthermore, the device also includes:
[0062] a changing unit, configured to obtain the changed plug-in configuration information in the gateway service node in response to the change of the plug-in configuration information after executing at least one gateway plug-in logic associated with the interface route according to the plug-in configuration information of the interface route when any interface route is accessed;
[0063] The broadcast unit is used to broadcast the changed plug-in configuration information to all gateway service nodes accessed by the database through the message component, so that all gateway service nodes replace the plug-in configuration information of the existing interface routing according to the changed plug-in configuration information.
[0064] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in the first aspect when executing the computer program.
[0065] According to a fourth aspect of the present application, a readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0066] By means of the above technical scheme, the present application provides a configuration method, device and equipment of a gateway plug-in. Compared with the current prior art that realizes the configuration of the gateway plug-in by restarting the gateway service node, the present application adds at least one gateway plug-in logic associated with the interface route in the gateway service node, and the gateway plug-in logic is defined with a gateway plug-in identifier; the gateway plug-in identifier is used to configure the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node, and the plug-in configuration information of the interface route is obtained; in response to the interface route request of the gateway service node, the interface route is traversed and accessed according to the interface proxy information; when any interface route is accessed, the interface route is associated with at least one gateway plug-in logic according to the plug-in configuration information of the interface route. The whole process creates an association relationship between the interface route and the gateway plug-in in the interface proxy information of the gateway service node through the gateway plug-in identifier to realize the differentiated configuration of the interface route by the gateway plug-in. When the gateway service node is started, the dynamic pluggable loading of the gateway plug-in is realized through the plug-in configuration information.
[0067] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0069] Figure 1 It is a flow chart of a method for configuring a gateway plug-in provided in an embodiment of the present application;
[0070] Figure 2 yes Figure 1 A schematic flow chart of a specific implementation of step 102;
[0071] Figure 3 It is a flowchart of another gateway plug-in configuration method provided in an embodiment of the present application;
[0072] Figure 4 yes Figure 1 A schematic flow chart of a specific implementation of step 103;
[0073] Figure 5It is a schematic diagram of the execution process of the gateway plug-in logic after the routing interface request provided by the embodiment of the present application reaches the gateway service node;
[0074] Figure 6 It is a flowchart of another method for configuring a gateway plug-in provided in an embodiment of the present application;
[0075] Figure 7 It is a flow chart of the configuration of the gateway plug-in provided in the embodiment of the present application;
[0076] Figure 8 It is a structural diagram of a gateway plug-in configuration device provided in an embodiment of the present application;
[0077] Fig. 9 It is a schematic diagram of the device structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0078] Now the content of the present invention will be discussed with reference to several exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and thus implement the content of the present invention, rather than implying any limitation on the scope of the present invention.
[0079] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including but not limited to." The term "based on" is to be interpreted as "based, at least in part, on." The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment." The term "another embodiment" is to be interpreted as "at least one other embodiment."
[0080] In the related technology, in the large-scale application scenario of microservice architecture, the gateway plug-ins corresponding to most microservice interfaces are globally configured as the gateway service node is started. In other words, the configuration of the gateway plug-in in the development stage needs to restart the gateway service node to take effect. However, as the number of interfaces of the gateway agent increases, the service requirements corresponding to different interfaces will also increase, which requires multiple additions or modifications of gateway plug-ins, and the number of restarts of the gateway service node increases accordingly, making it impossible for the globally configured gateway plug-in to perform differentiated configurations for different interfaces, affecting the flexibility of gateway plug-in loading.
[0081] In order to solve this problem, this embodiment provides a configuration method of a gateway plug-in, such as Figure 1 As shown, the method comprises the following steps:
[0082] 101. Add at least one gateway plug-in logic associated with the interface routing in the gateway service node.
[0083] In this embodiment, the gateway service node is equivalent to the gateway of the network. When data is transmitted between networks, it needs to pass through the gateway service node to route and forward data and verify data security when it is transmitted from one network to another. Normally, the front-end request cannot directly access the microservice, and it is necessary to send an interface routing request to the gateway service node. After passing the authentication, the gateway service node forwards the interface routing request to the corresponding microservice according to the microservice accessed by the interface routing request. In other words, routing is one of the core functions of the gateway service node, which is responsible for forwarding the client's request to the correct backend service. In the microservice architecture, an application may be split into multiple independent services, each of which is responsible for different business capabilities. The gateway service node can accurately forward the request to the corresponding service based on the requested URL, HTTP method, header information and other information through the routing function, thereby realizing communication between the client and the backend service.
[0084] It is understandable that the load of the gateway service node will continue to increase with the expansion of business and functions, leading to gateway performance bottlenecks. By adding gateway plug-ins, the gateway service node can provide more service functions, including load balancing, logging, authorization, forwarding, etc., and then bind the gateway plug-in to the interface route to take effect.
[0085] Specifically, different gateway plug-ins can play different roles in the process of request and response processing by the gateway service. For example, the security authentication plug-in is used to verify the legitimacy of the request to ensure that only authorized users can access the interface, and the traffic control plug-in is used to monitor and manage the traffic of the interface to prevent overload. The functions provided by at least one gateway plug-in complement each other to provide a more comprehensive gateway service quality. Taking the interface that handles sensitive user data as an example, a data encryption gateway plug-in may be required to protect the security of data transmission, as well as a logging gateway plug-in to record detailed information about access and operations for auditing and troubleshooting.
[0086] Usually, before developing the logic of the gateway plug-in, it is necessary to determine the function of the gateway plug-in first, and generate the corresponding plug-in function description according to the function of the gateway plug-in. For the gateway plug-in with security authentication function, the verification user token can be used as the plug-in function description. For the gateway plug-in with flow control function, the access frequency of a certain interface can be limited as the plug-in function description. For the gateway plug-in with data conversion function, the data format in the request can be modified and then forwarded to the backend service as the plug-in function description. After clarifying the plug-in function description, set the position of the gateway plug-in in the gateway service process. If the gateway plug-in requires request pre-processing, the gateway plug-in needs to be set after the gateway service node receives the client request and before routing the request to the backend server. If the gateway service requires post-response processing, the gateway plug-in needs to be set after obtaining the response from the backend service and before returning the response to the client. Further, according to the position of the gateway plug-in in the gateway service process, the corresponding plug-in function description is configured for the gateway plug-in to obtain the gateway plug-in logic. The configuration process may include but is not limited to the plug-in parameter configuration and the plug-in interaction configuration. Here, the plug-in parameter configuration can be the numerical limit and processing method of the plug-in on the corresponding function description, for example, the current limiting threshold configured by the current limiting plug-in and the processing method after exceeding the threshold. The plug-in interaction configuration here can be the interaction configuration between the plug-in and other components within the gateway service node and / or external services. For example, a plug-in that interacts with an external payment gateway needs to explain the interaction sequence and data processing method with the order processing component of the gateway service in the payment process.
[0087] In this embodiment, in order to intuitively reflect the main functions of the gateway plug-in, a gateway plug-in identifier is defined in the gateway plug-in logic, and the gateway plug-in identifier can be a keyword corresponding to the gateway plug-in. For example, the rate limiter plug-in can define a keyword as: rate limiter, the cache plug-in can define a keyword as: resp cache, the signature verification plug-in can define a keyword as: sign check, the request amount limit plug-in can define a keyword as: req count limiter, etc. In this way, the function of the gateway plug-in can be quickly understood through the gateway plug-in identifier.
[0088] 102. Use the gateway plug-in identifier to configure the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node to obtain the plug-in configuration information of the interface route.
[0089] It can be understood that the gateway service node acts as a proxy for multiple services, enabling changes, routing and common processing across all services. Generally speaking, the gateway service node has corresponding interface proxy information, which includes but is not limited to the interface proxy name, interface proxy service configuration, gateway routing path, gateway proxy prefix, etc.
[0090] Taking into account that different gateway plug-ins may have different functions, such as security authentication plug-ins, traffic control plug-ins, logging plug-ins, etc., specifically, the configuration items of the interface agent can be determined in the interface agent information of the gateway service node, and the interface routing object can be located according to the configuration items of the interface agent. The gateway plug-in identifier is added to the interface routing object to establish an association between the interface routing and the gateway plug-in, and the gateway plug-in is configured through the gateway plug-in identifier. In this way, after the gateway plug-in is configured, the gateway system can load the gateway plug-in associated with the interface routing during the access process of the interface routing by reading the gateway plug-in identifier in the interface agent information.
[0091] Specific configuration methods may include but are not limited to file configuration methods, graphical configuration methods, code editing methods, etc., which are not limited here. For the file configuration method, the interface proxy information can be located through the configuration file of the gateway service, and then the configuration objects of each interface proxy can be determined in the interface proxy information. In the configuration object of the interface proxy, a new field is added to store the configuration object of the gateway plug-in, including the plug-in name, plug-in parameters, etc. For the graphical configuration method, the interface proxy can be selected for configuration through the graphical interface provided by the gateway service, and the interface proxy table can be displayed on the interface configuration page. The interface proxy information, such as path, backend service, etc., can be obtained through the interface proxy table. The interface proxy that needs to be configured with the gateway plug-in is selected, and the gateway plug-in is added to the corresponding plug-in list of the interface proxy. According to the parameter configuration area, the parameters of the gateway plug-in are configured. For the code editing method, the gateway routing rules and plug-in configuration can be defined through the routing configuration class. In the routing configuration class, the plug-in configuration logic can be added to the code by building the interface proxy and plug-in configuration.
[0092] In this embodiment, after configuring the gateway plug-in associated with the interface route, the plug-in configuration information of the gateway route includes at least the plug-in name and type, plug-in parameter settings, plug-in enable and disable settings, plug-in order and priority information, plug-in dependencies and resource configuration, etc.
[0093] 103. In response to the interface routing request of the gateway service node, traverse and access the interface routing according to the interface proxy information.
[0094] Among them, the interface routing request of the gateway service node refers to the process in which the request sent by the client is routed to the corresponding backend service interface through the gateway service node. The gateway service node acts as an intermediate layer here, which receives requests from different clients (such as web browsers, mobile applications, etc.), and can accurately forward these requests to the appropriate backend service interface according to the pre-configured routing rules, and then pass the response returned by the backend service back to the client. Specifically, the gateway service node maintains a set of routing rules, which are usually based on the URL path of the request, the request method, and certain information in the request header (such as host name, user agent, etc.) to determine the backend service interface to which the request should be routed. For example, when the client sends a request to the gateway service node, the requested URL is " / api / products", the gateway service node will look up the routing rules, find the corresponding backend service interface is the product service interface, and then forward the request to the product service interface.
[0095] In this embodiment, after receiving the interface routing request from the client, the gateway service node will read the pre-configured interface proxy information, where the interface proxy information records the interface routing identifier and the corresponding relationship, routing configuration rules and plug-in configuration information. The interface routing identifier can be used to obtain information such as the specific back-end service interface path and the actual address of the back-end service associated with each interface routing, which is used to clarify the forwarding path when requesting the routing. The interface configuration rules can be used to determine whether the received request meets the conditions of the interface routing. The plug-in configuration can determine the plug-in information of the interface routing configuration, such as the current limiting plug-in, the authentication plug-in, etc. These plug-ins will execute the corresponding functions in sequence during the request processing, affecting the forwarding and processing logic of the request.
[0096] Specifically, in the process of traversing the access interface routes according to the interface proxy information, the matching interface route set can be screened out based on the requested URL path and the route matching rules in the interface proxy information. For example, if the request path is / api / products / 123, all route matching shares starting with / api / products are searched in the interface proxy information for the interface route entries corresponding to the shares. Then, in the interface route set obtained from the preliminary screening, other matching conditions such as the request method are checked. If the request is a set method, the interface routes accessed using other methods are excluded, further narrowing the matching range of the interface routes to determine the accurately matched interface routes.
[0097] It is understandable that if only one interface route is fully matched after the above screening, this route is the target route to be used, and the gateway service node can forward the request to the corresponding backend service according to the backend service interface address specified in this routing rule. If multiple matching routing interfaces appear, the most appropriate route needs to be selected based on the priority of the route.
[0098] Through the above interface route matching process, the gateway service node can effectively traverse the access interface route according to the interface proxy information, accurately process various requests from the client, and correctly return the response of the backend service to the client.
[0099] 104. When any interface route is accessed, at least one gateway plug-in logic associated with the interface route is executed according to the plug-in configuration information of the interface route.
[0100] In this embodiment, the plug-in configuration information of the interface route can be used to determine whether the interface route is configured with a gateway plug-in. If the interface route is configured with a gateway plug-in, the plug-in logic is executed in the configuration order of the gateway plug-in. For example, the authentication plug-in is executed first to check whether the authorization information in the request is legal. Then, if there is a flow control plug-in, it is determined whether the current request exceeds the set flow limit, etc.
[0101] After the plug-in logic is executed and passes the relevant verification, the gateway service node will forward the client's request to the backend service interface address specified in the interface proxy information. During the forwarding process, the request may be processed additionally, such as adding request header information or appropriately converting the data format of the request body. Correspondingly, after the backend service interface receives and processes the request, it will return the corresponding response to the gateway service node. The gateway service node will process the response, for example, modify the response header according to the configuration or filter the sensitive data in the response body, and then return the processed response to the client, completing the response process of the entire interface routing request.
[0102] Specifically, the plug-in configuration information can specify the execution order of the plug-in, or execute it in the default order. In the process of executing each plug-in logic, the relevant context information of the request and response needs to be passed between the gateway plug-ins. For example, after the authentication plug-in is verified, the authenticated user-related information (such as user ID, role, etc.) can be added to the context object of the request, and the subsequent gateway plug-in (such as the permission verification plug-in, if any) can determine whether the user has the right to access specific resources based on this information. When all the gateway plug-in logic associated with the interface route is successfully executed in sequence, it means that the request has passed various verifications and processing at the plug-in level. At this time, the gateway service node can forward the request processed by the plug-in to the corresponding backend service for further processing according to the backend service address specified in the interface route configuration, wait for the backend service to return a response, and then return the response to the client according to the response processing rules of the gateway service node. In this way, when accessing the interface route, it can execute the associated various gateway plug-in logics in an orderly manner according to the plug-in configuration information of the interface route, ensuring that the request undergoes necessary function processing and security verification before being forwarded to the backend service.
[0103] The configuration method of the gateway plug-in provided in the embodiment of the present application is compared with the configuration method of the gateway plug-in by restarting the gateway service node in the current prior art. The present application adds at least one gateway plug-in logic associated with the interface route in the gateway service node, and the gateway plug-in logic is defined with a gateway plug-in identifier; the gateway plug-in identifier is used to configure the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node, and the plug-in configuration information of the interface route is obtained; in response to the interface route request of the gateway service node, the interface route is traversed and accessed according to the interface proxy information; when any interface route is accessed, the interface route is associated with at least one gateway plug-in logic according to the plug-in configuration information of the interface route. The whole process creates an association relationship between the interface route and the gateway plug-in in the interface proxy information of the gateway service node through the gateway plug-in identifier to realize the differentiated configuration of the interface route by the gateway plug-in. When the gateway service node is started, the dynamic pluggable loading of the gateway plug-in is realized through the plug-in configuration information.
[0104] In actual application scenarios, the gateway plug-in needs to be bound to the interface route in the gateway service node to take effect. The main function of the gateway service node is to receive external requests and forward them to the appropriate backend service. The routing interface determines the flow of requests. When the gateway plug-in is bound to the interface route, it can process the request while the request is forwarded along the route. Specifically, Figure 2 As shown, the above step 101 includes the following steps:
[0105] 201. Predetermine at least one plug-in function associated with an interface route in a gateway service node and a plug-in dependency relationship described by the plug-in function.
[0106] 202. Create at least one gateway plug-in according to the at least one plug-in function, so as to encapsulate the gateway plug-in logic implemented by the corresponding plug-in function through the gateway plug-in.
[0107] 203. Add the gateway plug-in logic encapsulated by the at least one gateway plug-in to the gateway service node according to the plug-in dependency relationship.
[0108] In this embodiment, the requirements of the gateway functions can be summarized according to the system business process of the gateway service to form a preliminary list of plug-in functions associated with the interface routing. After determining the preliminary list of plug-in functions, at least one plug-in function associated with the interface routing in the gateway node and the plug-in dependency described by the plug-in function can be determined in the plug-in document.
[0109] Generally, in order to facilitate users to understand and use plug-ins, plug-in documentation, as a document resource that describes the plug-in information in detail, can clearly explain the functions of the plug-in, mainly covering the plug-in's functions, usage methods, configuration parameters, dependencies, etc. Through the description of the plug-in documentation, users can quickly understand the various operations that the plug-in can achieve. Taking the graphic design plug-in as an example, the plug-in documentation will explain in detail how to draw, edit and combine graphics through various tools.
[0110] Specifically, the plug-in documentation can provide a detailed introduction to the plug-in functions, such as an overall overview of the plug-in functions, including functional features, application scenarios, etc. For example, the plug-in documentation for the monitoring function can provide key indicators such as traffic, response time, and error rate of the real-time monitoring gateway interface. The plug-in documentation can also provide a demonstration video or sample code of the plug-in function. By watching the demonstration video, you can directly watch the actual operation process and effect of the plug-in. The sample code can help understand how the plug-in interacts with the interface routing. Taking a data conversion plug-in as an example, the sample code can show how to convert an incoming XML format request to JSON format and how to perform this conversion in the context of the interface routing. The plug-in documentation can also provide the dependencies of the plug-in, including the software environment, other plug-ins, or libraries that the plug-in depends on to run. For example, a machine learning plug-in needs to rely on a specific version of a deep learning framework and list the framework version number, operating system compatibility, and other information.
[0111] Specifically, when creating at least one gateway plug-in according to at least one plug-in function, the plug-in architecture can be designed first, and the plug-in can be designed as a multi-layer architecture, for example, divided into a data access layer, a business logic layer, and a data output layer. The data access layer is responsible for receiving the request data from the gateway, the business logic layer processes the core functions of the plug-in (such as data conversion, security verification, etc.), and the data output layer returns the processed results to the gateway. This hierarchical structure helps to improve the maintainability and scalability of the code. The modules are further divided according to the plug-in functions. Taking the flow control plug-in as an example, it can be divided into a flow statistics module, a flow threshold judgment module, and a flow control execution module. The flow statistics module is responsible for counting the request flow of the interface, the flow threshold judgment module judges whether the flow exceeds the standard according to the preset threshold, and the flow control execution module takes corresponding control measures according to the judgment result. Then design the interface, and define the interface between the plug-in and the gateway service node for the external interface definition. The interface includes detailed definitions of input parameters and output parameters. For example, for a data encryption plug-in, the input parameters of the external interface may require encrypted data and encryption key related information, and the output parameters are the encrypted results. For internal interface planning, if there are multiple modules inside the plug-in, design a clear internal interface. These interfaces are used for data transmission and collaboration between modules. Finally, the plug-in logic process is coded and implemented according to the designed plug-in architecture and design interface, including the interface layer implementation and the core function layer implementation. During the interface layer implementation process, the request parameters passed by the gateway are carefully parsed to ensure data integrity and legality. The verified request data is passed to the corresponding module of the core function layer for processing, and the processing results returned by the core function layer are collected and assembled according to the interface specifications required by the gateway. In the process of implementing the core function layer, the code of each sub-function module is written separately according to the design. When multiple sub-function modules need to work together, a reasonable interaction mechanism is designed.
[0112] It is understandable that, based on the determined plug-in dependencies, the software components, libraries, other plug-ins or services that the gateway plug-in directly depends on at runtime can be determined. In addition to direct dependencies, some gateway plug-ins may also have indirect dependencies. For example, the dependent encryption algorithm library may in turn depend on the underlying operating system encryption module. Generally speaking, the gateway service node has a specific plug-in deployment mechanism, and the relevant parameters of the plug-in are set in the configuration file of the gateway service node according to the functional requirements and dependencies of the gateway plug-in. These parameters may include connection information of the dependent service and parameters related to the plug-in's own functions. Then, at least one gateway plug-in is integrated into the gateway service point according to the plug-in dependencies, so that the gateway plug-in logic encapsulated by the network management plug-in is added to the gateway service node.
[0113] Specifically, in the process of integrating the gateway plug-in into the gateway service node, the gateway service node usually has its own specific plug-in deployment mechanism, and it is necessary to determine the plug-in deployment method that meets the requirements of the gateway. Then, according to the functional requirements and dependencies of the plug-in, set the relevant parameters of the plug-in in the configuration file of the gateway service node, and in the configuration of the gateway service, clearly enable the plug-in and its execution order in the gateway processing flow, and associate the gateway plug-in with the interface route, so that when the request passes through the corresponding interface route, the gateway plug-in can intervene in the processing according to the set logic.
[0114] Furthermore, if Figure 3 As shown, before the above step 102, the method further includes the following steps:
[0115] 301. Create interface proxy information of the gateway service node in the database.
[0116] Accordingly, step 102 specifically includes the following steps:
[0117] 1021. Use the gateway plug-in identifier to establish a mapping relationship field between the interface route and the gateway plug-in in the gateway service node, so as to store a state field of the gateway plug-in and a sequence field of the gateway plug-in through the mapping relationship field.
[0118] 1022. Configure the enabled state of the interface route corresponding to the gateway plug-in in the interface proxy information of the gateway service node according to the state field of the gateway plug-in, and obtain configuration information of the plug-in state corresponding to the interface route.
[0119] 1023. According to the sequence field of the gateway plug-in, the activation sequence of the interface routes corresponding to the gateway plug-ins is configured in the interface proxy information of the gateway service node to obtain configuration information of the plug-in sequence corresponding to the interface routes.
[0120] In this embodiment, the interface proxy information is a series of key data for managing and controlling interface request forwarding in the gateway service node, including service configuration information of the interface route, which is used to guide the gateway service node on how to accurately send various external requests received to the appropriate back-end service for processing. For the interface proxy information, it can be stored in a special table, where the table structure needs to cover the key elements related to the interface route and the back-end service configuration information, including the interface route, such as the unique identifier of the interface route, the path of the interface route, etc., and also includes the service configuration aspects, such as the name of the back-end service, the actual access address of the back-end service, and the authentication type adopted by the service, etc., and also includes other auxiliary fields, such as the creation time and update time fields.
[0121] Accordingly, in order to enable the gateway service node to accurately call the corresponding gateway plug-in according to the interface route, the gateway plug-in identifier can be used to establish a mapping relationship field between the interface route and the gateway plug-in in the gateway service node. Here, the mapping relationship field includes a status field and a sequence field. The operation status of the gateway plug-in is grasped through the status field, and the order of execution of the plug-in gateway is determined through the sequence field, thereby achieving effective control and flexible configuration of the request processing process. In other words, the association relationship between the interface route and the gateway plug-in will be stored in the interface proxy information through the mapping relationship field. Specifically, the association relationship can be listed horizontally and vertically by different interface routes and gateway plug-ins, and the corresponding status field and sequence field information are stored in the intersecting cells. The configuration form of the corresponding gateway plug-in can be in a certain format and hierarchical structure. In the part describing the interface route, the gateway plug-in associated with the interface route and the corresponding status, sequence and other configuration information can be recorded by setting an area. Exemplarily, the interface route information after the gateway plug-in is configured is shown in Table 1 below:
[0122] Table 1. Interface proxy information
[0123]
[0124] In the above embodiment, by configuring the gateway plug-in in the interface proxy information, the gateway can effectively use the gateway plug-in identifier to build a mapping relationship field between the interface route and the gateway plug-in in the gateway service node during the actual processing of the interface routing request, and by reasonably managing the status and order of the gateway plug-in, the gateway service node can better adjust the collaboration between the interface route and the gateway plug-in to meet various business processing requirements.
[0125] In actual application scenarios, the gateway service node needs to be able to accurately identify paths of different formats, whether it is a simple fixed path or a wildcard path with fuzzy matching properties, and correctly extract and parse it. Specifically, Figure 4 As shown, the above step 103 includes the following steps:
[0126] 401. In response to an interface routing request from a gateway service node, parse key path information in the interface routing request.
[0127] 402. Perform routing path matching in the interface proxy information according to the key path information to obtain a routing path applicable to the interface routing request.
[0128] 403. Traverse the access interface route according to the routing path applicable to the interface route request.
[0129] In the present embodiment, the interface routing request is usually sent to the gateway service node following a certain network protocol (such as HTTP, HTTPS, etc.), specifically including multiple parts, and the key path information here is a key element for locating specific resources to be accessed or operations to be performed. Further, in an interface routing request, in addition to the key path information, there will also be a request method (GET, POST, etc.), a request header (comprising various metadata, such as client information, authorization information, etc.) and a request body (usually carrying specific data content in requests with data submission requirements such as POST, PUT, etc.). Specifically, different network protocols have their standard request formats, and the gateway service node can accurately extract the key path information according to the specifications of the corresponding protocol. By parsing the path information, the gateway service node can determine that the interface routing request accesses resources or performs operations in the back-end service.
[0130] It is understandable that the routing path rule in the interface proxy information can be an exact match, a prefix match, or a match containing a wildcard. After the gateway service node receives the interface routing request and parses the key path information, it is necessary to search for possible matching routing paths one by one in the interface proxy information, specifically starting from the first routing path stored in the interface proxy information, and comparing it with the key path information according to the established matching rules (exact match, prefix match, or wildcard match). In the exact match judgment process, if the routing path in the interface proxy information is exactly the same as the key path information, including the characters, order, and case (if case-sensitive) in the path, it is determined to be an exact match success. In the prefix match judgment process, it is necessary to check whether the key path information starts with the routing path in the interface proxy information. In the wildcard match judgment process, for the routing path containing wildcards, it is necessary to judge according to the wildcard rules.
[0131] It should be noted that in some cases, there may be multiple routing paths that can match the key path information. In this case, the final applicable routing path needs to be determined based on the pre-set matching priority. For example, the priority of exact matching is higher than that of prefix matching, and the priority of prefix matching is higher than that of wildcard matching.
[0132] Furthermore, before the above step 103, the method further includes the following steps:
[0133] The plug-in configuration information of the routing interface is loaded into the memory according to the interface proxy information.
[0134] Correspondingly, when accessing any interface route, it is determined whether the interface route is associated with a gateway plug-in according to the plug-in configuration information of the interface route; if so, at least one gateway plug-in logic associated with the interface route is executed; otherwise, the next interface route is accessed.
[0135] In this embodiment, the interface proxy information and the corresponding plug-in configuration information are usually stored in multiple places, specifically in a database, such as a relational database MySQL, PostgreSQL, etc., or a non-relational database Redis, MongoDB, etc., and can also be stored in a configuration file, the format of which may be YAML, JSON, Properties, etc., and can also be uniformly managed through a dedicated configuration management center.
[0136] Specifically, the plug-in configuration information can be sorted according to the interface route identifier, and the plug-in configuration information obtained and filtered from the database using the set data structure is sorted and stored in the memory in sequence. For example, for each interface route, the gateway plug-in identifier is first determined, and then the plug-in configuration information corresponding to the gateway plug-in identifier is stored in the plug-in configuration information list of the interface route in the order of the plug-in, and finally the plug-in configuration list is associated with the corresponding gateway plug-in identifier and stored in the memory, so that when the gateway service node needs to process a certain interface route request later, it can easily find the corresponding plug-in configuration information from the memory quickly, and then call the gateway plug-in according to the plug-in configuration information, arrange the execution order of the gateway plug-in, and manage the status of the gateway plug-in, etc., so that the operation of the entire gateway service node is smoother and more efficient.
[0137] Accordingly, in the process of the gateway service node actually processing the interface routing request, it will operate according to the mapping relationship established in the interface proxy information and the status field and sequence field stored therein. When the interface routing request reaches the gateway service node and matches any interface routing, the gateway service node will check whether the interface routing is associated with a gateway plug-in. If the interface routing is associated with a gateway plug-in, it will further obtain the status of the gateway plug-in, and call the enabled gateway plug-in in the order specified by the sequence field, and let these plug-ins process the interface routing request accordingly in turn, so as to ensure that the interface routing request can be processed smoothly according to the expected process and realize the normal operation of the system.
[0138] Further, before executing at least one gateway plug-in logic associated with the interface route, determining the execution order of the gateway plug-ins according to the plug-in configuration information of the interface route;
[0139] Correspondingly, at least one gateway plug-in logic associated with the interface routing is executed according to the execution order of the gateway plug-ins.
[0140] In the configuration of the gateway service, explicitly specify the gateway plug-ins to be enabled and the order in which they are executed in the gateway processing flow. This may involve associating the gateway plug-in with specific interface routes at the routing configuration level, so that when requests pass through these routes, the gateway plug-in can intervene according to the set logic. Figure 5 As shown, when the interface routing request reaches the gateway service node, the routing plug-in configuration, that is, the gateway plug-in associated with the interface routing, can be obtained by parsing the routing, and the interface routing is traversed to determine whether the interface routing has an associated gateway plug-in. If so, the plug-in logic is executed. If not, the next interface routing is accessed to determine whether the next interface routing has an associated gateway plug-in.
[0141] Furthermore, when adding new business functions or changing business processes, it is necessary to add or adjust the interface routing, data conversion rules and plug-in execution order related to the gateway plug-in, and trigger the update process of the gateway plug-in accordingly. Specifically, Figure 6 As shown, after the above step 104, the method further includes the following steps:
[0142] 501. In response to a change in plug-in configuration information, obtain the changed plug-in configuration information in the gateway service node.
[0143] 502. Broadcast the changed plug-in configuration information to all gateway service nodes connected to the database through a message component, so that all gateway service nodes replace the plug-in configuration information of the existing interface routing according to the changed plug-in configuration information.
[0144] Specifically, in the code of the gateway service, a monitoring module can be set up, which can periodically check the status of the plug-in configuration information. For example, read the plug-in configuration file or query the plug-in status in the interface proxy information in the database at regular intervals, and compare the obtained plug-in configuration information with the current plug-in configuration information, including the plug-in enable / disable status, plug-in parameters, such as key updates for authentication plug-ins, threshold changes for flow control plug-ins, etc. If the comparison results are inconsistent, the changed plug-in configuration information is recorded and broadcast to all gateway service nodes connected to the database.
[0145] When changes are found in the plugin configuration information, it is necessary to accurately extract the key parts of the gateway plugin changes from the numerous configuration data, which may include the name of the plugin, which specific parameters have changed, and the parameter values before and after the change. For example, the authentication method of a security authentication plugin has changed from the original "user name and password" to "token authentication". Accordingly, the plugin name "Security Authentication Plugin", the changed parameter "Authentication Method", the old value "User Name and Password" and the new value "Token Authentication" need to be extracted, organized into the plugin configuration information in the format that the message component can receive and process, and broadcast to all gateway service nodes connected to the database through the established connection and configured sending rules.
[0146] Correspondingly, after receiving the changed configuration information, the gateway service node connected to the database can replace the old plug-in configuration information in the memory with the new plug-in configuration information. When a new interface route request arrives, the new plug-in configuration information will be used to determine the gateway plug-in associated with the interface route. When the interface route is associated with the gateway plug-in, the new plug-in logic will be executed to achieve differentiated configuration and dynamic loading of plug-ins for the gateway service node.
[0147] In actual application scenarios, Figure 7 This is a flow chart of the configuration of the gateway plug-in in this embodiment. After the elbow service node is initialized, the gateway service node reads the plug-in configuration information of the interface route, returns the plug-in configuration information of the interface route, and loads the plug-in configuration information of the interface route into the memory with the interface route as the key. If the change of the gateway plug-in is started, all gateway plug-ins associated with the interface route are loaded after the gateway service node is started. The corresponding database makes corresponding modifications to the gateway plug-in associated with the interface route to update the plug-in configuration information and broadcast it to all gateway service nodes connected to the database through the message component, so that the gateway service node dynamically loads the changed plug-in configuration information, replaces the existing plug-in configuration information, and completes the dynamic loading of the plug-in.
[0148] Further, as Figure 1-Figure 7 The specific implementation of the method, the embodiment of the present application provides a configuration device of a gateway plug-in, such as Figure 8 As shown, the device includes: an adding unit 61, a configuring unit 62, an accessing unit 63, and an executing unit 64.
[0149] An adding unit 61 is used to add at least one gateway plug-in logic associated with the interface route in the gateway service node, wherein the gateway plug-in logic has a gateway plug-in identifier defined therein;
[0150] A configuration unit 62 is used to configure the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node by using the gateway plug-in identifier to obtain the plug-in configuration information of the interface route;
[0151] An access unit 63, configured to respond to an interface routing request of a gateway service node and traverse the access interface routing according to the interface proxy information;
[0152] The execution unit 64 is used to execute at least one gateway plug-in logic associated with any interface route according to the plug-in configuration information of the interface route when accessing the interface route.
[0153] The configuration device of the gateway plug-in provided by the embodiment of the present invention is compared with the configuration method of the gateway plug-in realized by restarting the gateway service node in the existing technology. The present application adds at least one gateway plug-in logic associated with the interface route in the gateway service node, and the gateway plug-in logic is defined with a gateway plug-in identifier; the gateway plug-in identifier is used to configure the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node to obtain the plug-in configuration information of the interface route; in response to the interface route request of the gateway service node, the interface route is traversed and accessed according to the interface proxy information; when any interface route is accessed, at least one gateway plug-in logic associated with the interface route is executed according to the plug-in configuration information of the interface route. The whole process creates an association relationship between the interface route and the gateway plug-in in the interface proxy information of the gateway service node through the gateway plug-in identifier to realize the differentiated configuration of the interface route by the gateway plug-in. When the gateway service node is started, the dynamic pluggable loading of the gateway plug-in is realized through the plug-in configuration information.
[0154] In actual application scenarios, the adding unit is specifically used for:
[0155] Predetermining at least one plug-in function associated with an interface route in a gateway service node and a plug-in dependency relationship described by the plug-in function;
[0156] Creating at least one gateway plug-in according to the at least one plug-in function, so as to encapsulate the gateway plug-in logic implemented by the corresponding plug-in function through the gateway plug-in;
[0157] The gateway plug-in logic encapsulated by the at least one gateway plug-in is added to the gateway service node according to the plug-in dependency.
[0158] In an actual application scenario, the device further includes:
[0159] A creation unit, configured to create the interface proxy information of the gateway service node in a database before configuring the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node using the gateway plug-in identifier to obtain the plug-in configuration information of the interface route, wherein the interface proxy information includes the service configuration information of the interface route;
[0160] Accordingly, the configuration unit is specifically used for:
[0161] Using the gateway plug-in identifier, a mapping relationship field between the interface route and the gateway plug-in is established in the gateway service node, so as to store the state field of the gateway plug-in and the sequence field of the gateway plug-in through the mapping relationship field;
[0162] According to the status field of the gateway plug-in, the enabled state of the interface route corresponding to the gateway plug-in is configured in the interface proxy information of the gateway service node, and the configuration information of the plug-in state corresponding to the interface route is obtained;
[0163] According to the sequence field of the gateway plug-in, the activation sequence of the gateway plug-in corresponding to the interface route is configured in the interface proxy information of the gateway service node to obtain the configuration information of the plug-in sequence corresponding to the interface route.
[0164] In an actual application scenario, the access unit is specifically used to:
[0165] Responding to the interface routing request of the gateway service node, parsing the key path information in the interface routing request;
[0166] Perform routing path matching in the interface proxy information according to the key path information to obtain a routing path applicable to the interface routing request;
[0167] The interface route is accessed by traversing the routing path applicable to the interface route request.
[0168] In an actual application scenario, the device further includes:
[0169] A loading unit, configured to load the plug-in configuration information of the routing interface into the memory according to the interface proxy information after traversing the access interface route according to the interface proxy information in response to the interface routing request of the gateway service node;
[0170] Accordingly, the execution unit is specifically used for:
[0171] When accessing any interface route, judging whether the interface route is associated with a gateway plug-in according to the plug-in configuration information of the interface route;
[0172] If so, at least one gateway plug-in logic associated with the interface route is executed; otherwise, the next interface route is accessed.
[0173] In actual application scenarios, the execution unit is further used to:
[0174] Before executing at least one gateway plug-in logic associated with the interface route, determining the execution order of the gateway plug-ins according to the plug-in configuration information of the interface route;
[0175] Correspondingly, at least one gateway plug-in logic associated with the interface routing is executed according to the execution order of the gateway plug-ins.
[0176] In an actual application scenario, the device further includes:
[0177] a changing unit, configured to obtain the changed plug-in configuration information in the gateway service node in response to the change of the plug-in configuration information after executing at least one gateway plug-in logic associated with the interface route according to the plug-in configuration information of the interface route when any interface route is accessed;
[0178] The broadcast unit is used to broadcast the changed plug-in configuration information to all gateway service nodes accessed by the database through the message component, so that all gateway service nodes replace the plug-in configuration information of the existing interface routing according to the changed plug-in configuration information.
[0179] It should be noted that for other corresponding descriptions of the functional units involved in the configuration device of a gateway plug-in provided in this embodiment, reference can be made to Figure 1-Figure 7 The corresponding description in will not be repeated here.
[0180] Based on the above Figure 1-Figure 7 The method shown in the embodiment of the present application accordingly provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Figure 1-Figure 7 The configuration method of the gateway plug-in is shown.
[0181] Based on this understanding, the technical solution of the present application 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-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0182] Based on the above Figure 1-Figure 7 The method shown, and Figure 8 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides a physical device configured with a gateway plug-in, which can be a computer, a smart phone, a tablet computer, a smart watch, a server, or a network device, etc. The physical device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1-Figure 7 The configuration method of the gateway plug-in is shown.
[0183] Optionally, the physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0184] In an exemplary embodiment, see Fig. 9The physical device includes a communication bus, a processor, a memory and a communication interface, and may also include an input / output interface and a display device, wherein each functional unit can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the configuration method of the gateway plug-in in the above embodiment.
[0185] Those skilled in the art will appreciate that the physical device structure of a gateway plug-in configuration provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0186] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the physical device for the configuration processing of the above-mentioned gateway plug-in, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.
[0187] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware. By applying the technical solution of the present application, compared with the current existing methods, the present application creates an association between the interface route and the gateway plug-in in the interface proxy information of the gateway service node through the gateway plug-in identifier to achieve differentiated configuration of the interface route by the gateway plug-in. When the gateway service node is started, the dynamic pluggable loading of the gateway plug-in is achieved through the plug-in configuration information.
[0188] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0189] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A method for configuring a gateway plug-in, characterized in that: include: Add at least one gateway plug-in logic associated with the interface route in the gateway service node, wherein the gateway plug-in logic has a gateway plug-in identifier defined therein; Using the gateway plug-in identifier, configuring the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node to obtain the plug-in configuration information of the interface route; In response to the interface routing request of the gateway service node, traverse the access interface routing according to the interface proxy information; When any interface route is accessed, at least one gateway plug-in logic associated with the interface route is executed according to the plug-in configuration information of the interface route.
2. The method according to claim 1, characterized in that The step of adding at least one gateway plug-in logic associated with an interface route in the gateway service node includes: Predetermining at least one plug-in function associated with an interface route in a gateway service node and a plug-in dependency relationship described by the plug-in function; Creating at least one gateway plug-in according to the at least one plug-in function, so as to encapsulate the gateway plug-in logic implemented by the corresponding plug-in function through the gateway plug-in; The gateway plug-in logic encapsulated by the at least one gateway plug-in is added to the gateway service node according to the plug-in dependency relationship.
3. The method according to claim 1, characterized in that Before configuring the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node using the gateway plug-in identifier to obtain the plug-in configuration information of the interface route, the method further includes: Create interface proxy information of the gateway service node in the database, wherein the interface proxy information includes service configuration information of the interface route; Correspondingly, the gateway plug-in identifier is used to configure the gateway plug-in associated with the interface route in the interface proxy information of the gateway service node to obtain the plug-in configuration information of the interface route, including: Using the gateway plug-in identifier to establish a mapping relationship field between the interface route and the gateway plug-in in the gateway service node, so as to store the status field of the gateway plug-in and the sequence field of the gateway plug-in through the mapping relationship field; According to the status field of the gateway plug-in, the enabled state of the interface route corresponding to the gateway plug-in is configured in the interface proxy information of the gateway service node to obtain configuration information of the plug-in state corresponding to the interface route; The enabling order of the gateway plug-in corresponding to the interface route is configured in the interface proxy information of the gateway service node according to the order field of the gateway plug-in, and configuration information of the plug-in order corresponding to the interface route is obtained.
4. The method according to claim 1, wherein The step of responding to the interface routing request of the gateway service node and traversing the access interface routing according to the interface proxy information includes: Responding to the interface routing request of the gateway service node, parsing the key path information in the interface routing request; Perform routing path matching in the interface proxy information according to the key path information to obtain a routing path applicable to the interface routing request; The interface route is traversed according to the routing path applicable to the interface route request.
5. The method according to claim 1, wherein After responding to the interface routing request of the gateway service node and traversing the access interface routing according to the interface proxy information, the method further includes: Loading the plug-in configuration information of the routing interface into the memory according to the interface proxy information; Accordingly, when any interface route is accessed, the gateway plug-in logic associated with the interface route is executed according to the plug-in configuration information of the interface route, including: When accessing any interface route, determine whether the interface route is associated with a gateway plug-in based on the plug-in configuration information of the interface route; If so, execute at least one gateway plug-in logic associated with the interface route; otherwise, access the next interface route.
6. The method according to claim 5, characterized in that Before executing at least one gateway plug-in logic associated with the interface routing, the method further includes: Determining the execution order of the gateway plug-ins according to the plug-in configuration information of the interface routing; Correspondingly, at least one gateway plug-in logic associated with the interface routing is executed according to the execution order of the gateway plug-ins.
7. The method according to any one of claims 1 to 6, characterized in that After executing at least one gateway plug-in logic associated with any interface route according to the plug-in configuration information of the interface route when any interface route is accessed, the method further includes: In response to a change in the plug-in configuration information, obtaining the changed plug-in configuration information in the gateway service node; The changed plug-in configuration information is broadcasted to all gateway service nodes connected to the database through a message component, so that all gateway service nodes replace the plug-in configuration information of the existing interface routing according to the changed plug-in configuration information.
8. A gateway plug-in configuration device, characterized in that: include: An adding unit, configured to add at least one gateway plug-in logic associated with an interface route in a gateway service node, wherein a gateway plug-in identifier is defined in the gateway plug-in logic; A configuration unit, configured to configure a gateway plug-in associated with an interface route in the interface proxy information of the gateway service node using the gateway plug-in identifier, and obtain plug-in configuration information of the interface route; an access unit, configured to respond to an interface routing request of the gateway service node and traverse the access interface routing according to the interface proxy information; The execution unit is configured to execute at least one gateway plug-in logic associated with any interface route according to the plug-in configuration information of the interface route when accessing the interface route.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the gateway plug-in configuration method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the gateway plug-in configuration method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Plug-in management method
CN121187670A
Gateway plug-in system based on WASM
CN121907636A