Visual API arrangement method and API deployment method
Through visualizing API orchestration methods and deployment methods, using API orchestration canvas and query engine services, the problems of long development cycle of API orchestration and inconvenient maintenance in the existing technology are solved, and flexible and efficient API orchestration and deployment are achieved.
Patent Information
- Application Number
- CN202411201434.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-03
AI Technical Summary
The existing API orchestration method has a long development cycle and is inconvenient to change and maintain after API deployment.
The visual API orchestration method is adopted to set up active nodes through the drag and drop method of the API orchestration canvas, determine the API configuration structure according to the node type and parameter configuration, generate an API configuration file, and deploy the target API to the query engine service based on the API configuration file.
API orchestration through visualization reduces user learning costs, improves development flexibility, provides visual logical links, facilitates subsequent maintenance and handover, and simplifies the API deployment process.
Smart Images

Figure CN119065655A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of API management technology, and in particular to an API orchestration method and an API deployment method. Background Art
[0002] As business needs become increasingly complex, simple API calls can no longer meet the needs of efficient and flexible system integration. API orchestration technology has emerged to provide developers with a more flexible way to combine APIs to meet the needs of complex businesses.
[0003] When performing API orchestration, existing technologies usually use dynamic compilation syntax, form-based or low-code platform-based API orchestration. These methods have the problems of long development cycle and inconvenient changes and maintenance after API deployment. Summary of the invention
[0004] The main purpose of this application is to provide a visual API orchestration method, device, equipment, storage medium and product, aiming to solve the technical problems of long development cycle of existing API orchestration methods and inconvenient changes and maintenance after API deployment.
[0005] To achieve the above objectives, the present application proposes a visual API arrangement method, which includes:
[0006] Visualize the API orchestration canvas;
[0007] Determine an activity node set by a user based on the API orchestration canvas;
[0008] Determine an API configuration structure according to the node type and node parameter configuration of the active node;
[0009] An API configuration file is generated based on the active node and the API configuration structure.
[0010] In one embodiment, the step of determining the API configuration structure according to the node type and node parameter configuration of the active node includes:
[0011] Determine the node type and node parameter configuration corresponding to the obtained node;
[0012] Determine the node edge relationship between each of the active nodes based on the node type and the node parameter configuration;
[0013] An API configuration structure is determined according to the node type, the node parameter configuration, and the node edge relationship.
[0014] In addition, to achieve the above purpose, the present application proposes an API deployment method, which includes:
[0015] Get the API configuration file;
[0016] Determine the active node of the target API and the target API configuration structure based on the API configuration file;
[0017] The target API is deployed to the query engine service according to the target active node and the target API configuration structure.
[0018] In one embodiment, the step of deploying the target API to the query engine service according to the target active node and the target API configuration structure includes:
[0019] Determine the node type and node parameter configuration in the target active node according to the target API configuration structure;
[0020] Traversing from the start target activity node to the end target activity node in the target activity nodes, and determining the execution chain corresponding to the target API based on the node type and node parameter configuration of the intermediate target activity nodes;
[0021] Constructing an execution sequence flow of the target API according to the execution chain;
[0022] The query engine service is deployed with a target API based on the execution sequence flow and the service unit configuration information of the query engine service.
[0023] In one embodiment, the step of determining the execution chain corresponding to the target activity node based on the node type and node parameter configuration of the intermediate target activity node includes:
[0024] When the node type of the intermediate target active node is a branch node, determining a branch execution strategy of the intermediate target active node according to the node parameter configuration of the intermediate target active node;
[0025] Determine the branch link corresponding to the intermediate target active node based on the branch execution strategy;
[0026] When the node type of the intermediate target activity node is a loop node, determining the number of loops and loop end conditions of the intermediate target activity node based on the node parameter configuration of the intermediate target activity node;
[0027] Determine the loop link corresponding to the intermediate target active node according to the loop number and the loop end condition;
[0028] An execution chain corresponding to the target API is determined according to the branch link and the loop link.
[0029] In one embodiment, the step of deploying the query engine service with the target API based on the execution sequence flow and the service unit configuration information of the query engine service includes:
[0030] Get the service unit configuration information of the query engine service;
[0031] Associating the target API with the query engine service;
[0032] Determine data source connection information of the data query node based on the service unit configuration information;
[0033] Packaging is performed according to the execution sequence flow, the service unit configuration information and the data source connection information to obtain an API deployment package;
[0034] The target API is deployed to the associated query engine service based on the API deployment package.
[0035] In one embodiment, the step of deploying the target API to the associated query engine service based on the API deployment package includes:
[0036] Initialize the target initial target activity node and the target end target activity node in the associated query engine service based on the start target activity node and the end target activity node in the API deployment package to obtain a node class object;
[0037] Initialize the execution chain in the associated query engine service according to the execution sequence flow in the API deployment package to obtain an execution chain object;
[0038] The target API is deployed to the associated query engine service based on the node class object and the execution chain object.
[0039] In addition, to achieve the above purpose, the present application also proposes a visual API arrangement device, the visual API arrangement device comprising:
[0040] The display module is used to visualize the API orchestration canvas;
[0041] An orchestration module, used to determine an activity node set by a user based on the API orchestration canvas;
[0042] The orchestration module is further used to determine the API configuration structure according to the node type and node parameter configuration of the active node;
[0043] The file generation module is used to generate an API configuration file based on the active node and the API configuration structure.
[0044] In addition, to achieve the above purpose, the present application also proposes an API deployment device, the API deployment device comprising:
[0045] File acquisition module, used to obtain API configuration files;
[0046] A file parsing module, used to determine the active node of the target API and the target API configuration structure based on the API configuration file;
[0047] The API deployment module is used to deploy the target API to the query engine service according to the target active node and the target API configuration structure.
[0048] In addition, to achieve the above-mentioned purpose, the present application also proposes a visual API orchestration device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the visual API orchestration method described above.
[0049] In addition, to achieve the above-mentioned purpose, the present application also proposes an API deployment device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the API deployment method as described above.
[0050] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the visual API orchestration method and / or API deployment method described above are implemented.
[0051] In addition, to achieve the above objectives, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the visual API orchestration method and / or API deployment method described above.
[0052] In addition, to achieve the above-mentioned purpose, the present application also provides an API orchestration and deployment system, the system comprising an API orchestration module and an API deployment module;
[0053] The API arrangement module is used to implement the steps of the visual API arrangement method described above;
[0054] The API deployment module is used to implement the steps of the API deployment method as described above.
[0055] One or more technical solutions proposed in this application have at least the following technical effects:
[0056] This application visualizes the API orchestration canvas; determines the active nodes set by the user based on the API orchestration canvas; determines the API configuration structure based on the node type and node parameter configuration of the active node; and generates an API configuration file based on the active node and the API configuration structure. Since API orchestration is based on a visual approach, business logic can be orchestrated by dragging and dropping components, which greatly reduces the user's learning cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0058] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0059] Figure 1 A flowchart of the first embodiment of the visual API arrangement method of the present application is provided;
[0060] Figure 2 A schematic diagram of an API orchestration canvas case in one implementation of the visual API orchestration method of this application;
[0061] Figure 3 This is a schematic diagram of a branch node in an implementation method of an embodiment of the present application;
[0062] Figure 4 A schematic diagram of a case of a loop node in an implementation method of an embodiment of the present application;
[0063] Figure 5 This is a schematic diagram of a case of orchestration parameter transmission in an implementation method of an embodiment of the present application;
[0064] Figure 6 This is a schematic diagram of the API orchestration and deployment process in one implementation method of the present application embodiment;
[0065] Figure 7 This is a schematic diagram of the module structure of the visual API orchestration device according to an embodiment of the present application;
[0066] Figure 8 This is a schematic diagram of the module structure of the API deployment device according to an embodiment of the present application;
[0067] Fig. 9 Schematic diagram of the device structure of the hardware operating environment involved in the visual API orchestration method in the embodiment of the present application.
[0068] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0069] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0070] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0071] This application uses a visual method that can be dragged and dropped to orchestrate APIs. It can logically orchestrate multiple APIs to implement different business scenarios. After the final orchestration, a new API will be generated, and downstream users can execute the business logic of the API orchestration by calling the API interface. API orchestration is performed in a visual way, providing a variety of reusable logical components. The business logic of the API can be orchestrated by dragging and dropping components, which greatly reduces the user's learning cost; the orchestrated API can be quickly released in a configurable way, which improves the flexibility of development; the orchestrated API provides a visual logical link to facilitate subsequent maintenance and handover.
[0072] For API orchestration based on dynamic compilation syntax, the essence of this method still requires code development, which is difficult for non-developers to get started; and the API service generated by the final orchestration has no visual interface, making it difficult to understand the business logic, and inconvenient for subsequent maintenance and handover. The deployment and launch of this method will rely on containerized deployment or script deployment processes, and the development cycle is long.
[0073] For form-based API orchestration, this method presents query results of different APIs on the same form page by assembling forms. It is mainly used for data display or simple data update or modification, and cannot implement customized business logic, such as branch processing, loop processing, service call, etc.
[0074] For API orchestration based on low-code platforms, low-code platforms orchestrate backend logic through front-end components. When the front-end page is not needed, an independent API interface cannot be extracted. This method is highly coupled with the front-end page and cannot provide the ability to independently deploy the orchestrated API.
[0075] Based on the above, the present application proposes a visual API orchestration method. In the visual API orchestration method in the embodiments of the present application and in the following embodiments, the execution subject can be a computing service device with data processing, network communication and program running functions, such as a computer, a server, etc., or an electronic device, a virtual device, etc. that can realize the above functions. The following takes a visual API orchestration device (referred to as the orchestration device) as an example to illustrate this embodiment and the following embodiments.
[0076] Based on this, the present application embodiment provides a visual API arrangement method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the visual API orchestration method of the present application.
[0077] In this embodiment, the visual API arrangement method includes steps S10 to S40:
[0078] Step S10, visually displaying the API orchestration canvas;
[0079] Step S20, determining the activity node set by the user based on the API orchestration canvas;
[0080] It should be noted that the above API orchestration canvas is a tool that helps developers to quickly design and deploy through an intuitive graphical interface. Through the API orchestration canvas, a visual display of API orchestration can be achieved, allowing users to select various business components in the API orchestration canvas and then perform logical orchestration. In the API orchestration canvas, users can set multiple activity nodes to connect with each other to form the final business execution logic flow.
[0081] In addition, it should be noted that in an embodiment of the present application, a user can set multiple activity nodes in the API orchestration canvas. Among them, the activity node can represent the operations that can be performed in the API orchestration process. Specifically, the user can click the + sign in the orchestration canvas to select an activity node at the corresponding position. Specifically, the case diagram of the API orchestration canvas in one implementation of the present application can be referred to Figure 2 .
[0082] It should be explained that the active nodes in the embodiment of the present application may include logic control nodes, data processing nodes, call service nodes, business nodes, start nodes and end nodes. Among them, the logic control node defines four logic control modes, namely branch, loop, continue, i.e. break. Corresponding to these control modes, the logic control nodes can be defined to include: branch nodes, loop nodes, continue nodes, and exit nodes.
[0083] It is understandable that branch nodes can be used for business logic decision making, and branch nodes usually appear in pairs, and specifically may include a branch start node and a branch end node. Figure 3 As shown, Figure 3 This is a schematic diagram of a branch node in an implementation method of the present application embodiment; Figure 3 In the example, the logical link of API orchestration is divided into two branches: sending messages and sending emails.
[0084] It should be noted that for the branch start node, the node parameter configuration such as the branch execution condition and branch strategy can be defined; for the branch end node, it can be used as a marker for the end of the branch. When the entire branch process ends, execution will continue from the branch end node.
[0085] It should be explained that in the API orchestration process, when the execution reaches the branch start node, it will determine which branches need to be executed based on the execution conditions in the branch start node and the branch strategy, where each branch can predefine its corresponding execution conditions. When the execution conditions are met, the corresponding branch can be executed according to the branch strategy.
[0086] It should be noted that the execution of branches may include the following strategies: parallel strategy, serial strategy and multi-query fast strategy.
[0087] It is understandable that under the parallel strategy, multiple branches can be executed in parallel, and when all branches are executed, the branch end node is entered. Figure 3 In the branch structure shown in the figure, in the parallel strategy, branches A and B execute the nodes at the same time. After A and B are executed, the branch ends. The entire process continues to execute from the branch end node. In the serial strategy, multiple branches are executed in a certain order (such as branch name sorting). When all branches are executed, the branch node execution process ends. Figure 3 In the branch structure shown in the serial strategy, branch A is executed first, and then branch B is executed after branch A is executed. After branch B is executed, the entire branch ends, and the entire process continues to execute from the branch end node. Under the multi-query fast strategy, multiple branches are executed in parallel. When any branch is executed, the branch process ends, and the execution of other unexecuted branches will be terminated. Figure 3 In the branch structure shown, branches A and B are executed simultaneously. If branch A is executed first, branch B is terminated immediately; if branch B is executed first, branch A is terminated immediately. In this way, the entire branch process is executed.
[0088] It should be noted that the loop node is used to loop a fixed execution flow combination, or loop through a variable of an array or collection type, and obtain the value of each item in the collection for logical processing. Loop nodes can appear in pairs, divided into loop start nodes and loop end nodes. The loop operation is triggered from the loop start node and ends at the loop end node. In the loop start and loop end nodes, you can define the continue node and exit node. It is used to terminate the loop process in advance under certain circumstances. When executing to the continue node, the sub-loop operation will be skipped; when executing to the exit node, the entire loop process will be exited and the loop end node will be executed directly.
[0089] It should be explained that in the loop start node, you can define node parameter types such as loop type, execution number of loops, or loop variables. Specifically, loop types can be divided into two types: fixed number of times or set traversal. The loop end node is the end mark of the entire loop operation. When the loop end node is executed, execution continues from the loop end node.
[0090] It is understandable that when the loop strategy is a fixed number of times, the number of loop executions can be specified, and the execution flow contained in the loop node will be executed multiple times according to the set number of times. When the loop strategy is set traversal, the collection to be traversed and the loop variable can be specified. When the loop operation is executed, each element in the collection will be taken out in turn and assigned to the loop variable. The loop variable can be used on the execution flow in the loop. When the entire set traversal is completed, the loop ends.
[0091] In one implementation of the present application, the execution case of the loop node can refer to Figure 4 .exist Figure 4 In the loop, you can use a fixed number of times to loop, start from the loop start node, execute operation 1, and make branch judgments. There are three situations: if you enter the continue node, you will enter the next loop and skip operation 2; if you enter the break node, the entire loop ends; if neither branch A nor branch B meets the conditions, then execute operation 2. After operation 2 ends, the single loop ends. At this time, determine whether there are remaining loop times. If so, continue to execute. If all loop times have been executed, the entire loop ends.
[0092] It should be noted that the data processing node can be used to process the data of existing global variables or define new variable types. In the entire API orchestration canvas, parameters and variables run through the entire API orchestration process. The output parameters or variables set by each active node will be stored in the global context. Subsequent nodes can reference or update the value of the variable, and finally define the parameters to be output at the end node. The data processing node processes the output parameters of each node or defines new parameter variables in the global context. Figure 5 As shown, Figure 5 The following is a schematic diagram of an example of orchestration parameter transfer in one implementation of an embodiment of the present application.
[0093] exist Figure 5 In the API orchestration service, each active node has its own node input parameters and node output parameters. Among them, the service input parameters are the request parameters of the current API orchestration service. When the API orchestration service is called, the values of the request body and header information will be assigned to the corresponding parameter names. The node output parameters are the parameters output after each active node is executed. The node output parameters can be used as node input parameters of other nodes, so that each active node in the orchestration can collaborate. The service output parameters define the output parameters of the API, that is, the returned data. In order to more conveniently process the output parameters of the node, a data processing node is also provided in the embodiment of the present application. The data processing node includes a variable setting node and a data processing node.
[0094] It should be noted that the data processing node can be used to process the intermediate variables in the global context, where the node input parameters are all the parameters in the global variables, and the node output parameters are the results of data processing. The data processing node processes the existing variables by configuring the script and returns the new variables. In practical applications, the data processing node can meet the following principles: data processing is a value transfer method that does not change the value of the original variable; the script needs to use the return statement, otherwise the return value is empty; if the output parameter name and the existing variable name are repeated, the content corresponding to the existing variable name will be replaced.
[0095] It should be explained that setting a variable node is used to set global variables, and the set variables can be used directly by subsequent nodes. Among them, variable values can reference constants, variable names and variable functions. Referencing a constant is to initialize the variable value; referencing a variable name or a variable function is to redefine the output parameter of the previous node as a global variable, which is convenient for subsequent use. If the referenced variable name changes, it will not affect the set variable. Among them, the variable function is a way of obtaining variable values in a hierarchical manner designed in this application, which can facilitate the convenient reference of variables in the arrangement. Specifically, the following rules can be met: (1) ab: Get a certain attribute b in variable a; (2) abc: Get the c attribute value of the b attribute in variable a; (3) a[0]: Get the first item of array a; (4) a[0].b: Get the attribute b of the first item of array a; (5) #ab[0]: Get the first item of attribute b of array a; (6) #res.data[2].name, res.abc, a[0].bc obtain values in a hierarchical manner.
[0096] It should be noted that the call service node is the API node that defines the API that needs to be orchestrated. Each call service node can be bound to an API. When executing the call service node, the API call will be made according to the pre-configured node parameter configuration. When the API call response is received, the API return result will be stored in the global variable so that subsequent nodes can use it directly. By calling the service node, multiple business APIs can be logically assembled. The parameters that need to be defined in this node in the API orchestration canvas are as follows: (1) API path: the API address that needs to be called when executing this node; (2) Request method: divided into POST and GET; (3) Timeout: the timeout of the API call. If the response does not return after the set time, the call will be terminated; (4) Request parameters: request parameters include request body parameters and request path parameters; (5) Header information: information that needs to be carried in the http request header when the API is called; (6) Return parameter name: after the API call is successful, the return result will be assigned to the return parameter.
[0097] It should be explained that the start node in the embodiment of the present application corresponds to the starting point when the entire API orchestration service is executed, and the end node corresponds to the end point when the entire API orchestration service is executed. In the start node, the service input parameter of the entire API orchestration service is defined, that is, the node parameter configuration when the API is called, which may specifically include request body parameters and request header parameters. When the orchestration service is executed, the parameters of the user request body and header information are assigned to the corresponding variables, and these variables can be directly used in subsequent active nodes. The end node is used to assemble the entire return message of the API, and the return message may include platform-common return fields and user-defined return fields, etc. Among them, the platform-common return fields may include error codes, error messages, API response time, API request link ID, etc. The platform-common return fields can be renamed, error codes and error messages can be customized, and customized error code types are supported, including successful response, parameter exceptions, authentication exceptions, query exceptions and other exceptions. The user-defined return field can be an out-of-parameter variable or an out-of-parameter member variable. Among them, the output parameter variable can be used to reference the json variable of an activity node before the end node in the process. It can be the output of the API call node or the structure after data processing. Just fill in the corresponding variable name, and the variable value needs to be in json or map structure; the output parameter member variable is used to customize the output parameters. The field name and field value must be specified. If the field name and the attribute value of the output parameter variable have the same name, the corresponding value in the variable with the same name can be replaced.
[0098] In one implementation of the embodiment of the present application, the API orchestration canvas in the present application can also include other business nodes in order to provide more convenient expansion capabilities. For other business scenarios, such as email sending, monitoring alarms, log embedding and other requirements, it is only necessary to define the input and output of the node in the form of parameter passing.
[0099] Step S30, determining an API configuration structure according to the node type and node parameter configuration of the active node;
[0100] It should be noted that the above node type is one of the following types: logic control node, data processing node, call service node, business node, start node and end node. Based on the user-configured activity nodes and activity parameter configurations, the API configuration structure of the API orchestration can be determined.
[0101] Specifically, the step of determining the API configuration structure according to the node type and node parameter configuration of the active node includes:
[0102] Determine the node type and node parameter configuration corresponding to the obtained node;
[0103] Determine the node edge relationship between each of the active nodes based on the node type and the node parameter configuration;
[0104] An API configuration structure is determined according to the node type, the node parameter configuration, and the node edge relationship.
[0105] It should be noted that the node parameter configuration may include parameters such as edge relationships and node configurations set by the user. Specifically, the API configuration structure can generate a JSON-structured configuration file (i.e., an API configuration file) based on the node configuration or edge relationship of the active node in the canvas. The file may contain the node parameter configuration, call relationship, variable reference, node edge relationship, etc. defined by each active node. In the subsequent API deployment process, the API configuration file can be parsed and the final execution sequence flow can be generated, and the execution will be performed according to the execution sequence flow when the API is called.
[0106] In one implementation of the embodiment of the present application, the API configuration structure may consist of the following parts:
[0107] 1. Edge relationship: maintains the relationship between each node and the edge connecting the node; which may include: 1) node ID; 2) destination node number; 3) source node number.
[0108] 2. Node configuration: The node configuration is an array structure, which contains the various node types mentioned above. Each node type follows the following unified node structure specifications: 1) Node name; 2) Node description; 3) Node number; 4) Node type; 5) Node parameter set: The node parameter set is configured according to the above node parameters and is the core content of the node configuration; 6) Node return parameters; 7) Node parent node reference.
[0109] 3. Configure the execution chain: The node connection relationship and node configuration information are maintained separately in 1 and 2 above. Before the API is deployed, the structural information of 1 and 2 above will be integrated to produce the final execution chain configuration structure to facilitate the initialization of the execution chain when the API is deployed. The execution chain structure can be as follows: 1) Start node: that is, the start node, which maintains the request body and header information parameters; 2) Execution chain: The execution chain formed by other business logic nodes, the structure can be as follows: a) Node name; b) Node type; c) Branch strategy; d) Branch condition; e) Branch execution chain: The branch execution chain contains all the contents of the execution chain in 2) above, forming a recursive structure; 3) End node: The end node maintains the return information and return code information.
[0110] Step S40: Generate an API configuration file based on the active node and the API configuration structure.
[0111] It should be noted that in the embodiment of the present application, the activity nodes and API configuration structure determined by the user through dragging and dropping operations on the API orchestration canvas can be saved as an API configuration file and saved in the API configuration file center for subsequent API deployment.
[0112] The embodiment of the present application visualizes the API orchestration canvas; determines the active nodes set by the user based on the API orchestration canvas; determines the API configuration structure based on the node type and node parameter configuration of the active node; and generates an API configuration file based on the active node and the API configuration structure. Since API orchestration is performed in a visual way, business logic can be orchestrated by dragging and dropping components, which greatly reduces the user's learning cost.
[0113] Based on the above, the present application also proposes an API deployment method. In the API deployment method in the embodiments of the present application and in the following embodiments, the execution subject can be a computing service device with data processing, network communication and program running functions, such as a computer, a server, etc., or an electronic device, a virtual device, etc. that can realize the above functions. The following takes the API deployment device (referred to as the deployment device) as an example to illustrate this embodiment and the following embodiments.
[0114] In one implementation of the embodiment of the present application, the visual API orchestration method and the API deployment method of the embodiment of the present application can be implemented in the same device, that is, the above-mentioned visual API orchestration device and the above-mentioned API deployment device can be the same device.
[0115] Based on this, the present application embodiment provides a visual API arrangement method, referring to Figure 5 , Figure 5 This is a flow chart of the first embodiment of the visual API arrangement method of this application. Figure 5 As shown, the API deployment method includes:
[0116] Step S100, obtaining an API configuration file;
[0117] Step S200, determining the active node and target API configuration structure of the target API based on the API configuration file;
[0118] Step S300: deploy the target API to the query engine service according to the target active node and the target API configuration structure.
[0119] It should be noted that the above API configuration file may include active nodes and API configuration structures. The above API configuration file may be obtained based on the visual API arrangement method described above, or may be obtained based on other methods, which is not limited in the present application embodiment.
[0120] It is understandable that when a user initiates an API deployment process, the deployment device may parse the API configuration file, and then determine the active node of the target API and the API target API configuration structure based on the active node and API configuration structure in the API configuration file.
[0121] It should be understood that the above-mentioned query engine service is a service that can process query requests and return query results. By deploying the target API to the query engine service, the query requests initiated by the user can be processed.
[0122] In the embodiment of the present application, in order to implement API deployment, the step of deploying the target API to the query engine service according to the target active node and the target API configuration structure includes:
[0123] Determine the node type and node parameter configuration in the target active node according to the target API configuration structure;
[0124] Traversing from the start target activity node to the end target activity node in the target activity nodes, and determining the execution chain corresponding to the target API based on the node type and node parameter configuration of the intermediate target activity nodes;
[0125] Constructing an execution sequence flow of the target API according to the execution chain;
[0126] The query engine service is deployed with a target API based on the execution sequence flow and the service unit configuration information of the query engine service.
[0127] In one implementation of the embodiment of the present application, in order to realize the number of steps of the API, it can be initiated from the query derived service, and the API deployment process is completed when the query engine service successfully initializes the API configuration information. Specifically, the derived service can obtain the API configuration file, and obtain the API configuration information to be launched based on the API configuration file (that is, the active nodes of the target API and the information related to the target API configuration structure). Furthermore, the derived service can obtain the basic information of the target API to be launched (such as domain name, request interface, etc.) and the service unit configuration information of the query engine service from the database, where the API is associated with the query engine service, and one API can be deployed to multiple query engine services.
[0128] Furthermore, the derived service may parse the service unit configuration information, and if a data query node exists therein, the data source connection information associated with the query node may be obtained from the database.
[0129] It is understandable that the derived service can obtain the above-mentioned API configuration information, API basic information, service configuration information, data source connection information, etc. to obtain an API deployment package, and then deploy the API deployment package to the query engine service.
[0130] It should be noted that when deploying the API, the query engine service can perform link initialization based on the information in the API deployment package. Specifically, the query engine service can initialize the start activity node and the end activity node, and materialize the request parameters and header information parameters defined in the start activity node into specific class objects; materialize the return parameters and return codes defined in the end activity node 1) into corresponding class objects, with the parameters as attributes of the object.
[0131] Furthermore, the query engine service can also initialize the execution chain. In an orchestration API, there can be one main execution chain and multiple branch execution chains (depending on the branch nodes), which are initialized according to the edge relationship between the active nodes. During initialization, if 2) the current node is judged to be a normal node, the node is directly placed in the main execution chain. If the current node is a branch or loop node, a sub-execution chain object is generated first, each branch is a sub-execution chain, and then each node in the branch is processed in turn, and the node is placed in the corresponding sub-execution chain, and finally the final execution chain is generated. Specifically, the step of determining the execution chain corresponding to the target active node based on the node type and node parameter configuration of the intermediate target active node includes: when the node type of the intermediate target active node is a branch node, determining the branch execution strategy of the intermediate target active node according to the node parameter configuration of the intermediate target active node; determining the branch link corresponding to the intermediate target active node based on the branch execution strategy; when the node type of the intermediate target active node is a loop node, determining the number of loops and the loop end condition of the intermediate target active node based on the node parameter configuration of the intermediate target active node; determining the loop link corresponding to the intermediate target active node according to the number of loops and the loop end condition; and determining the execution chain corresponding to the target API according to the branch link and the loop link. The step of deploying the target API to the associated query engine service based on the API deployment package includes: initializing the target initial target activity node and the target end target activity node in the associated query engine service based on the start target activity node and the end target activity node in the API deployment package to obtain a node class object; initializing the execution link in the associated query engine service according to the execution sequence flow in the API deployment package to obtain an execution chain object; and deploying the target API to the associated query engine service based on the node class object and the execution chain object.
[0132] Furthermore, the query engine service can also execute node initialization methods. Some methods of active nodes need to be executed when the API is deployed, such as initializing the data source connection pool, precompiling scripts, pre-joining query statements, initializing authentication information, etc. For this type of content, it can be executed during 3) API deployment, so that the corresponding operation can be started when the API is called.
[0133] It should be noted that when an execution chain is generated based on an API deployment package, the execution chain can be saved in a global context, and the corresponding execution chain can be retrieved according to the API domain name during execution.
[0134] Furthermore, the query engine interface can expose the corresponding API domain name and provide an HTTP request interface for users to query and call. When the API is deployed, the query engine service can call back the query derived service, and the derived service can modify the corresponding API interface status and publish API resources for query and call.
[0135] It should be noted that the execution sequence flow of the orchestration API can represent the connection of multiple active nodes, and the connection order between the active nodes defines the execution order of the orchestration API. When the orchestration API is a single link (that is, when there is no branch node or loop node in the active node), each node is executed in sequence from left to right in the link; when the orchestration API has branch nodes or loop nodes, a branch from the beginning to the end of the branch will be executed in the order of the execution of the arrogant face; if other branches are nested in the branch, then the same applies. When all branch nodes are executed, return to the previous link to continue execution.
[0136] In one implementation of the embodiment of the present application, the link execution sequence flow of the API orchestration can be as follows: start execution from the start activity node, extract the request body and header information parameters in the start activity node and put them into the global context.
[0137] Execute subsequent activity nodes in sequence. If they are ordinary nodes, call the activity node execute method, execute the node processing function, and report the result returned after the node is executed in the context.
[0138] If it is a branch node, each branch is executed in sequence according to the branch strategy. When the branch is executed to the branch end node, the main link continues to be executed. If a new branch is encountered during branch execution, the current branch is blocked and waits for the new branch to be executed. After the new branch is executed, the execution continues from the current branch. When the branch end node is executed, the subsequent nodes of the main execution link are executed in sequence.
[0139] If it is a loop node, the number of loops is determined according to the node parameter configuration, and the links from the start of the loop to the end of the loop are executed in sequence. If the continue node or break node is executed, it is determined whether the conditions for jumping out of the loop are met. If they are met, the current loop is jumped out or the entire loop process is ended. When the loop end node is executed, the subsequent nodes of the main execution link are executed in sequence.
[0140] When the execution reaches the end activity node, when all intermediate nodes are executed normally, or a node ends abnormally, the entire orchestration API execution ends, and the return code returns the corresponding result information according to the return parameters defined in the end node.
[0141] The embodiment of the present application obtains an API configuration file; determines the target API's active node and target API configuration structure based on the API configuration file; and deploys the target API to the query engine service according to the target active node and target API configuration structure. Since the orchestrated API is quickly released in a configured manner, the flexibility of development is improved; the orchestrated API provides a visual logical link, which is convenient for subsequent maintenance and handover.
[0142] Based on the above embodiments of the present application, in the second embodiment of the API deployment method of the present application, the same or similar contents as the above embodiments can be referred to the above introduction, and will not be repeated later. On this basis, in the embodiment of the present application, in order to handle the exceptions in the orchestration process, the method also includes:
[0143] The API orchestration process is monitored, and if there are abnormal activity nodes, the node abnormality can be judged. Specifically, for each activity node, two abnormal strategies can be defined, namely, catching exceptions and throwing exceptions.
[0144] It should be noted that when using catching exceptions as the exception strategy, if the node fails to execute, the exception information will be stored in the global context, and the execution of the orchestration process will not be terminated; if using throwing exceptions as the exception strategy, when the node fails to execute, the subsequent nodes of the smallest branch node where the node is located will not be executed, and exception handling will be performed at the branch node.
[0145] In one implementation of the embodiment of the present application, different exception handling methods may correspond to different branch strategies. When the branch strategy is a serial strategy or a parallel strategy, if a branch throws an exception, it is considered that the current branch execution has failed, and the exception information will continue to be thrown upward. When the branch strategy is a multi-query fast strategy, if a branch throws an exception, it will not directly continue to pass the exception upward, and will continue to wait for the results of other branches to return. If one branch is successfully executed, the execution process will continue downward. If all branches return exceptions, the exception will be thrown upward.
[0146] In one implementation of the present application, for the exception handling of the end activity node, the exception thrown by each activity node will go to the branch node. If the branch node continues to throw the exception upward until the outermost branch determines that the exception needs to be thrown upward, the end node will receive the exception information and handle the exception. First, determine whether the exception is within the exception range defined by the API orchestration process. If so, return the defined error code and error message. If it is other undefined exceptions, return the default error code and error message.
[0147] The embodiments of the present application improve the stability of the system by processing the exceptions that occur during the process of orchestrating APIs and deploying APIs.
[0148] In one implementation of the embodiment of the present application, the API orchestration deployment process of the present application can be as follows: Figure 6 shown.
[0149] Reference Figure 6 The orchestration device can obtain API configuration information such as active nodes and API configuration structure determined by the user based on the drag-and-drop operation of the visual API orchestration canvas, and package these API configuration information into an API configuration file and upload it to the file server.
[0150] Furthermore, when API deployment is required, the API configuration file can be obtained from the file server by querying the derived service. At the same time, the API basic information can be obtained through the derived service, and the API configuration information can be obtained by parsing based on the API configuration file, and the execution chain can be generated based on the API configuration information. Based on the API basic information and the execution chain, an API deployment package can be generated.
[0151] Furthermore, the API deployment package can be deployed to the query engine service. Specifically, the start node and the end node can be initialized, the execution chain can be initialized, and the node initialization method can be executed, thereby generating and exposing the API domain name and HTTP interface, so that the derived service can modify the corresponding API interface status and publish API resources for calling.
[0152] This application also provides a visual API arrangement device, please refer to Figure 7 , the visual API arrangement device comprises:
[0153] A display module 10 is used to visually display the API orchestration canvas;
[0154] An orchestration module 20, configured to determine an activity node set by a user based on the API orchestration canvas;
[0155] The orchestration module 20 is further used to determine the API configuration structure according to the node type and node parameter configuration of the active node;
[0156] The file generation module 30 is used to generate an API configuration file based on the active node and the API configuration structure.
[0157] This application also provides an API deployment device, please refer to Figure 8 , the API deployment device includes:
[0158] The file acquisition module 100 is used to acquire the API configuration file;
[0159] A file parsing module 200, used to determine the active node of the target API and the target API configuration structure based on the API configuration file;
[0160] The API deployment module 300 is used to deploy the target API to the query engine service according to the target active node and the target API configuration structure.
[0161] The visual API orchestration device / API deployment device provided by the present application adopts the visual API orchestration method / API deployment device method in the above-mentioned embodiment, which can solve the technical problems of the long development cycle of the existing API orchestration method / API deployment method and the inconvenient changes and maintenance after API deployment. Compared with the prior art, the beneficial effects of the visual API orchestration device / API deployment device provided by the present application are the same as the beneficial effects of the visual API orchestration method / API deployment method provided by the above-mentioned embodiment, and the other technical features in the visual API orchestration device / API deployment device are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.
[0162] The present application also provides an API orchestration and deployment system, the API orchestration and deployment system comprising an API orchestration module and an API deployment module;
[0163] The API arrangement module is used to implement the steps of the visual API arrangement method described above;
[0164] The API deployment module is used to implement the steps of the API deployment method as described above.
[0165] It should be noted that in the embodiments of the present application, the visual API orchestration device and the API deployment device have the same or similar structure and function, and the present application only describes the device items of the present application by taking the visual API orchestration device as an example. The structure and function of the API deployment device can be set with reference to the visual API orchestration device, and the embodiments of the present application will not be elaborated on this.
[0166] The present application provides a visual API orchestration device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the visual API orchestration method in the above-mentioned embodiment 1.
[0167] Reference below Fig. 9, which shows a schematic diagram of the structure of a visual API arrangement device suitable for implementing the embodiment of the present application. The visual API arrangement device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The visual API orchestration device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0168] like Fig. 9 As shown, the visual API orchestration device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the visual API orchestration device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the visual API orchestration device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a visual API orchestration device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided instead.
[0169] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0170] The visual API orchestration device provided by the present application adopts the visual API orchestration method in the above embodiment, which can solve the technical problems of the long development cycle of the existing API orchestration method and the inconvenient changes and maintenance after API deployment. Compared with the prior art, the beneficial effects of the visual API orchestration device provided by the present application are the same as the beneficial effects of the visual API orchestration method provided by the above embodiment, and the other technical features in the visual API orchestration device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0171] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0172] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0173] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the visual API orchestration method and / or API deployment method in the above-mentioned embodiments.
[0174] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0175] The computer-readable storage medium may be included in the visual API orchestration device and / or the API deployment device; or may exist independently without being assembled into the visual API orchestration device and / or the API deployment device.
[0176] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the visual API orchestration device, the visual API orchestration device:
[0177] Visualize the API orchestration canvas;
[0178] Determine an activity node set by a user based on the API orchestration canvas;
[0179] Determine an API configuration structure according to the node type and node parameter configuration of the active node;
[0180] An API configuration file is generated based on the active node and the API configuration structure.
[0181] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the API deployment, the API deployment:
[0182] Get the API configuration file;
[0183] Determine the active node of the target API and the target API configuration structure based on the API configuration file;
[0184] The target API is deployed to the query engine service according to the target active node and the target API configuration structure.
[0185] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0186] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0187] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0188] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned visual API orchestration method and / or API deployment method, and can solve the technical problems of the long development cycle of the existing API orchestration method and the inconvenient changes and maintenance after API deployment. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the visual API orchestration method and / or API deployment method provided in the above-mentioned embodiments, and will not be repeated here.
[0189] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned visual API orchestration method and / or API deployment method.
[0190] The computer program product provided by this application can solve the technical problems of the long development cycle of the existing API orchestration method and the inconvenient changes and maintenance after API deployment. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the visual API orchestration method provided by the above embodiment, which will not be repeated here.
[0191] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A visual API arrangement method, characterized in that: The method comprises: Visualize the API orchestration canvas; Determine an activity node set by a user based on the API orchestration canvas; Determine an API configuration structure according to the node type and node parameter configuration of the active node; An API configuration file is generated based on the active node and the API configuration structure.
2. The visual API arrangement method according to claim 1, characterized in that: The step of determining the API configuration structure according to the node type and node parameter configuration of the active node includes: Determine the node type and node parameter configuration corresponding to the obtained node; Determine the node edge relationship between each of the active nodes based on the node type and the node parameter configuration; An API configuration structure is determined according to the node type, the node parameter configuration, and the node edge relationship.
3. An API deployment method, characterized in that: The method comprises: Get the API configuration file; Determine the active node of the target API and the target API configuration structure based on the API configuration file; The target API is deployed to the query engine service according to the target active node and the target API configuration structure.
4. The API deployment method according to claim 3, characterized in that: The step of deploying the target API to the query engine service according to the target active node and the target API configuration structure includes: Determine the node type and node parameter configuration in the target active node according to the target API configuration structure; Traversing from the start target activity node to the end target activity node in the target activity nodes, and determining the execution chain corresponding to the target API based on the node type and node parameter configuration of the intermediate target activity nodes; Constructing an execution sequence flow of the target API according to the execution chain; The query engine service is deployed with a target API based on the execution sequence flow and the service unit configuration information of the query engine service.
5. The API deployment method according to claim 4, characterized in that: The step of determining the execution chain corresponding to the target activity node based on the node type and node parameter configuration of the intermediate target activity node includes: When the node type of the intermediate target active node is a branch node, determining a branch execution strategy of the intermediate target active node according to the node parameter configuration of the intermediate target active node; Determine the branch link corresponding to the intermediate target active node based on the branch execution strategy; When the node type of the intermediate target activity node is a loop node, determining the number of loops and loop end conditions of the intermediate target activity node based on the node parameter configuration of the intermediate target activity node; Determine the loop link corresponding to the intermediate target active node according to the loop number and the loop end condition; An execution chain corresponding to the target API is determined according to the branch link and the loop link.
6. The API deployment method according to claim 4, characterized in that: The step of deploying the query engine service to the target API based on the execution sequence flow and the service unit configuration information of the query engine service comprises: Get the service unit configuration information of the query engine service; Associating the target API with the query engine service; Determine data source connection information of the data query node based on the service unit configuration information; Packaging is performed according to the execution sequence flow, the service unit configuration information and the data source connection information to obtain an API deployment package; The target API is deployed to the associated query engine service based on the API deployment package.
7. The API deployment method according to claim 6, characterized in that: The step of deploying the target API to the associated query engine service based on the API deployment package includes: Initialize the target initial target activity node and the target end target activity node in the associated query engine service based on the start target activity node and the end target activity node in the API deployment package to obtain a node class object; Initialize the execution chain in the associated query engine service according to the execution sequence flow in the API deployment package to obtain an execution chain object; The target API is deployed to the associated query engine service based on the node class object and the execution chain object.
8. A visual API arrangement device, characterized in that: The visual API arrangement device comprises: The display module is used to visualize the API orchestration canvas; An orchestration module, used to determine an activity node set by a user based on the API orchestration canvas; The orchestration module is further used to determine the API configuration structure according to the node type and node parameter configuration of the active node; The file generation module is used to generate an API configuration file based on the active node and the API configuration structure.
9. An API deployment device, characterized in that: The API deployment device includes: File acquisition module, used to obtain API configuration files; A file parsing module, used to determine the active node of the target API and the target API configuration structure based on the API configuration file; The API deployment module is used to deploy the target API to the query engine service according to the target active node and the target API configuration structure.
10. An API orchestration and deployment system, characterized in that: The system includes an API orchestration module and an API deployment module; Wherein, the API orchestration module is used to implement the steps of the visual API orchestration method as described in claim 1 or 2; The API deployment module is used to implement the steps of the API deployment method as described in any one of claims 3-7.
Citation Information
Cited By
Dynamic variable processing method and equipment based on graph topological relation
CN121918824A
