CN115883353A - Routing plug-in arranging and executing system based on Spring Cloud Gateway in trusted environment - Google Patents

Routing plug-in arranging and executing system based on Spring Cloud Gateway in trusted environment Download PDF

Info

Publication number
CN115883353A
CN115883353A CN202211572564.3A CN202211572564A CN115883353A CN 115883353 A CN115883353 A CN 115883353A CN 202211572564 A CN202211572564 A CN 202211572564A CN 115883353 A CN115883353 A CN 115883353A
Authority
CN
China
Prior art keywords
plug
route
ins
arranging
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211572564.3A
Other languages
Chinese (zh)
Inventor
倪坚
刘相
高阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Primeton Information Technology Co ltd
Original Assignee
Primeton Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Primeton Information Technology Co ltd filed Critical Primeton Information Technology Co ltd
Priority to CN202211572564.3A priority Critical patent/CN115883353A/en
Publication of CN115883353A publication Critical patent/CN115883353A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention relates to a system for arranging and executing a plug-in on a route based on a Spring Cloud Gateway in a trusted environment, wherein the system comprises: the plug-in definition module is used for defining and developing standard plug-ins on the management operation and maintenance platform according to the gateway plug-in development and use specification; the route definition module is used for defining different types of API requests for the management operation and maintenance platform according to the route definition to establish a route rule and binding the API requests to a specific route according to the set rule; the plug-in arranging module is connected with the route defining module and is used for selecting plug-ins on the route and selecting a plug-in to be executed from the plug-in library and an execution sequence among a plurality of plug-ins; and the plug-in running module is used for executing the logic of each plug-in according to the arranging definition of the plug-ins on the route. The system for arranging and executing the plug-in on the route based on the Spring Cloud Gateway in the trusted environment solves the problem of graphical route configuration mode of a user based on the Spring Cloud Gateway.

Description

Routing plug-in arranging and executing system based on Spring Cloud Gateway in trusted environment
Technical Field
The invention relates to the technical field of computer software, in particular to the technical field of API (application program interface) gateways, and specifically relates to a system for arranging and executing plug-ins on a route based on a Spring Cloud Gateway in a trusted environment.
Background
With the digital transformation of enterprises, the technical architecture of application systems of many enterprises is transformed from the traditional single application to the micro-service architecture, under the micro-service, the calling between applications is carried out through the API, and the integration between systems is also transformed from the traditional ESB mode to the API gateway mode.
The API Gateway is essential basic software for an enterprise to construct a system based on Cloud native application and a micro service architecture, the mainstream micro service Gateway in the market at present has Kong, zuul, spring Cloud Gateway and the like, and is used as a key pivot for accessing and receiving the API of the enterprise, the API Gateway bears the realization of a plurality of general functions such as unified identity authentication, access log, flow control, load balancing, request anti-duplication, protocol conversion, gray scale, data caching, data encryption, data desensitization and the like, the functions are usually provided in a Gateway plug-in mode, but the plug-in provided by the API Gateway at present cannot provide fine-grained control, for example, data returned by a certain specific API cannot be configured for desensitization or encryption, professional developers are required to carry out extension development support for realizing the functions, and for different APIs, some need to carry out flow control, some need to record access log information, some need to carry out protocol conversion, some need to specify the execution sequence of the plug-in, and the like, the Gateway at present cannot provide control of plug-in selection and execution sequence, many users are required to carry out flexible configuration, and the development of scenes is increased.
At present, a Spring Cloud Gateway has no concept of plug-in, functions such as flow control and identity authentication are mainly realized through a filter, a component provides a global filter and a Gateway filter base class, a developer expands development, program packaging and medium deployment based on the filter base class to complete the functions, operations such as access record and request repetition prevention are required to be performed on all requests entering the Gateway, the functions are realized by defining the global filter, operations such as flow control and gray scale which are specified to be performed on a specific route are realized by defining the Gateway filter, and related route filters are configured on the route in a configuration file configuration mode. And for the control of the API fine granularity, selecting the API access request meeting the condition by configuring the assertion on the route.
Please refer to fig. 1, which shows the request processing procedure of Spring Cloud Gateway, mainly the execution mechanism of the filter and the selection procedure of the assertion for the route:
spring.cloud.gateway.routes[0].uri=lb:http://servicedemo-auto
spring.cloud.gateway.routes[0].predicates[0]=Path=/**
spring.cloud.gateway.routes[0].filters[0].name=RedirectTo
spring.cloud.gateway.routes[0].filters[0].args.status=306
spring.cloud.gateway.routes[0].filters[0].args.url=https://www.baidu.com/
the above is the configuration of the Spring Cloud Gateway, which provides configuration of the assertion, configuration of the filter, and the final proxy address.
As can be known from the principle of the Spring closed Gateway, the Spring closed Gateway has many defects in enterprise application: for example, configuration is performed in a configuration file manner, a configurator needs to understand a syntax format and the meaning of each configuration item, a gateway cannot be started due to slight deviation, and the gateway can be restarted to take effect after route configuration is added in the configuration manner each time; the expansion development is carried out in a filter mode, the hot plug of the function cannot be carried out, and operation and maintenance personnel cannot know which expansion capabilities are provided in the gateway, and the routing configuration needs to depend on the development personnel or detailed operation instructions; measures such as current limiting, desensitization and the like cannot be dynamically adjusted and configured according to service scenes in the running process of the gateway, for example, a certain API needs to limit current for calling a specific object at 10-20 points in a peak time period, or needs to desensitize a sensitive field in API return information according to a calling party; the filter execution sequence configured on a certain route cannot be dynamically adjusted, the operation and maintenance manager cannot intuitively know the execution logic of the request after the request enters the gateway, and the route is configured with the filters of identity authentication, flow control and the like, so that the identity authentication or the flow control is executed at first.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a system for arranging and executing plug-in on a route based on a Spring Cloud Gateway in a trusted environment supporting dynamic configuration of the route.
In order to achieve the above object, the system for arranging and executing the plug-in on the route based on the Spring Cloud Gateway in the trusted environment of the present invention is as follows:
the system for arranging and executing the plug-in on the route based on the Spring Cloud Gateway in the trusted environment is mainly characterized in that the system comprises:
the plug-in definition module is used for defining and developing standard plug-ins on the management operation and maintenance platform according to the gateway plug-in development and use specification;
the route definition module is used for defining different types of API requests for the management operation and maintenance platform according to the route definition to establish a route rule and binding the API requests to a specific route according to the set rule;
the plug-in arranging module is connected with the route defining module and is used for selecting plug-ins on a route and selecting a plug-in to be executed from the plug-in library and an execution sequence among a plurality of plug-ins; and
and the plug-in running module is used for executing the logic of each plug-in according to the arranging definition of the plug-ins on the route.
Preferably, the plug-in definition module specifically includes:
the data persistence component is connected with a plug-in management module of the management operation and maintenance platform, stores generated data through the plug-in management module, and performs plug-in definition and binding of a resource package;
and the metadata management unit is connected with a front-end form rendering module of the management operation and maintenance platform and acquires the plug-in metadata through the front-end form rendering module.
Preferably, the route definition module specifically includes:
the routing management unit is used for configuring routing related information including assertion, proxy address and plug-in, storing the routing related information into a Json description file, storing the corresponding description file into a relational database table through a persistence component, and synchronously storing the corresponding description file into Redis; the gateway engine dynamically acquires the routing information by subscribing the Redis message and loads the routing object into the memory, thereby realizing the dynamic routing capability.
Preferably, the plug-in arrangement module specifically includes:
the plug-in arranging module is connected with the route management unit and is used for arranging and processing plug-ins on a specific route, selecting plug-ins needing to be executed on the route from all enabled plug-ins in a graphical mode, adjusting the execution sequence of the plug-ins, reading the running metadata information of the plug-ins, rendering the metadata into a form through a form rendering interface, configuring the value of the running metadata, storing the description of arranging the plug-ins and binding the description to the route.
Preferably, the plug-in arrangement module performs the following processing:
(1) Selecting a plug-in;
(2) Judging whether to perform user-defined page processing, if so, directly reading Vue pages; otherwise, directly reading the plug-in metadata;
(3) Performing page rendering processing through the form rendering interface;
(4) And performing configuration processing on the operating parameters of the plug-in needing to be enabled.
Preferably, the page rendering process specifically includes:
aiming at a self-defined page, directly finding a vue file corresponding to a file name under a front-end plugin directory during rendering according to the plug-in name, and displaying the file in a div mode on an interface;
and aiming at the metadata of the plug-in, dynamically displaying the page according to the data type, the field name, the description, the input prompt, the check rule and the related information whether the data needs to be filled in defined by the metadata during rendering.
Preferably, the plug-in running module specifically performs the following processing:
and after the request reaches the gateway, carrying out matching processing of a specific route, and calling corresponding plug-in codes by a Spring closed gateway kernel according to the sequence of the plug-in arrangement on the route.
By adopting the system for arranging and executing the plug-ins on the routing based on the Spring Cloud Gateway in the trusted environment, the concept of the filter is abstracted into the plug-ins, the plug-ins are subjected to definition management and metadata configuration, so that operation and maintenance personnel can manage functions developed based on the extension of the filter as the plug-ins, perform hot plug, starting and stopping and other operations on the plug-ins, and simultaneously configure the routing in a graphical mode, can configure assertion and relevant plug-in selection, can arrange the selected plug-ins in a dragging mode, execute the selected plug-ins according to the arranging sequence during execution, support the dynamic configuration of the routing to take effect, meet the requirements in a specific service scene, and enhance the adaptability of the Gateway. The method solves the problem that a user takes effect in time due to a graphical route configuration mode based on the Spring closed gateway, achieves the capability of dynamically managing the filter by the user, carries out hot plug on the filter, meets the complex requirements of the user in many actual service scenes due to the adoption of an arranging mode and arbitrary combination of various plug-ins, and improves the adaptability and the usability of the gateway.
Drawings
FIG. 1 is a flowchart of a Spring Cloud Gateway request processing procedure.
Fig. 2 is a schematic structural diagram of a system for arranging and executing a plug-in on a route based on a Spring Cloud Gateway in a trusted environment of the present invention.
Fig. 3 is a schematic structural diagram of a plug-in definition module according to the present invention.
Fig. 4 is a schematic structural diagram of a route definition module according to the present invention.
Fig. 5 is a schematic structural diagram of the plug-in arranging module of the present invention.
Fig. 6 is a schematic diagram of a format of a defined route description file when performing route configuration according to the present invention.
FIG. 7 is a diagram illustrating the arrangement of plug-ins on a route definition according to the present invention.
Detailed Description
In order that the technical contents of the present invention can be more clearly described, the present invention will be further described with reference to specific embodiments.
Before describing in detail embodiments that are in accordance with the present invention, it should be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 2, the system for arranging and executing the plug-in on the route based on the Spring Cloud Gateway in the trusted environment includes:
the plug-in definition module is used for defining and developing standard plug-ins on the management operation and maintenance platform according to the gateway plug-in development and use specification;
the route definition module is used for defining different types of API requests for the management operation and maintenance platform according to the route definition to establish a route rule and binding the API requests to a specific route according to the set rule;
the plug-in arranging module is connected with the route defining module and is used for selecting plug-ins on the route and selecting a plug-in to be executed from the plug-in library and an execution sequence among a plurality of plug-ins; and
and the plug-in running module is used for executing the logic of each plug-in according to the arranging definition of the plug-ins on the route.
Referring to fig. 3, as a preferred embodiment of the present invention, the plug-in definition module specifically includes:
the data persistence component is connected with a plug-in management module of the management operation and maintenance platform, stores generated data through the plug-in management module, and performs plug-in definition and binding of a resource package;
and the metadata management unit is connected with a front-end form rendering module of the management operation and maintenance platform and acquires the plug-in metadata through the front-end form rendering module.
In practical application, the plug-in definition module enables a user to define plug-ins, such as a data desensitization plug-in and a data encryption and decryption plug-in, on a management platform, fill in related plug-in attributes, upload a code deployment package corresponding to the plug-ins (because the plug-ins are developed based on a springCloudgateway extension, the deployment package is compiled and packaged into a jar file based on an Abstract gateway Filter factory base class extension), bind the plug-in definition with the jar package, define metadata of the plug-ins through a plug-in configuration interface, such as which external environments the plug-ins need to depend on when starting and configuration parameters needed when the plug-ins run, enable the plug-ins after configuration is completed, and select the plug-ins when defining a route after the plug-ins are enabled.
Referring to fig. 4, as a preferred embodiment of the present invention, the route definition module specifically includes:
the routing management unit is used for configuring routing related information including assertion, proxy address and plug-in, storing the routing related information into a Json description file, storing the corresponding description file into a relational database table through a persistence component, and synchronously storing the corresponding description file into Redis; the gateway engine dynamically acquires the routing information by subscribing the Redis message and loads the routing object into the memory, thereby realizing the dynamic routing capability.
In practical application, the route defining module mainly enables a user to define a Router object of the Spring Cloud Gateway through a graphical interface, configure route related information including assertion, proxy address and plug-in, store the route related information into a Json description file, store the description file into a relational database table and synchronously store the description file into Redis, dynamically acquire route information by subscribing Redis information through a Gateway, and load the route object into a memory, thereby realizing the capability of dynamic routing.
As a preferred embodiment of the present invention, the plug-in arranging module specifically includes:
the plug-in arranging module is connected with the route management unit and is used for arranging and processing plug-ins on a specific route, selecting plug-ins needing to be executed on the route from all enabled plug-ins in a graphical mode, adjusting the execution sequence of the plug-ins, reading the running metadata information of the plug-ins, rendering the metadata into a form through a form rendering interface, configuring the value of the running metadata, storing the description of arranging the plug-ins and binding the description to the route.
Referring to fig. 5, as a preferred embodiment of the present invention, the plug-in arranging module specifically performs the following processes:
(1) Selecting a plug-in;
(2) Judging whether to perform user-defined page processing, if so, directly reading Vue pages; otherwise, directly reading the plug-in metadata;
(3) Performing page rendering processing through the form rendering interface;
(4) And performing configuration processing on the operating parameters of the plug-in needing to be enabled.
In practical application, the plugin layout module mainly performs the layout of plugins on a certain route, selects plugins needing to be executed on the route from all enabled plugins in a graphical mode, adjusts the execution sequence of the plugins, reads the running metadata information (metadata mainly comprises configuration metadata and running metadata) of the plugins, renders the metadata into a form through a form rendering interface, configures the value of the running metadata, and stores the description of the layout of the plugins and binds the description to the route.
The page rendering is divided into two types, one type is a self-defined page, a vue file corresponding to a file name is found under a front-end plugin directory directly according to a plugin name during rendering and is displayed on an interface in a div mode, and the other type is a page is dynamically displayed by the plug-in metadata rendering according to information such as a data type, a field name, description, input prompt, check rule, whether to be filled and the like defined by metadata.
As a preferred embodiment of the present invention, the page rendering process specifically includes:
aiming at a self-defined page, directly finding a vue file corresponding to a file name under a front-end plugin directory during rendering according to the plug-in name, and displaying the file in a div mode on an interface;
and aiming at the metadata of the plug-in, dynamically displaying the page according to the data type, the field name, the description, the input prompt, the check rule and the related information whether the data needs to be filled in defined by the metadata during rendering.
As a preferred embodiment of the present invention, the plug-in running module specifically performs the following processing:
and after the request reaches the gateway, carrying out matching processing of a specific route, and calling corresponding plug-in codes by a Spring closed gateway kernel according to the sequence of the plug-in arrangement on the route.
In the specific implementation manner of the present invention, the technical solution is implemented based on the Spring Cloud Gateway framework of Java language, so that all english words appearing in the text are Java terms and codes, and the specific implementation steps of the plug-in arrangement and execution method based on the Spring Cloud Gateway are as follows:
1. user plug-in development and definition
The module comprises the following specific implementation steps:
1) Creating database tables needed by plug-in storage, wherein one plug-in table is used for storing plug-in basic information, and the other plug-in metadata table is used for storing plug-in metadata information
CREATE TABLE`api_plugin`(
`ID`varchar(128)CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT'primary key id',
"NAME ' varchar (62) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NOT NULL COMMENT ' plug-in NAME ',
"DESCRIBES ' varchar (255) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' plug-in description (Chinese name) ',
TYPE _ CODE ' varchar (4) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT common ' plug-in TYPE (1 = = route '),
"ICON ' varchar (128) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' plug-in picture ',
the 'CONFIG' text CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL COMMENT 'plug-in processing configuration',
"ROLE" varchar (64) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT 'ROLE',
'SORT' int (11) NULL DEFAULT NULL COMMENT 'ordering',
"CUSTOM _ STATUS ' varchar (4) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' CUSTOM page field (0: closed, 1: open) ',
"DESCRIPTIONS" varchar (255) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT' detailed description,
"ENABLED ' varchar (4) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT '0' COMMENT ' state (0,not open,1 open) ',
"CREATE _ BY ' varchar (64) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' creator ',
"CREATE _ DATE ' DATE NULL DEFAULT CURRENT _ TIMESTAMP COMMENT ' creation time ',
"UPDATE _ BY ' varchar (64) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' UPDATE time ',
UPDATE time 'UPDATE _ DATE' data NULL DEFAULT _ TIMESTAMP COMMENT 'UPDATE time',
PRIMARY KEY(`ID`)USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 cold = utf8mb4_ unicode _ ci common = 'plug-in table' ROW _ FORMAT = DYNAMIC;
CREATE TABLE`api_plugin_handle`(
`ID`varchar(128)CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT'primary key id',
"PLUGIN _ ID ' varchar (128) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NOT NULL COMMENT ' plug-in ID ',
"FIELD ' varchar (100) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NOT NULL COMMENT ' FIELD ',
"LABEL 'varchar (100) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT' description,
"DATA _ TYPE ' varchar (6) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NOT NULL DEFAULT '1' COMMENT ' DATA TYPE 1number 2string ',
the TYPE of the field of the TYPE TYPE _ CODE ' varchar (10) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci DEFAULT NULL COMMENT ' field, 1means selector,2means rule,3means plug ',
' SORT ' double (11) NULL DEFAULT NULL COMMENT ' sorting,
whether or not the "" REQUIRED "" varchar (4) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT 'must be filled (0 is not 1 must be filled)',
DEFAULT _ VALUE ' VARCHAR (255) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' Default VALUE ',
"PLACE _ HOLDER ' varchar (255) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' input prompt ',
"RULE ' varchar (255) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' check RULE ',
`EXT_OBJ`varchar(4096)CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT'extra configuration(j son format data)',
"CREATE _ BY ' varchar (64) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' creator ',
"CREATE _ DATE ' data NULL DEFAULT CURRENT _ TIMESTAMP COMMENT ' creation time ',
'UPDATE _ DATE' data NULL DEFAULT CURRENT _ TIMESTAMP COMMENT 'UPDATE person',
"UPDATE _ BY ' varchar (64) CHARACTER SET utf8mb4 COLLATE utf8mb4_ unicode _ ci NULL DEFAULT NULL COMMENT ' UPDATE time ',
PRIMARY KEY(`ID`)USING BTREE,
UNIQUE INDEX`plugin_id_field_type`(`PLUGIN_ID`,`FIELD`,`TYPE_CODE`)USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 cold = utf8mb4_ unicode _ ci common = 'plug-in metadata table' ROW _ FORMAT = DYNAMIC;
2) Plug-in development creates projects through idea and other java development tools and increases the dependence of spring closed gateway
Figure BDA0003988697210000081
Writing plug-in function real-time code class, inheriting abstract gateway Filter factory, and implementing plug-in code logic in application method
Figure BDA0003988697210000082
And modifying the code logic of the config class, wherein the main purpose is that the config object is resolved into the metadata parameter of the plug-in operation.
3) The codes are packaged into a byte code jar package which can be translated by a java virtual machine through a development tool idea or eclipse, the name of a jar file needs to be consistent with the name of a plug-in, and the plug-in needs to load and unload corresponding jar according to the name of the plug-in when hot plug is carried out.
4) For the implementation of a self-defined form of a plug-in, a user is required to implement the form through a front-end development tool, data of the form is packaged into json data of a config object of the plug-in, a form page is stored into a plug-in name, the file format of vue is stored into a plugin directory, when the form is rendered, the plug-in firstly judges whether the plug-in is the self-defined form, if so, the vue file is found from the plugin directory according to the plug-in name and is directly loaded and displayed, and if not, a form interface is dynamically rendered according to metadata information defined by the plug-in.
5) And realizing the persistence function of the plug-in, creating a plug-in definition through the page, and uploading the resource package jar file of the plug-in to a plugin directory of the server.
6) And starting the plug-in, pushing the corresponding plug-in resource package file to the gateway, storing the file to the gateway according to the plugins of the directory, and calling the file by the plug-in running module.
2. The routing definition configuration is carried out to realize the dynamic update of the routing
The module comprises the following specific implementation steps:
1) As shown in FIG. 6, the format of the routing description file is defined
Json format
Properties Description of the invention
Id Unique identification of route definition
Name Route name
Order Order priority, in case of multiple route matching, the order value is small
Gatewaycode The code of the route is released to the gateway, and the corresponding gateway loads the route
Rulejson Plug-in orchestration rule description
Singleroute Reservation
State If the routing is started, only the starting routing gateway can be loaded
Relation table
2) And defining the route at the front end, splicing the input parameters into a format defined in the step one, storing the format into a relation table and pushing the format into redis. The method comprises the steps that storage needs in a relation table are consistent with redis storage, the relation table is read and initialized when the redis is started, a key definition during the redis storage needs to be in a format of 'gtw [ API-GATEWAY-DEVELOPER ]. Route.id [1402]. Route', wherein the API-GATEWAY-DEVELOPER is used for identifying which GATEWAY the route is pushed to, a unique identification id program for identifying the route 1402 is used for realizing subscription monitoring of redis data change events, a message Listener interface is inherited, an onMessage method is rewritten, whether redis the redis data delset or not is judged firstly through message.
3) And constructing a route routing object according to the data of the redis, realizing a route routing interface, rewriting save, delete, getRouteDefinitions and other methods, and realizing dynamic update of the route.
3. Orchestration of plug-ins on route definitions
1) As shown in fig. 7, in this embodiment, a user may perform plugin layout on a route definition interface, select a plugin to be laid out, and set an execution sequence and an operation parameter of each plugin to be laid out. Specifically, a user selects a plurality of plug-ins from a plug-in list of a plug-in arrangement interface according to the needs of a service scene, icons and names of the plug-ins are displayed on the interface according to a default sequence by the selected plug-in list, and the user can adjust and execute the sequence among the plug-ins in a dragging mode. And the user configures the operation parameters of each plug-in unit one by one according to the service logic of the function to be realized and the dragging sequence, wherein the operation parameters are dynamically displayed according to metadata defined by the plug-in units, the character type, the numerical value type or the date type display control type can be determined according to metadata description, whether the parameters need to be filled in or not can be judged according to the metadata when the parameters are submitted, the prompting words of the required items are displayed, and the input verification is carried out according to the verification rule. And finally, the client side obtains the plug-in arrangement data of the user by identifying the dragging operation, the clicking operation and the inputting operation of the user, binds the data to the route, and submits the data to the server side by the dynamic route definition.
4. Plug-in runtime creation and execution of plug-in orchestration
1) In this embodiment, an event listener is created on the gateway, an instruction for enabling the plugin by the user is monitored, a specific instruction can be sent by clicking a button on the interface, after the instruction is monitored by the event listener, if the instruction is an enabling instruction, the operating environment finds a corresponding jar packet file from a plugin directory, and injects class in the jar file into a Spring IOC container in a classload manner, and if the instruction is a disabling instruction, a bean object related to the plugin in the IOC container is destroyed.
2) In the running process of the Gateway, a request reaches the Gateway, a Spring Cloud Gateway inner core is matched with a specific route, the arrangement data of the plug-ins on the route is obtained according to dynamically defined route information, the plug-ins needing to be executed are determined, the execution sequence is determined, then the Bean objects corresponding to the plug-ins in the Spring IOC container are called one by one according to the execution sequence of the plug-ins, the plug-in running parameters in the route definition are transmitted to the config of the Bean objects, and the Spring Cloud Gateway inner core executes the Aply method in the plug-ins to complete the service logic function of the plug-ins.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution device.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, and the program may be stored in a computer readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of terms "an embodiment," "some embodiments," "an example," "a specific example," or "an embodiment," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
By adopting the system for arranging and executing the plug-ins on the routing based on the Spring Cloud Gateway in the trusted environment, the concept of the filter is abstracted into the plug-ins, the plug-ins are subjected to definition management and metadata configuration, so that operation and maintenance personnel can manage functions developed based on the extension of the filter as the plug-ins, perform hot plug, starting and stopping and other operations on the plug-ins, and simultaneously configure the routing in a graphical mode, can configure assertion and relevant plug-in selection, can arrange the selected plug-ins in a dragging mode, execute the selected plug-ins according to the arranging sequence during execution, support the dynamic configuration of the routing to take effect, meet the requirements in a specific service scene, and enhance the adaptability of the Gateway. The method solves the problem that a user takes effect in time due to a graphical route configuration mode based on the Spring closed gateway, achieves the capability of dynamically managing the filter by the user, carries out hot plug on the filter, meets the complex requirements of the user in many actual service scenes due to the adoption of an arranging mode and arbitrary combination of various plug-ins, and improves the adaptability and the usability of the gateway.
In this specification, the invention has been described with reference to specific embodiments thereof. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.

Claims (7)

1. A system for arranging and executing plug-ins on a route based on a Spring Cloud Gateway in a trusted environment, the system comprising:
the plug-in definition module is used for defining and developing a standard plug-in on the management operation and maintenance platform according to the gateway plug-in development and use specification;
the route definition module is used for defining different types of API requests for the management operation and maintenance platform according to the route definition to establish a route rule and binding the API requests to a specific route according to the set rule;
the plug-in arranging module is connected with the route defining module and is used for selecting plug-ins on the route and selecting a plug-in to be executed from the plug-in library and an execution sequence among a plurality of plug-ins; and
and the plug-in running module is used for executing the logic of each plug-in according to the arranging definition of the plug-ins on the route.
2. The system for arranging and executing the plug-in on the routing based on the Spring Cloud Gateway in the trusted environment according to claim 1, wherein the plug-in definition module specifically comprises:
the data persistence component is connected with a plug-in management module of the management operation and maintenance platform, stores generated data through the plug-in management module, and performs plug-in definition and binding of a resource package;
and the metadata management unit is connected with a front-end form rendering module of the management operation and maintenance platform and acquires the plug-in metadata through the front-end form rendering module.
3. The system for arranging and executing the plug-in on the routing based on the Spring Cloud Gateway in the trusted environment according to claim 1, wherein the routing definition module specifically comprises:
the routing management unit is used for configuring routing related information including assertion, proxy address and plug-in, storing the routing related information into a Json description file, storing the corresponding description file into a relational database table through a persistence component, and synchronously storing the corresponding description file into Redis; the gateway engine dynamically acquires the routing information by subscribing the Redis message and loads the routing object into the memory, thereby realizing the dynamic routing capability.
4. The system for arranging and executing the plug-in based on the Spring Cloud Gateway routing in the trusted environment according to claim 3, wherein the plug-in arranging module specifically comprises:
the plug-in arranging module is connected with the route management unit and used for arranging plug-ins on a specific route, selecting plug-ins needing to be executed on the route from all enabled plug-ins in a graphical mode, adjusting the execution sequence of the plug-ins, reading the running metadata information of the plug-ins, rendering the metadata into a form through a form rendering interface, configuring the value of the running metadata, storing the description of the arrangement of the plug-ins and binding the description to the route.
5. The system for arranging and executing the plug-in on the routing based on the Spring Cloud Gateway in the trusted environment according to claim 4, wherein the plug-in arranging module specifically performs the following processing:
(1) Selecting a plug-in;
(2) Judging whether to carry out user-defined page processing, if so, directly reading Vue pages; otherwise, directly reading the plug-in metadata;
(3) Performing page rendering processing through the form rendering interface;
(4) And performing configuration processing on the operating parameters of the plug-in needing to be enabled.
6. The system for arranging and executing the plug-ins on the routing based on the Spring Cloud Gateway in the trusted environment according to claim 5, wherein the page rendering process specifically includes:
aiming at the self-defined page, directly finding a vue file corresponding to a file name under a front-end plugins directory according to the name of a plug-in during rendering, and displaying the file in a div mode on an interface;
and aiming at the metadata of the plug-in, dynamically displaying the page according to the data type, the field name, the description, the input prompt, the check rule and the related information whether the data needs to be filled in, which are defined by the metadata, during rendering.
7. The system for arranging and executing the plug-in on the route based on the Spring Cloud Gateway in the trusted environment according to claim 5, wherein the plug-in running module specifically performs the following processing:
and after the request reaches the gateway, carrying out matching processing of a specific route, and calling corresponding plug-in codes by a Spring closed gateway kernel according to the sequence of the plug-in arrangement on the route.
CN202211572564.3A 2022-12-08 2022-12-08 Routing plug-in arranging and executing system based on Spring Cloud Gateway in trusted environment Pending CN115883353A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211572564.3A CN115883353A (en) 2022-12-08 2022-12-08 Routing plug-in arranging and executing system based on Spring Cloud Gateway in trusted environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211572564.3A CN115883353A (en) 2022-12-08 2022-12-08 Routing plug-in arranging and executing system based on Spring Cloud Gateway in trusted environment

Publications (1)

Publication Number Publication Date
CN115883353A true CN115883353A (en) 2023-03-31

Family

ID=85766545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211572564.3A Pending CN115883353A (en) 2022-12-08 2022-12-08 Routing plug-in arranging and executing system based on Spring Cloud Gateway in trusted environment

Country Status (1)

Country Link
CN (1) CN115883353A (en)

Similar Documents

Publication Publication Date Title
US10606565B2 (en) Visual devops systems and methods
US9015651B2 (en) Gateway data distribution engine
US7941784B2 (en) System and method for generating component based applications
US10089082B2 (en) Visual devops systems and methods
CA2604108C (en) System and method of representing data entities of standard device applications as built-in components
CN106663002B (en) REST service source code generation
KR20070049166A (en) System and method for extraction and creation of application meta-information within a software application repository
US20150089408A1 (en) Method and framework for content viewer integrations
CN106569880B (en) Method and system for dynamically sharing resources between Android applications
US20210334149A1 (en) Api adapter creation device, api adapter creation method, and api adapter creation program
US8667083B2 (en) Simplifying provisioning of asynchronous interaction with enterprise suites having synchronous integration points
US20220166839A1 (en) System Metamodel for an Event-Driven Cluster of microserices with micro frontends
US11080102B2 (en) System and method for developing modularized application
US20220334817A1 (en) Cross platform configuration domain translation
AU2021411481B2 (en) System and method for real-time, dynamic creation, delivery, and use of customizable web applications
US10802810B2 (en) Consuming persistent library bundles
CN115883353A (en) Routing plug-in arranging and executing system based on Spring Cloud Gateway in trusted environment
Wolters et al. Cross-device integration of android apps
CN117311799B (en) Configuration method of software project page
Modi et al. Getting started with terraform
Sanchiz et al. Extending MoWebA for MobileApps with functions in the Cloud
Penberthy et al. AWS Tools for. NET
Griffin et al. Advanced Laravel
CN115859260A (en) Authority authentication method, device, equipment and readable storage medium
Gandhi San Diego State University Android Library Resource Application

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination