CN114281562A - Method and device for realizing low-code API gateway - Google Patents

Method and device for realizing low-code API gateway Download PDF

Info

Publication number
CN114281562A
CN114281562A CN202011551775.XA CN202011551775A CN114281562A CN 114281562 A CN114281562 A CN 114281562A CN 202011551775 A CN202011551775 A CN 202011551775A CN 114281562 A CN114281562 A CN 114281562A
Authority
CN
China
Prior art keywords
plug
standard
code
module
preset
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
CN202011551775.XA
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.)
Shenzhen Branch Technology Co ltd
Original Assignee
Shenzhen Branch 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 Shenzhen Branch Technology Co ltd filed Critical Shenzhen Branch Technology Co ltd
Priority to CN202011551775.XA priority Critical patent/CN114281562A/en
Publication of CN114281562A publication Critical patent/CN114281562A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to a method and a device for realizing a low-code API gateway, which are used for receiving a plug-in arrangement request of a user, wherein the plug-in arrangement request comprises at least 2 standard plug-ins to be arranged and the execution sequence and the execution condition of each standard plug-in to be arranged; generating a new plug-in an array form according to a preset plug-in arrangement strategy and a plug-in arrangement request; converting the new plug-in the array form into a new plug-in a JSON format according to a preset plug-in conversion strategy; analyzing the new plug-in the JSON format according to a preset analysis strategy to generate an abstract syntax tree; inputting the abstract syntax tree into a preset coding generator, and outputting Lua codes; the method has the advantages that the Lua codes are distributed to the API gateway to run according to the preset Lua code distribution strategy, the low-code API gateway is realized, a user can quickly generate a new plug-in capable of running without coding, and the user without experience level can also generate the new plug-in capable of running on the API gateway in a self-defined mode according to the requirement of the user.

Description

Method and device for realizing low-code API gateway
Technical Field
The invention relates to the field of API gateways, in particular to a method and a device for realizing a low-code API gateway.
Background
An API (Application Programming Interface) gateway is used for processing data traffic of enterprise users, is essential basic software for an enterprise, and uniformly accesses calls of all APIs to an API gateway layer, and the gateway layer is responsible for accessing and outputting. The API gateway has a plurality of basic functions such as identity authentication, protocol conversion, balancing charge, protocol conversion and the like, and the functions are mainly provided by plug-ins contained in the API gateway. When a user needs other functions besides the basic functions, the user needs to write codes by himself, which wastes time of the user and makes it difficult for the user who is not a professional developer to write codes by himself.
Disclosure of Invention
In order to solve the above problems, the present invention provides a method for implementing a low-code API gateway, the method comprising: receiving a plug-in arrangement request of a user, wherein the plug-in arrangement request comprises at least 2 standard plug-ins to be arranged, and an execution sequence and an execution condition of each standard plug-in to be arranged; generating a new plug-in an array form according to a preset plug-in arrangement strategy and a plug-in arrangement request; converting the new plug-in the array form into a new plug-in a JSON format according to a preset plug-in conversion strategy; analyzing the new plug-in the JSON format according to a preset analysis strategy to generate an abstract syntax tree; inputting the abstract syntax tree into a preset coding generator, and outputting Lua codes; and distributing the Lua codes to the API gateway to run according to a preset Lua code distribution strategy.
Further, according to a preset parsing strategy, parsing the new plug-in the JSON format to generate an abstract syntax tree includes: and carrying out lexical analysis and syntactic analysis on the new plug-in the JSON format by using the analyzer, and analyzing the new plug-in the JSON format into an abstract syntax tree according to the results of the lexical analysis and the syntactic analysis.
Further, distributing the Lua codes to the API gateway for operation according to the preset Lua code distribution policy includes: storing the Lua code in the etcd; and distributing the Lua codes to the API gateway to run through a watch interface of the etcd according to a preset Lua code distribution strategy.
Further, the method further comprises: developing a plurality of standard plug-ins according to the basic function requirements of the API gateway, wherein the functions of the standard plug-ins are independent, and the business logic is independently realized; and establishing a standard plug-in library according to each standard plug-in and the identification code preset by each standard plug-in, wherein the standard plug-in library stores a plurality of standard plug-ins and plug-in identification code lists corresponding to the standard plug-ins.
Further, the method further comprises the step of adding a standard plug-in the standard plug-in library, wherein the adding of the standard plug-in comprises the following steps: uploading the newly added standard plug-in to a standard plug-in library for storage; and modifying the plug-in identification code list in the standard plug-in library configuration file, and storing the plug-in identification code corresponding to the newly added standard plug-in into the plug-in identification code list of the standard plug-in library.
Further, generating a new plug-in an array form according to a preset plug-in arrangement strategy and a plug-in arrangement request includes: calling standard plug-ins to be arranged from a standard plug-in library according to the plug-in arrangement request, and sequencing each standard plug-in to be arranged according to the execution sequence of the standard plug-ins to be arranged; and describing the relation of each standard plug-in to be arranged by utilizing an array + sub array mode according to the execution condition of the standard plug-in to be arranged, and generating a new plug-in an array form.
Further, the calling of the standard plug-in to be arranged from the preset standard plug-in library according to the plug-in arranging request comprises: receiving a plug-in arrangement request, and matching in the etcd according to the router id and the consumer id in the plug-in arrangement request to obtain a list of plug-in identification codes to be arranged; acquiring a plug-in identification code list in a local standard plug-in library; and taking the standard plug-in corresponding to the plug-in identification code which is simultaneously stored in the plug-in identification code list to be arranged and the plug-in identification code list as the standard plug-in to be arranged.
The invention also provides a device for realizing the low-code API gateway, which comprises a plug-in layout request receiving module, a plug-in layout module, a plug-in format conversion module, a plug-in analysis module, a plug-in code generating module and a plug-in code distributing module, wherein: the plug-in arrangement request receiving module is connected with the plug-in arrangement module and used for receiving a plug-in arrangement request of a user and sending the plug-in arrangement request to the plug-in arrangement module, wherein the plug-in arrangement request comprises at least 2 standard plug-ins to be arranged and the execution sequence and the execution conditions of each standard plug-in to be arranged; the plug-in layout module is connected with the plug-in layout request receiving module and the plug-in format conversion module and generates a new plug-in an array form according to a preset plug-in layout strategy and a plug-in layout request; the plug-in format conversion module is connected with the plug-in arrangement module and the plug-in analysis module and is used for converting the new plug-in the array form into a new plug-in the JSON format according to a preset plug-in conversion strategy; the plug-in analysis module is connected with the plug-in format conversion module and the plug-in code generation module and is used for analyzing the new plug-in with the JSON format according to a preset analysis strategy to generate an abstract syntax tree; the plug-in code generating module is connected with the plug-in analyzing module and the plug-in code distributing module and is used for receiving the abstract syntax tree and outputting Lua codes; and the plug-in code distribution module is used for distributing the Lua codes to the API gateway to run according to a preset Lua code distribution strategy.
Furthermore, the plug-in parsing module is a parser which comprises an analysis unit and a generation unit connected with the analysis unit, the analysis unit is used for performing lexical analysis and syntactic analysis on the plug-in the JSON format, and the generation unit is used for parsing a new plug-in the JSON format into an abstract syntax tree according to the results of the lexical analysis and the syntactic analysis.
Further, the plug-in code distribution module is an etcd, the etcd stores the Lua code, and distributes the Lua code to the API gateway to run through a watch interface of the etcd according to a preset Lua code distribution strategy.
The method and the device for realizing the low-code API gateway convert the new plug-in an array form generated after the plug-in is arranged into the JSON format on the basis of the arrangement of the plug-ins, and analyze the new plug-in the JSON format according to a preset analysis strategy to generate an abstract syntax tree; inputting the abstract syntax tree into a preset coding generator, and outputting Lua codes; the method has the advantages that the Lua codes are distributed to the API gateway to run according to the preset Lua code distribution strategy, so that the low-code API gateway is realized, a user can quickly generate a new plug-in capable of running without coding, the user without experience level can also generate the new plug-in capable of running on the API gateway in a self-defined mode according to the requirement of the user, the user time is saved, the efficiency is improved, and the development difficulty of the new plug-in is reduced. In addition, the Lua is a script language, the Lua code can be dynamically loaded and can run without compiling, the Lua code is stored in the etcd, the Lua code is distributed to the API gateway to run by the watch interface of the etcd, the regular pulling of the gateway node to the code is changed into active pushing, the configuration synchronization time is prolonged, and the synchronization time is prolonged from 10 seconds to 1 millisecond.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of a method for implementing a low-code API gateway according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for implementing a low-code API gateway according to another embodiment of the present invention;
fig. 3 is a flow chart of a method for implementing a low-code API gateway according to another embodiment of the present invention;
FIG. 4 is a flowchart of a method for implementing a low-code API gateway according to another embodiment of the present invention;
FIG. 5 is a flow chart of a method for implementing a low-code API gateway according to another embodiment of the present invention;
FIG. 6 is a flowchart illustrating a method for adding plug-ins to a standard plug-in library according to an embodiment of the present invention;
FIG. 7 is a flowchart of a method for generating a new plug-in array form according to an embodiment of the present invention;
FIG. 8 is a flowchart of a method for retrieving a plug-in to be arranged from a standard plug-in library according to an embodiment of the present invention;
FIG. 9 is a schematic structural diagram of an apparatus for implementing a low-code API gateway according to an embodiment of the present invention;
FIG. 10 is a schematic structural diagram of an apparatus for implementing a low-code API gateway according to another embodiment of the present invention;
201-plug-in layout request receiving module, 202-plug-in layout module, 203-plug-in format conversion module, 204-plug-in parsing module, 205-plug-in code generating module, 206-plug-in code distributing module, 2041-analyzing unit and 2042-generating unit.
Detailed Description
The technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings in the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In an embodiment of the present invention, a method and an apparatus for implementing a low-code API gateway are provided, as shown in fig. 1, the method includes the following steps:
step S101: a plug-in orchestration request of a user is received.
In this embodiment, the plug-in arrangement request includes at least 2 standard plug-ins to be arranged, and an execution sequence and an execution condition of each standard plug-in to be arranged.
The user can select the standard plug-ins to be arranged on the plug-in arrangement interface and set the execution sequence and the execution conditions of the standard plug-ins to be arranged. Specifically, a user selects at least 2 standard plug-ins from a plug-in list of the plug-in arrangement interface as standard plug-ins to be arranged according to functions to be realized, the plug-ins in the plug-in list are plug-in names of the standard plug-ins, and the standard plug-ins are dragged to a plug-in arrangement area of the plug-in arrangement interface in a dragging mode. The user adds a condition judgment node of the operation result between the standard plug-ins according to the service logic of the function to be realized, sets the judgment content of the condition judgment node, and the relation between the judgment result obtained by the condition judgment and the plug-in execution (the judgment condition can be selected or input by the user). The client side obtains the plug-in arrangement request of the user by identifying the dragging operation, the clicking operation and the inputting operation of the user, and sends the plug-in arrangement request of the user to the back-end server. The plug-in arrangement request of the user is received by the back-end server.
Taking a function which a user wants to realize as an example of detecting whether flow is malicious or not, recording a log if the flow is malicious or not, and performing protocol conversion if the flow is not malicious, currently, an A plug-in is used for detecting whether the flow is malicious or not, a B plug-in is used for recording the log, and a C plug-in is used for protocol conversion, so that the user can select A, B, C plug-ins from a plug-in list of a plug-in arrangement interface, and further, the selection mode can be a mode of dragging A, B, C plug-ins in the plug-in list to a plug-in arrangement area. Then adding a condition judgment node of an operation result between the plug-in A and the plug-ins B and C, setting the judgment content of the condition judgment node as whether the flow is malicious or not, and setting the execution conditions of the plug-ins as follows: if yes, executing the B plug-in, and if not, executing the A plug-in. Through the operation, a user arranges the standard plug-ins according to the required functions on the plug-in arrangement interface, and after arrangement, a DAG (directed acyclic graph) is formed on the plug-in arrangement interface so as to indicate the operation sequence and the execution conditions among the standard plug-ins to the user. And simultaneously, the client sends the plug-in names of the standard plug-ins to be arranged, the running sequence and the execution conditions of all the plug-ins selected by the user as plug-in arranging requests to the back-end server.
Specifically, the standard plug-in mentioned in this step is written in advance by a technician, and is described in detail later, so that redundant description is not repeated here.
Step S102: and generating a new plug-in an array form according to a preset plug-in arrangement strategy and a plug-in arrangement request.
Step S103: and converting the new plug-in the array form into a new plug-in a JSON format according to a preset plug-in conversion strategy.
Specifically, the JSON format is a development language-independent lightweight data storage format, called JavaScript Object notification, which is a standard specification of a data format, originally derived from JavaScript, and is easy to read and understand and easy to parse and generate by a machine. In the embodiment, the new plug-in the array form is converted into the new plug-in the JSON format, so that subsequent parsing and related code generation are facilitated.
Step S104: and analyzing the new plug-in the JSON format according to a preset analysis strategy to generate an abstract syntax tree.
In still another embodiment of the present invention, as shown in fig. 2, step S104 includes:
step S1041: carrying out lexical analysis and syntactic analysis on the new plug-in the JSON format by using an analyzer;
step S1042: and analyzing the new plug-in the JSON format into an abstract syntax tree according to the results of the lexical analysis and the syntactic analysis.
Specifically, the parser can be used to perform lexical analysis and syntactic analysis on the new plug-in the JSON format, and the new plug-in the JSON format is parsed into an abstract syntax tree according to the results of the lexical analysis and the syntactic analysis. Abstract Syntax Tree (AST), or Syntax Tree for short, represents the Syntax structure of the programming language in the form of Tree, and then generates corresponding codes according to the Abstract Syntax Tree.
Step S105: and inputting the abstract syntax tree into a preset coding generator and outputting the Lua code.
Specifically, the preset code generator is written by a technician in advance, and can convert the abstract syntax tree into the Lua code. The Lua is a small script language and is compiled by standard C, and can be compiled and run on almost all operating systems and platforms, and Lua codes can be dynamically loaded and run without being compiled. It should be understood that the standard plug-in written in advance is also a code written by using the Lua language, and after the abstract syntax tree is input to the preset code generator, the code of the required standard plug-in is called in order, so as to form the Lua code corresponding to the new plug-in.
Step S106: and distributing the Lua codes to an API gateway to run according to a preset Lua code distribution strategy.
In still another embodiment of the present invention, as shown in fig. 3, the step S106 includes the steps of:
step S1061: the Lua code is stored in etcd.
Step S1062: and distributing the Lua codes to the API gateway to run through a watch interface of the etcd according to a preset Lua code distribution strategy.
Specifically, the Lua code generated in step S105 is stored in the etcd (the etcd is a highly available key value storage system and is mainly used for shared configuration and service discovery), and the Lua code is distributed to the API gateway for operation through a watch (monitoring) interface of the etcd according to a preset Lua code distribution policy. Compared with the traditional method that the gateway node regularly pulls the code, the method has the advantages that the gateway interface of the etcd actively distributes the Lua code to the API gateway to run, the regular pulling of the gateway node to the code is changed into the active pushing, the configuration synchronization time is prolonged, and the synchronization time is prolonged from 10 seconds to 1 millisecond.
In another embodiment of the present invention, as shown in fig. 4, the method for implementing the low-code API gateway further includes step S107: and developing standard plug-ins according to the basic function requirements of the API gateway, and establishing a standard plug-in library according to each standard plug-in and the identification code preset by each standard plug-in.
Specifically, the number of the standard plug-ins is multiple, and each standard plug-in has an independent function and independently realizes service logic; the standard plug-in library stores a plurality of standard plug-ins and plug-in identification code lists corresponding to the standard plug-ins. The method comprises the steps that standard plug-ins are developed in advance and stored in a standard plug-in library, a user can directly arrange the standard plug-ins in the follow-up process to generate new plug-ins, codes of the standard plug-ins used by the new plug-ins are directly called when the new plug-ins are operated, the user does not need to write the codes by himself, and therefore the low-code API gateway is achieved.
In this embodiment, the standard plug-ins developed according to the basic functional requirements of the API gateway are standard plug-ins capable of sharing contexts with each other. When a plurality of standard plug-ins are arranged into new plug-ins through plug-in arrangement subsequently, the arranged standard plug-ins can mutually sense to obtain the operation results of other standard plug-ins. In addition, the operation result of the standard plug-in is stored in a global variable, which is also called an external variable and can be referred by all objects or functions of the program, so that when the standard plug-in is developed, the standard plug-in is set to store the operation result in the global variable after operation, that is, all the standard plug-ins can obtain the operation result of other standard plug-ins, thereby realizing the context sharing of the standard plug-ins. Meanwhile, when the standard plug-ins are developed, an identification code is preset for each standard plug-in, and the identification code of each standard plug-in is unique and determined, so that all the standard plug-ins can be distinguished, and further, the plug-in name set when the standard plug-ins are developed can be used as the identification code of each standard plug-in. The code of each standard plug-in and a plug-in identification code list are stored in the standard plug-in library, and the plug-in identification code list is used as a configuration file of the standard plug-in library and records the identification codes of all the standard plug-ins in the standard plug-in library.
In another embodiment of the present invention, as shown in fig. 5, on the basis of the previous embodiment, the method further includes step S108, where step S108 is to add a standard plug-in the standard plug-in library.
Further, as shown in fig. 6, step S108 includes:
step S1081: uploading the newly added standard plug-in (plug-in code) to a standard plug-in library for storage;
step S1082: and modifying the plug-in identification code list in the standard plug-in library configuration file, and storing the plug-in identification code corresponding to the newly added standard plug-in into the plug-in identification code list of the standard plug-in library.
In addition, it should be noted that the new plug-in generated through the plug-in arrangement is not stored in the standard plug-in library, and the identification code of the new plug-in (the name of the new plug-in) is not stored in the plug-in identification code list.
In another embodiment of the present invention, as shown in fig. 7, generating a new plug-in an array form according to a preset plug-in arrangement policy and a plug-in arrangement request includes:
step S1021: and calling the standard plug-ins to be arranged from the standard plug-in library according to the plug-in arrangement request, and sequencing each standard plug-in to be arranged according to the execution sequence of the standard plug-ins to be arranged.
Step S1022: and describing the relation of each standard plug-in to be arranged by utilizing an array + sub array mode according to the execution condition of the standard plug-in to be arranged, and generating a new plug-in an array form.
The relation of each standard plug-in to be arranged is described in an array + sub array mode, namely the relation of each standard plug-in to be arranged is expressed in an array mode, so that the relation of each plug-in to be arranged is converted into a mode which can be recognized by a machine.
In another embodiment of the present invention, based on the above embodiment, as shown in fig. 8, the step of retrieving the standard plug-in to be arranged from the preset standard plug-in library according to the plug-in arrangement request includes the following steps:
step S10211: receiving a plug-in arrangement request, and matching in an etcd (the etcd is a high-availability key value storage system and is mainly used for sharing configuration and service discovery) according to a router ID (routing ID) and a consumer ID (consumer ID) in the plug-in arrangement request to obtain a plug-in identification code list to be arranged;
step S10212: acquiring a plug-in identification code list in a local standard plug-in library;
step S10213: and taking the standard plug-in corresponding to the plug-in identification code which is simultaneously stored in the plug-in identification code list to be arranged and the plug-in identification code list as the standard plug-in to be arranged.
The present invention also provides an implementation apparatus of a low-code API gateway, as shown in fig. 9, the apparatus includes a plug-in arrangement request receiving module 201, a plug-in arrangement module 202, a plug-in format converting module 203, a plug-in parsing module 204, a plug-in code generating module 205, and a plug-in code distributing module 206, where: the plug-in arrangement request receiving module 201 is connected to the plug-in arrangement module 202, and is configured to receive a plug-in arrangement request of a user, and send the plug-in arrangement request to the plug-in arrangement module 202. The plug-in arrangement request comprises at least 2 standard plug-ins to be arranged, and execution sequence and execution conditions of each standard plug-in to be arranged; the plug-in layout module 202 is connected with the plug-in layout request receiving module 201 and the plug-in format conversion module 203, and generates a new plug-in an array form according to a preset plug-in layout strategy and a plug-in layout request; the plug-in format conversion module 203 is connected with the plug-in arrangement module 202 and the plug-in analysis module 204 and is used for converting the new plug-in the array form into a new plug-in the JSON format according to a preset plug-in conversion strategy; the plug-in analysis module 204 is connected with the plug-in format conversion module 203 and the plug-in code generation module 205 and is used for analyzing the new plug-in the JSON format according to a preset analysis strategy to generate an abstract syntax tree; the plug-in code generating module 205 is connected with the plug-in analyzing module 204 and the plug-in code distributing module 206, and is used for receiving the abstract syntax tree and outputting the Lua codes; and the plug-in code distribution module 206 is used for distributing the Lua codes to the API gateway to run according to the preset Lua code distribution strategy.
In an embodiment of the present invention, as shown in fig. 10, the plug-in parsing module 204 is a parser, the parser includes an analysis unit 2041 and a generation unit 2042 connected to the analysis unit 2041, the analysis unit 2041 is configured to perform lexical analysis and syntactic analysis on a plug-in the JSON format, and the generation unit 2042 is configured to parse a new plug-in the JSON format into an abstract syntax tree according to a result of the lexical analysis and the syntactic analysis.
In an embodiment of the present invention, the plug-in code distribution module 206 is an etcd, where the etcd stores a Lua code, and distributes the Lua code to the API gateway for operation through a watch interface of the etcd according to a preset Lua code distribution policy.
The method and the device for realizing the low-code API gateway provided by the invention realize the low-code API gateway on the basis of the arrangement of the plug-ins, and a user can quickly generate the new plug-ins which can be operated without coding, so that the user without experience level can also generate the new plug-ins which can be directly operated on the API gateway in a self-defining way according to the own requirements, thereby saving the user time, improving the efficiency and reducing the development difficulty of the new plug-ins. In addition, the Lua is a script language, the Lua code can be dynamically loaded and can run without compiling, the Lua code is stored in the etcd, the Lua code is distributed to the API gateway to run by the watch interface of the etcd, the regular pulling of the gateway node to the code is changed into active pushing, the configuration synchronization time is prolonged, and the synchronization time is prolonged from 10 seconds to 1 millisecond.
The terms and expressions used in the specification of the present invention have been set forth for illustrative purposes only and are not meant to be limiting. It will be appreciated by those skilled in the art that changes could be made to the details of the above-described embodiments without departing from the underlying principles thereof. The scope of the invention is, therefore, indicated by the appended claims, in which all terms are intended to be interpreted in their broadest reasonable sense unless otherwise indicated.

Claims (10)

1. A method for implementing a low code API gateway, the method comprising:
receiving a plug-in arrangement request of a user, wherein the plug-in arrangement request comprises at least 2 standard plug-ins to be arranged, and an execution sequence and an execution condition of each standard plug-in to be arranged;
generating a new plug-in an array form according to a preset plug-in arrangement strategy and the plug-in arrangement request;
converting the new plug-in the array form into a new plug-in a JSON format according to a preset plug-in conversion strategy;
analyzing the new plug-in the JSON format according to a preset analysis strategy to generate an abstract syntax tree;
inputting the abstract syntax tree into a preset coding generator, and outputting Lua codes;
and distributing the Lua codes to an API gateway to run according to a preset Lua code distribution strategy.
2. The method for implementing the low-code API gateway according to claim 1, wherein the parsing the new plug-in the JSON format according to a preset parsing policy to generate an abstract syntax tree includes:
performing lexical analysis and syntactic analysis on the new plug-in the JSON format by using an analyzer;
and analyzing the new plug-in the JSON format into an abstract syntax tree according to the results of the lexical analysis and the syntax analysis.
3. The method for implementing the low-code API gateway according to claim 1, wherein the distributing the Lua code to the API gateway for operation according to the preset Lua code distribution policy comprises:
storing the Lua code in an etcd;
and distributing the Lua codes to an API gateway to run through a watch interface of the etcd according to a preset Lua code distribution strategy.
4. The method of claim 1, further comprising:
developing a plurality of standard plug-ins according to basic function requirements of the API gateway, wherein the functions of the standard plug-ins are independent, and the business logic is independently realized;
and establishing a standard plug-in library according to each standard plug-in and the identification code preset by each standard plug-in, wherein the standard plug-in library stores a plurality of standard plug-ins and plug-in identification code lists corresponding to the standard plug-ins.
5. The method of claim 4, further comprising adding a standard plug-in to the standard plug-in library, the adding a standard plug-in comprising:
uploading the newly added standard plug-in to the standard plug-in library for storage;
and modifying the plug-in identification code list in the standard plug-in library configuration file, and storing the plug-in identification code corresponding to the newly added standard plug-in into the plug-in identification code list of the standard plug-in library.
6. The method for implementing the low-code API gateway according to claim 4, wherein the generating of the new plug-in an array form according to the preset plug-in arrangement policy and the plug-in arrangement request comprises:
calling the standard plug-ins to be arranged from the standard plug-in library according to the plug-in arrangement request, and sequencing each standard plug-in to be arranged according to the execution sequence of the standard plug-ins to be arranged;
and describing the relation of each standard plug-in to be arranged by utilizing an array + sub array mode according to the execution condition of the standard plug-in to be arranged, and generating a new plug-in an array form.
7. The method for implementing the low code API gateway of claim 6, wherein the retrieving the standard plug-in to be programmed from a preset standard plug-in library according to the plug-in programming request comprises:
receiving the plug-in arrangement request, and matching in an etcd according to a router id and a consumer id in the plug-in arrangement request to obtain a list of plug-in identification codes to be arranged;
acquiring a local plug-in identification code list in the standard plug-in library;
and taking the standard plug-in corresponding to the plug-in identification code which is simultaneously stored in the plug-in identification code list to be arranged and the plug-in identification code in the plug-in identification code list as the standard plug-in to be arranged.
8. An implementation apparatus of a low-code API gateway, the apparatus comprising a plug-in layout request receiving module, a plug-in layout module, a plug-in format conversion module, a plug-in parsing module, a plug-in code generating module, and a plug-in code distributing module, wherein:
the plug-in arrangement request receiving module is connected with the plug-in arrangement module and is used for receiving a plug-in arrangement request of a user and sending the plug-in arrangement request to the plug-in arrangement module, wherein the plug-in arrangement request comprises at least 2 standard plug-ins to be arranged and the execution sequence and the execution conditions of each standard plug-in to be arranged;
the plug-in arrangement module is connected with the plug-in arrangement request receiving module and the plug-in format conversion module, and generates a new plug-in an array form according to a preset plug-in arrangement strategy and the plug-in arrangement request;
the plug-in format conversion module is connected with the plug-in arrangement module and the plug-in analysis module and is used for converting the new plug-in the array form into a new plug-in a JSON format according to a preset plug-in conversion strategy;
the plug-in analysis module is connected with the plug-in format conversion module and the plug-in code generation module and is used for analyzing the new plug-in the JSON format according to a preset analysis strategy to generate an abstract syntax tree;
the plug-in code generating module is connected with the plug-in analyzing module and the plug-in code distributing module and is used for receiving the abstract syntax tree and outputting Lua codes;
and the plug-in code distribution module is used for distributing the Lua codes to the API gateway to run according to a preset Lua code distribution strategy.
9. The apparatus according to claim 8, wherein the plug-in parsing module is a parser, the parser includes an analysis unit and a generation unit connected to the analysis unit, the analysis unit is configured to perform lexical analysis and syntactic analysis on the JSON-formatted plug-in, and the generation unit is configured to parse the new JSON-formatted plug-in into an abstract syntax tree according to a result of the lexical analysis and syntactic analysis.
10. The apparatus according to claim 8, wherein the plug-in code distribution module is an etcd, and the etcd stores the Lua code and distributes the Lua code to the API gateway for operation through a watch interface of the etcd according to a preset Lua code distribution policy.
CN202011551775.XA 2020-12-24 2020-12-24 Method and device for realizing low-code API gateway Pending CN114281562A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011551775.XA CN114281562A (en) 2020-12-24 2020-12-24 Method and device for realizing low-code API gateway

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011551775.XA CN114281562A (en) 2020-12-24 2020-12-24 Method and device for realizing low-code API gateway

Publications (1)

Publication Number Publication Date
CN114281562A true CN114281562A (en) 2022-04-05

Family

ID=80868397

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011551775.XA Pending CN114281562A (en) 2020-12-24 2020-12-24 Method and device for realizing low-code API gateway

Country Status (1)

Country Link
CN (1) CN114281562A (en)

Similar Documents

Publication Publication Date Title
CN107317724B (en) Data acquisition system and method based on cloud computing technology
US6952800B1 (en) Arrangement for controlling and logging voice enabled web applications using extensible markup language documents
CN112329945A (en) Model deployment and reasoning method and device
JP2007519075A (en) Scalable synchronous and asynchronous processing of monitoring rules
AU2003269216A1 (en) Verifiable processes in a heterogeneous distributed computing environment
US7996840B2 (en) Method, system, and apparatus for scheduling pattern based web services
CN109783562B (en) Service processing method and device
CN110210212A (en) A kind of data processing method, device and relevant device
US20220078072A1 (en) Closed-loop automation of a managed network
US8103607B2 (en) System comprising a proxy server including a rules engine, a remote application server, and an aspect server for executing aspect services remotely
US7533383B2 (en) Method, system, and apparatus for scheduling pattern based web services
Rogers et al. Bundle and pool architecture for multi-language, robust, scalable workflow executions
US11552868B1 (en) Collect and forward
AlShahwan et al. Mobile cloud computing for providing complex mobile web services
CN110457132B (en) Method and device for creating functional object and terminal equipment
US20180032329A1 (en) Customized runtime environment
CN114281562A (en) Method and device for realizing low-code API gateway
US9537931B2 (en) Dynamic object oriented remote instantiation
US11762962B2 (en) Onboarding of monitoring tools
CN115185841A (en) System reconfiguration test method, device, equipment and storage medium
Mederly et al. Construction of messaging-based enterprise integration solutions using AI planning
US20210357414A1 (en) Pipelineable and parallelizable streaming parsers for querying structured data-interchange information
CN113708971A (en) Openstack cloud platform deployment method and related device
CN110837612B (en) Uniform Resource Identifier (URI) data acquisition method and device and storage medium
CN112817567A (en) Openwhisk no-service framework migration method for micro-service 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