CN113438317A - Gateway data processing method and device - Google Patents

Gateway data processing method and device Download PDF

Info

Publication number
CN113438317A
CN113438317A CN202110771411.0A CN202110771411A CN113438317A CN 113438317 A CN113438317 A CN 113438317A CN 202110771411 A CN202110771411 A CN 202110771411A CN 113438317 A CN113438317 A CN 113438317A
Authority
CN
China
Prior art keywords
information
node
gateway
target
api
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.)
Granted
Application number
CN202110771411.0A
Other languages
Chinese (zh)
Other versions
CN113438317B (en
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.)
Digital Guangdong Network Construction Co Ltd
Original Assignee
Digital Guangdong Network Construction 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 Digital Guangdong Network Construction Co Ltd filed Critical Digital Guangdong Network Construction Co Ltd
Priority to CN202110771411.0A priority Critical patent/CN113438317B/en
Publication of CN113438317A publication Critical patent/CN113438317A/en
Application granted granted Critical
Publication of CN113438317B publication Critical patent/CN113438317B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a method and a device for processing gateway data, wherein the method comprises the following steps: receiving gateway node information reported by an API gateway, wherein the gateway node information comprises gateway role information and gateway service information; determining a target level where the API gateway is located and corresponding father node information in a node metadata tree according to the gateway role information; determining target coding information for the API gateway, the target coding information being related to the parent node information and the target hierarchy; and determining a target node which takes the target coding information as a node identifier in a branch where the father node information is located, and recording the gateway service information in the target node so as to realize unified management of the gateway information of various discrete API gateways with different standards and without correlation or communication with each other in a unified standard and realize interconnection and intercommunication of different API gateways.

Description

Gateway data processing method and device
Technical Field
The present application relates to network technologies, and in particular, to a method and an apparatus for processing gateway data.
Background
The API gateway (API gateway) refers to that calls of all APIs are uniformly accessed to an API gateway layer, and the gateway layer is responsible for accessing and outputting. For services with large number, complexity and size, the introduction of the API gateway has a series of advantages: the aggregation interface enables the service to be transparent to the caller, and the coupling degree between the client and the back end is reduced; background services are aggregated, so that the flow is saved, the performance is improved, and the user experience is improved; and providing API management functions of security, flow control, filtering, caching, charging, monitoring and the like.
In the government industry, as a social management department and a promoter of informatization development, a high-tech means is indispensable for quickly responding to government work and solving problems. In the information-based construction process of electronic government affairs, the API gateway can bring great convenience to government affair work, and the government affair efficiency is improved. However, the API gateway in the existing government affair system cannot solve the problems of dispersed government affair platform and application construction management, complex system, inconsistent service standards, unsmooth service sharing, insufficient provincial and urban business collaboration, and the like.
Disclosure of Invention
The application provides a gateway data processing method and device, which are used for solving the problems that in the prior art, an API gateway cannot solve the problems of dispersed government affair platform and application construction management, complex system, inconsistent service standards, unsmooth service sharing, insufficient provincial and urban area service collaboration and the like.
In a first aspect, an embodiment of the present application provides a method for processing gateway data, where the method includes:
receiving gateway node information reported by an API gateway, wherein the gateway node information comprises gateway role information and gateway service information;
determining a target level where the API gateway is located and corresponding father node information in a node metadata tree according to the gateway role information;
determining target coding information for the API gateway, the target coding information being related to the parent node information and the target hierarchy;
and determining a target node using the target coding information as a node identifier in a branch where the father node information is located, and recording the gateway service information in the target node.
In a second aspect, an embodiment of the present application further provides a method for processing gateway data, where the method includes:
receiving a data access request, wherein the data access request comprises a target URL address;
if the target URL address is judged not to be the URL address corresponding to the API gateway, searching the target URL address in a node metadata tree stored locally to obtain the coding information of the target API gateway required to be accessed;
generating a new URL address according to the URL address corresponding to the API gateway and the coding information of the target API gateway;
and jumping to the webpage corresponding to the new URL address.
In a third aspect, an embodiment of the present application further provides an apparatus for processing gateway data, where the apparatus includes:
the gateway information receiving module is used for receiving gateway node information reported by the API gateway, wherein the gateway node information comprises gateway role information and gateway service information;
a father node and target level information determining module, configured to determine, according to the gateway role information, a target level where the API gateway is located and corresponding father node information in a node metadata tree;
a target coding information determination module for determining target coding information of the API gateway, the target coding information being related to the parent node information and the target hierarchy;
and the target node determining module is used for determining a target node which takes the target coding information as a node identifier in a branch where the father node information is located, and recording the gateway service information in the target node.
In a fourth aspect, an embodiment of the present application further provides an apparatus for gateway data processing, where the apparatus includes:
an access request receiving module, configured to receive a data access request, where the data access request includes a target URL address;
the coding information searching module is used for searching the target URL address in a locally stored node metadata tree to obtain the coding information of the target API gateway required to be accessed if the target URL address is judged not to be the URL address corresponding to the API gateway;
the URL address generating module is used for generating a new URL address according to the URL address corresponding to the API gateway and the coding information of the target API gateway;
and the webpage skipping module is used for skipping to the webpage corresponding to the new URL address.
In a fifth aspect, the present application further provides a computing device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the method for processing gateway data is implemented.
In a sixth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for gateway data processing described above.
The application has the following beneficial effects:
in this embodiment, after receiving gateway node information carrying gateway role information and gateway service information reported by an API gateway, a target level where the API gateway is located and corresponding parent node information may be determined in a node metadata tree, and target coding information of the API gateway may be determined, where the target coding information is determined according to coding information of an existing leaf node in the target level of the parent node information. And then determining a target node which takes the target coding information as the node identification in the node metadata tree, and recording the gateway service information in the target node. Therefore, the gateway node information of various discrete API gateways with different standards and without correlation or communication is managed in a unified mode according to the unified standard, a global node metadata tree containing multi-level API gateway nodes is obtained, interconnection and intercommunication of different API gateways are achieved, and a data basis is provided for subsequent cross-level, cross-region and cross-department service cooperative linkage.
In the node metadata tree, there may be k (k >0) gateway nodes in other hierarchies except the hierarchy where the root node is located. The metadata server adds the gateway node information in a corresponding branch according to the gateway node information reported by any gateway node, and the node metadata tree is transversely added with leaf nodes k (k >0) and gateway service information m (such as micro service), so that the tree hierarchy is three-level or four-level, the depth of the tree cannot be infinitely increased, the complexity of the search time in the tree is O (1), and the node search efficiency is improved.
Drawings
Fig. 1 is a flowchart of an embodiment of a method for processing gateway data according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a tree structure of a node metadata tree according to an embodiment of the present application;
FIG. 3 is a diagram illustrating an exemplary node metadata tree structure according to an embodiment of the present application;
fig. 4 is a flowchart of an embodiment of a method for processing gateway data according to a second embodiment of the present application;
fig. 5 is a block diagram of an embodiment of a gateway data processing apparatus according to a third embodiment of the present application;
fig. 6 is a block diagram of an embodiment of a gateway data processing apparatus according to a fourth embodiment of the present application;
fig. 7 is a schematic structural diagram of a computing device according to a fifth embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some of the structures related to the present application are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an embodiment of a method for processing gateway data according to an embodiment of the present application, where the embodiment may be applied to a metadata server, where the metadata server may include a single server or a server cluster, and the embodiment is not limited to this. The metadata server is connected to a plurality of API gateways, and is used for managing or scheduling gateway information of each API gateway, and therefore, the metadata server may also be referred to as a scheduling server, a management server, or a master server, which is not limited in this embodiment.
In a possible application scenario, the method for processing gateway data provided by the embodiment can be applied to processing government affair data, so as to provide application support for multi-level collaborative linkage of cross-department, cross-hierarchy and cross-region.
The embodiment may specifically include the following steps:
and step 110, receiving gateway node information reported by the API gateway, wherein the gateway node information comprises gateway role information and gateway service information.
Specifically, when the API gateway is started, gateway node information of the gateway is collected, and the gateway node information is actively reported to the metadata server, so as to register corresponding gateway information with the metadata server. Illustratively, the gateway node information may include gateway role information and gateway service information.
The gateway role information may include administrative level information and functional information. The administrative level information is used for reflecting the administrative level of the functional department corresponding to the API gateway, and the administrative level may include, for example, province level, hall level, city level, district level, etc. from high to low. The function information is used for reflecting the administrative functions of the function department corresponding to the API gateway, such as traffic, ecology, emergency, finance, health and medical treatment and the like. For example, if the gateway role information is "a city financial bureau", the corresponding administrative level information is "prefecture level", and the function information is "finance"; for another example, if the gateway role information is "finance hall", the corresponding administrative level information is "hall level", and the function information is "finance".
An API gateway may include multiple services, and for each service, when it is turned on, gateway node information needs to be reported to the metadata server, so that the gateway service information included in the gateway node information is used to reflect service information or micro-service information, such as a service identifier, a service weight, a service port number, a micro-service parameter, etc., that the API gateway currently needs to register. In other examples, the gateway service information may also include IP address information or domain name information of the present API gateway.
And step 120, determining a target level where the API gateway is located and corresponding father node information in a node metadata tree according to the gateway role information.
In this embodiment, the node metadata tree is a data tree generated by the metadata server according to the received gateway node information reported by the API gateway. The node metadata tree may include a plurality of administrative levels, wherein each administrative level occupies a layer of the node metadata tree laterally. For example, the following code shows an exemplary node metadata tree of the present embodiment, where dgdpgtp is a root node, the corresponding administrative level is a province level, and different node metadata trees may be generated for government gateways of different provinces, respectively, for example, a government gateway of guangdong province corresponds to one node metadata tree, a government gateway of guangxi province corresponds to another node metadata tree, and so on. 0001. 0002, 0003 and the like are leaf nodes of the next layer of the root node, and the corresponding administrative level is a hall level; 4401-4406 and the like are leaf nodes at the next layer of the hall level, and the corresponding administrative level is the city level.
“/dgdpgtp/0001
|-/dgdpgtp/0001/4401
|-/dgdpgtp/0001/4402
/dgdpgtp/0002
|-/dgdpgtp/0002/4403
|-/dgdpgtp/0002/4404
/dgdpgtp/0003
|-/dgdpgtp/0003/4405
|-/dgdpgtp/0003/4406
……”
The above-mentioned node metadata tree can be visually represented as a tree structure shown in fig. 2, the highest level is a root node "dgdpgtp", the next level of the root node is a "hall level" node level, and the next level of the hall level node level is a "city and ground level" node level.
In one embodiment, step 120 may further include the steps of:
determining a target level where the API gateway is located according to the administrative level information; and determining parent node information corresponding to the API gateway according to the function information.
Specifically, assuming that the administrative level is the hall level, the target level is the level where the hall level is located; assuming that the administrative level is "metro level", the target level is the level at which "metro level" is located. According to the target level, the level where the parent node is located at the upper layer of the target level can be determined, and then the node related to the function information is selected from the level where the parent node is located according to the function information to serve as the parent node corresponding to the current API gateway. The parent node information may include encoding information or a name of the parent node.
For example, as shown in the exemplary node metadata tree structure diagram of fig. 3, assuming that the gateway role information is "D city traffic authority", the corresponding administrative level information is "city level", and the function information is "traffic management", it may be determined in fig. 3 that the target level corresponding to the administrative level information is the third level from top to bottom, and the parent node is located at the second level. According to the function information of traffic management, the parent node can be known as a traffic hall of the second layer.
For example, in fig. 3, it is assumed that the gateway role information is "financial hall", the corresponding administrative level information is "hall level", and the function information is "finance". It can be determined in fig. 3 that the target level corresponding to the administrative level information is the second layer from top to bottom, and the parent node is located at the root node of the first layer.
Step 130, determining target coding information of the API gateway, the target coding information being related to the parent node information and the target hierarchy.
The target coding information is a data identifier of the current API gateway in the node metadata tree, and the current API gateway can be associated in the node metadata tree according to the target coding information. When determining the target coding information of the current API gateway, the determination may be made in consideration of the parent node information thereof and the target hierarchy.
In one embodiment, step 130 may include the steps of:
and step 130-1, acquiring gateway role information corresponding to each existing leaf node according to the encoding information of the parent node information in the existing leaf nodes of the target hierarchy.
This step may extrapolate gateway role information based on the encoded information. When the method is implemented, the node metadata tree can store the association relationship between each piece of coding information and the corresponding gateway role information, and after the coding information of the leaf nodes is determined, the gateway role information corresponding to the coding information can be found out according to the association relationship.
For example, in the code of the node metadata tree and fig. 2, assuming that the parent node information corresponding to the current API gateway is "/0001", the encoding information of the existing leaf node of the parent node at the target level is "/dgdptp/0001/4401" and "| -/dgdptp/0001/4402". Assuming that fig. 2 corresponds to fig. 3 one-to-one, fig. 3 further stores gateway role information corresponding to each piece of encoded information, and the gateway role information of the parent node information "/0001" is "transportation hall", the gateway role information of "/dgdptp/0001/4401" may be "a city transportation administration", and the gateway role information of "| -/dgdptp/0001/4402" may be "B city transportation administration".
Step 130-2, comparing the gateway role information corresponding to each existing leaf node with the gateway role information of the API gateway to determine whether a node corresponding to the API gateway exists in the existing leaf nodes, if so, executing step 130-3, and if not, executing step 130-4.
In practice, different services or microservices can be provided by the same API gateway, each service needs to be registered in the metadata server, and different services of the same API gateway report the same gateway role information when reporting gateway node information, which may cause the gateway role information of the current API gateway to be recorded in the node metadata tree, so that deduplication processing is required, and the situation that the same API gateway has multiple nodes in the node metadata tree and causes the node metadata tree to be too large is avoided.
Specifically, after the gateway role information of the existing leaf node corresponding to the parent node of the current API gateway is obtained, it may be determined whether the gateway role information of the current API gateway exists in the gateway role information of the existing leaf node, that is, whether the corresponding node exists in the node metadata tree of the current API gateway. Specifically, if the gateway role information of the current API gateway exists in the gateway role information of the existing leaf node corresponding to the parent node of the current API gateway, it may be determined that the corresponding node already exists in the node metadata tree for the current API gateway, and then step 130-3 is continuously performed. If the gateway role information of the current API gateway does not exist in the gateway role information of the existing leaf node corresponding to the parent node of the current API gateway, it may be determined that the current API gateway does not exist in the node metadata tree, and step 130-4 is continuously performed.
And step 130-3, using the coding information corresponding to the corresponding node as the target coding information of the API gateway.
For example, assuming that the gateway role information of the current API gateway is "city a traffic authority", and a node corresponding to the "city a traffic authority" already exists in the node metadata tree, the encoding information corresponding to the node, such as "/dgdptp/0001/4401", may be used as the target encoding information of the current API gateway.
And step 130-4, generating target coding information of the API gateway based on the coding information of the existing leaf nodes in the target hierarchy and the father node information.
In one embodiment, if the current API gateway does not have a corresponding node in the node metadata tree, the most recently generated encoding information, that is, the last generated encoding information, may be determined from the encoding information of all existing leaf nodes of the target hierarchy. And then determining the next code based on the newly generated code information and a preset code rule, and generating target code information of the API gateway according to the next code and the father node information.
In an example, assuming that the preset encoding rule is a sequential encoding rule, as shown in fig. 2, assuming that the target level is a city level and the most recently generated encoding information of the target level is "4406", the next encoding is "4407" according to the sequential encoding rule, and then the parent node information corresponding to the API gateway of the next encoding is combined into the target encoding information of the API gateway, for example, assuming that the gateway role information of the current API gateway is "E city traffic authority", no corresponding node exists in the node metadata tree, and the corresponding parent node information is "/0001", the target encoding information of the API gateway is "/dgdptp/0001/4407" according to the above encoding rule.
In another example, assuming that the preset encoding rule is a sequential encoding rule, as shown in fig. 2, assuming that the target level is a hall level and the most recently generated encoding information of the target level is "0003", the next encoding is "0004" according to the sequential encoding rule, and then the parent node information (i.e. root node "/dgdptp") corresponding to the API gateway of the next encoding is combined into the target encoding information of the API gateway, for example, assuming that the gateway role information of the current API gateway is "fiscal hall", the corresponding node does not exist in the node metadata tree, and the corresponding parent node information is "/dgdptp", and the target encoding information of the API gateway can be obtained as "/dgdptp/0004" according to the encoding rule.
In another embodiment, in addition to determining the encoding information of each node in the node metadata tree according to the above sequential encoding manner, the encoding information of each API gateway may also be determined according to the function code of the function department corresponding to the API gateway. For example, if the administrative level information of the current API gateway is hall level, according to the function department of each hall level, the corresponding function code may be allocated in advance, and each function department and the corresponding function code are recorded in the associated data table, and by querying the associated data table, the function code of the function department corresponding to the current API gateway may be obtained. For another example, if the administrative level information of the current API gateway is in the local city level, the encoded information may be determined by combining administrative region codes of respective cities (e.g., 4401 is city a, 4402 is city C, 4403 is city B, etc.) based on the function codes of the parent node.
In other embodiments, the gateway node information may further include target coding information of the current API gateway, and the metadata server may directly extract the target coding information of the current API gateway from the gateway node information. However, as for the method of determining the target coding information by the API gateway, since each API gateway locally stores the latest node metadata tree, the target coding information may be determined by referring to the process of sequential coding in steps 130-1 to 130-4 on the metadata server side, or may be determined by referring to the above-mentioned process of combining the function code and the administrative area code, which is not limited in this embodiment.
Step 140, determining a target node using the target coding information as a node identifier in a branch where the parent node information is located, and recording the gateway service information in the target node.
When the method is implemented, if a node corresponding to the current API gateway exists in the existing leaf nodes of the father node corresponding to the current API gateway, a new node does not need to be created for the current API gateway, the corresponding node is directly used as a target node of the current API gateway, the gateway service information of the current API gateway is recorded in a metadata database associated with the target node, and the metadata database is used for storing one or more gateway service information of the corresponding node. Of course, the gateway role information of the current API gateway may also be stored in the metadata database.
On the other hand, if there is no node corresponding to the current API gateway in the existing leaf nodes of the parent node corresponding to the current API gateway, a target node using target coding information as a node identifier may be created in the branch of the node metadata tree where the parent node is located, a metadata database of the target node may be created, and then gateway service information of the current API gateway may be recorded in the metadata database associated with the target node. For example, assuming that the current API gateway is "E city transportation administration", and the corresponding target encoding information is "/dgdpgtp/0001/4407", the "/dgdpgtp/0001/4407" may be added in the "/dgdpgtp/0001" branch to associate the current API gateway in the node metadata tree.
In an embodiment, after step 140, the present embodiment may further include the following steps:
and synchronizing the newly generated node metadata tree to the API gateways corresponding to all nodes of the node metadata tree.
In this embodiment, each time the metadata server updates the node metadata tree, the latest node metadata tree is synchronized to all API gateways, where all API gateways refer to API gateways corresponding to all nodes of the node metadata tree. In this way, the latest node metadata tree is stored locally at each API gateway to provide a data basis for subsequent addressing of data accesses.
For the API gateway, after it receives the latest node metadata tree, it may store the latest node metadata tree locally. In implementation, if there is already a previous node metadata tree in the storage location, the previous node metadata tree may be updated to the latest node metadata tree in an incremental manner; alternatively, the newest node metadata tree may be directly substituted for the previous node metadata tree.
In an embodiment, in order to save data transmission resources, improve data transmission efficiency, and reduce resource occupation on the API gateway side, when performing tree synchronization, the node metadata tree may be copied, and the copied node metadata tree may be pruned to form a lightweight node metadata tree and then synchronized. During pruning, information which is useless for access in the node metadata tree can be deleted, and only the key information of the node metadata tree is reserved. For example, only the encoding information, service identification, and IP address information or domain name information of each node of the node metadata tree may be retained.
In an embodiment, the present embodiment may further include the following steps:
responding to the received update information, and positioning a node corresponding to the update information in the node metadata tree as a node to be updated; updating the node to be updated according to the updating information; and acquiring the updated node branch, and synchronizing the updated node branch to the API gateways corresponding to all nodes of the node metadata tree.
In this embodiment, if an API gateway is updated, the update information is reported to the metadata server in time. When the method is implemented, the API gateway and the metadata server can maintain connection through heartbeat, and the API gateway can attach the updating information to heartbeat information and send the heartbeat information to the metadata server.
Illustratively, the update information may include encoded information of the API gateway and update content. The update content may be determined according to an actual service scenario, which is not limited in this embodiment, for example, the update content may include: changing coding information, logging off an API gateway, taking a certain service off line, changing gateway service information of a certain service and the like.
After receiving the update information, the metadata server can search in the node metadata tree according to the coding information carried in the update information, and takes the searched node as a node to be updated. Then, performing corresponding update operation on the node to be updated according to the update content, for example, if the update content is change encoding information, the update operation may be to change the encoding information of the node to be updated to the latest encoding information carried in the update content; if the update content is that the API gateway is logged out (for example, the functional departments corresponding to the API gateway merge), the update operation may be to delete the node and the metadata database corresponding to the API gateway; if the updated content is offline for a certain service (for example, the functional department does not provide any service any more), the updating operation may be to delete the gateway service information of the offline service in the metadata database of the node corresponding to the API gateway; if the gateway service information of a service whose update content is changed, the update operation may update the gateway service information of the service to the latest gateway service information carried by the update content in the corresponding metadata database.
After the update operation is performed in the node metadata tree, a node branch corresponding to the update operation may be obtained, where the node branch may include a parent node corresponding to a node of the current API gateway and the latest information of all leaf nodes of the parent node. And then synchronizing the updated node branch to all the API gateways, so that each API gateway replaces the original branch with the updated node branch, thereby ensuring that the data tree stored locally by each API gateway is consistent with the data tree stored by the metadata server. When the updating occurs, the metadata server only synchronously updates the corresponding node branch without updating the whole tree, so that the data updating efficiency can be improved, and the resource consumption is reduced.
In this embodiment, after receiving gateway node information carrying gateway role information and gateway service information reported by an API gateway, a target level where the API gateway is located and corresponding parent node information may be determined in a node metadata tree, and target coding information of the API gateway may be determined, where the target coding information is determined according to coding information of an existing leaf node in the target level of the parent node information. And then determining a target node which takes the target coding information as the node identification in the node metadata tree, and recording the gateway service information in the target node. Therefore, the gateway node information of various discrete API gateways with different standards and without correlation or communication is managed in a unified mode according to the unified standard, a global node metadata tree containing multi-level API gateway nodes is obtained, interconnection and intercommunication of different API gateways are achieved, and a data basis is provided for subsequent cross-level, cross-region and cross-department service cooperative linkage.
In the node metadata tree, there may be k (k >0) gateway nodes in other hierarchies except the hierarchy where the root node is located. The metadata server adds the gateway node information in a corresponding branch according to the gateway node information reported by any gateway node, and the node metadata tree is transversely added with leaf nodes k (k >0) and gateway service information m (such as micro service), so that the tree hierarchy is three-level or four-level, the depth of the tree cannot be infinitely increased, the complexity of the search time in the tree is O (1), and the node search efficiency is improved.
Example two
Fig. 4 is a flowchart of an embodiment of a method for processing gateway data according to a second embodiment of the present application, where the embodiment may be applied to an API gateway, and is applicable to a scenario of page access, where the method may include the following steps:
step 210, receiving a data access request, wherein the data access request comprises a target URL address.
In this step, the API gateway may receive a data access request sent by the service system, for example, the data access request may include a target URL address to be accessed.
Step 220, if the target URL address is determined not to be the URL address corresponding to the API gateway, the target URL address is searched in the node metadata tree stored locally to obtain the coding information of the target API gateway to be accessed.
In this step, when the API gateway determines that the target URL address that the current user needs to access is not the URL address corresponding to the API gateway, the target URL address may be searched in the node metadata tree stored locally, and if the target URL address is found, the node storing the target URL address is used as the node to be accessed, that is, the target API gateway, and the encoding information of the target API gateway is obtained in the node metadata tree.
And step 230, generating a new URL address according to the URL address corresponding to the API gateway and the coding information of the target API gateway.
After the coding information of the target API gateway is obtained, the URL address corresponding to the API gateway may be combined with the coding information to obtain a new URL address. One way of combining the two is to add the coded information directly after the URL address corresponding to the API gateway.
For example, assume that the current API gateway is a provincial node (i.e., the root node in the node metadata tree) with a URL address of "http:// 172.16.0.19: 19081/echo"; the target URL address of the required access is "http:// 172.16.0.19: 19083/echo" (assuming the access address of the A city financial bureau). When the current API gateway finds that the target URL address is not the URL address corresponding to the API gateway, the target URL address is searched in a node metadata tree stored locally, and the target URL address is found under the node of the A city financial bureau, so that the coding information of the A city financial bureau can be obtained, and the coding information is assumed to be 'dgdpgtp/0004/4401'. The target URL address may be modified to be the URL address + the encoding information corresponding to the API gateway, that is, the new URL address is: "http:// 172.16.0.19: 19081/dgdpgtp/0004/4401/echo/".
As another example, assume that the current API gateway is a hall node with a URL address of "http:// 172.16.0.19: 19082/echo" (assuming an access address for a financial hall); the target URL address of the required access is "http:// 172.16.0.19: 19081/echo" (assuming the access address of the province level node). When the current API gateway finds that the target URL address is not the URL address corresponding to the API gateway, the target URL address is searched in a node metadata tree stored locally, and the target URL address is found under the provincial level node, so that provincial level coding information can be obtained, namely 'dgdpgtp'. The target URL address may be modified to be the URL address + the encoding information corresponding to the API gateway, that is, the new URL address is: "http:// 172.16.0.19: 19082/dgdpgtp/echo/".
As another example, assume that the current API gateway is a local level node with a URL address of "http:// 172.16.0.19: 19083/echo" (assume the access address of the A City financial office); the target URL address of the required access is "http:// 172.16.0.19: 19082/echo" (assuming the access address of the finance hall). If the current API gateway finds that the target URL address is not the URL address corresponding to the API gateway, the target URL address is searched in a node metadata tree stored locally, and the target URL address is found under a financial hall node, so that coding information of the financial hall can be obtained, and the coding information is assumed to be 'dgdptp/0004'. The target URL address may be modified to be the URL address + the encoding information corresponding to the API gateway, that is, the new URL address is: "http:// 172.16.0.19: 19083/dgdpgtp/0004/echo/".
And 240, jumping to the webpage corresponding to the new URL address.
Specifically, after the new URL address is obtained, because the new URL address carries the coding information of the target API gateway, the new URL address may be sent to the target API gateway through the routing network, so that the target API gateway responds to the corresponding request, and opens the corresponding page.
In this embodiment, after the API gateway receives the data access request, if it is determined that the target URL address carried in the data access request is not the URL address corresponding to the API gateway, the target URL address may be searched in the node metadata tree stored locally, so as to obtain the coding information of the target API gateway to be accessed. And then, generating a new URL address according to the URL address corresponding to the API gateway and the coding information of the target API gateway, and jumping to a webpage corresponding to the new URL address, so that under the condition that a user does not sense, the cooperative linkage of different API gateways is realized, the interconnection and intercommunication capacity of different gateways is improved, the service sharing efficiency is improved, and the realization of interconnection and intercommunication of different gateways in one network is well supported.
For example, according to the embodiment, in the government affair data processing, an "integrated" API gateway for government affair services is provided, so that the multi-level one-stop API service access experience in provincial and urban areas can be met, the inter-urban area cooperation efficiency is improved, the inter-urban area cooperation application is accelerated, the complexity of logic search time is ensured not to increase along with the increase of the number of network joint points and the number of services, and the efficiency of searching the matching strategy by the gateway node is improved.
EXAMPLE III
Fig. 5 is a block diagram of an embodiment of a gateway data processing apparatus according to a third embodiment of the present application, where the gateway data processing apparatus is applied to a metadata server, and the apparatus may include the following modules:
a gateway information receiving module 310, configured to receive gateway node information reported by an API gateway, where the gateway node information includes gateway role information and gateway service information;
a parent node and target level information determining module 320, configured to determine, according to the gateway role information, a target level where the API gateway is located and corresponding parent node information in a node metadata tree;
a target coding information determination module 330, configured to determine target coding information of the API gateway, where the target coding information is related to the parent node information and the target hierarchy;
a target node determining module 340, configured to determine a target node using the target coding information as a node identifier in a branch where the parent node information is located, and record the gateway service information in the target node.
In one embodiment, the gateway role information includes administrative level information and functional information;
the parent node and target level information determination module 320 is specifically configured to:
determining a target level where the API gateway is located according to the administrative level information;
and determining parent node information corresponding to the API gateway according to the function information.
In one embodiment, the target encoding information determination module 330 may include the following sub-modules:
a gateway role information obtaining submodule, configured to obtain gateway role information corresponding to each existing leaf node according to coding information of the parent node information at the existing leaf node of the target hierarchy;
the leaf node judgment submodule is used for comparing the gateway role information corresponding to each existing leaf node with the gateway role information of the API gateway so as to judge whether the node corresponding to the API gateway exists in the existing leaf nodes or not; if yes, calling a first target coding information determination submodule; if not, calling a second target coding information determination submodule;
the first target coding information determining submodule is used for taking the coding information corresponding to the corresponding node as the target coding information of the API gateway;
and the second target coding information determining submodule is used for generating target coding information of the API gateway based on the coding information of the existing leaf nodes in the target hierarchy and the father node information.
In an embodiment, the second target encoding information determining sub-module is specifically configured to:
determining the recently generated coding information from the coding information of all existing leaf nodes of the target hierarchy;
and determining a next code based on the recently generated code information and a preset code rule, and generating target code information of the API gateway according to the next code and the father node information.
In an embodiment, the gateway node information further includes the target encoding information, and the target encoding information determining module 330 is specifically configured to:
and extracting the target coding information from the gateway node information.
In an embodiment, the target node determining module 340 is specifically configured to:
if the node corresponding to the API gateway exists in the existing leaf nodes, taking the corresponding node as a target node;
and if the node corresponding to the API gateway does not exist in the existing leaf nodes, creating a target node with the target coding information as a node identifier in the branch where the father node information is located.
In one embodiment, the apparatus further comprises the following modules:
and the synchronization module is used for synchronizing the newly generated node metadata tree to the API gateways corresponding to all nodes of the node metadata tree.
In one embodiment, the apparatus further comprises the following modules:
the update information response module is used for responding to the received update information and positioning the node corresponding to the update information in the node metadata tree as a node to be updated;
the node updating module is used for updating the node to be updated according to the updating information;
and the node branch updating synchronization module is used for acquiring the updated node branch and synchronizing the updated node branch to the API gateway corresponding to all the nodes of the node metadata tree.
It should be noted that the gateway data processing apparatus provided in the embodiment of the present application can execute the method for gateway data processing provided in the embodiment of the present application, and has corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 6 is a block diagram of an embodiment of a gateway data processing apparatus according to a fourth embodiment of the present application, where the apparatus is applied to an API gateway, and the apparatus may include the following modules:
an access request receiving module 410, configured to receive a data access request, where the data access request includes a target URL address;
the coding information searching module 420 is configured to search the target URL address in a locally stored node metadata tree to obtain coding information of the target API gateway that needs to be accessed if it is determined that the target URL address is not a URL address corresponding to the API gateway;
a URL address generating module 430, configured to generate a new URL address according to the URL address corresponding to the API gateway and the coding information of the target API gateway;
and the web page skipping module 440 is configured to skip to the web page corresponding to the new URL address.
It should be noted that the gateway data processing apparatus provided in the embodiment of the present application can execute the method for gateway data processing provided in the second embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method.
EXAMPLE five
Fig. 7 is a schematic structural diagram of a computing device according to a fifth embodiment of the present disclosure, where the computing device may include a server device or a client device, and as shown in fig. 7, the computing device includes a processor 510, a memory 520, an input device 530, and an output device 540; the number of processors 510 in the computing device may be one or more, and one processor 510 is taken as an example in fig. 7; the processor 510, memory 520, input device 530, and output device 540 in the computing device may be connected by a bus or other means, such as by a bus in fig. 5.
The memory 520 is a computer-readable storage medium for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the voice processing method in the embodiment of the present application. The processor 510 executes various functional applications of the computing device and data processing by executing software programs, instructions and modules stored in the memory 520, thereby implementing the above-described method.
The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 520 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 520 may further include memory located remotely from processor 510, which may be connected to a computing device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 530 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the computing device. The output device 540 may include a display device such as a display screen.
EXAMPLE six
The sixth embodiment of the present application further provides a storage medium containing computer-executable instructions, which when executed by a processor of a computing device, are configured to perform the method of any one of the first to fourth embodiments.
From the above description of the embodiments, it is obvious for those skilled in the art that the present application can be implemented by software and necessary general hardware, and certainly can be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods described in the embodiments of the present application.
It should be noted that, in the embodiment of the apparatus, the included units and modules are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only used for distinguishing one functional unit from another, and are not used for limiting the protection scope of the application.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present application and the technical principles employed. It will be understood by those skilled in the art that the present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims (13)

1. A method of gateway data processing, the method comprising:
receiving gateway node information reported by an API gateway, wherein the gateway node information comprises gateway role information and gateway service information;
determining a target level where the API gateway is located and corresponding father node information in a node metadata tree according to the gateway role information;
determining target coding information for the API gateway, the target coding information being related to the parent node information and the target hierarchy;
and determining a target node using the target coding information as a node identifier in a branch where the father node information is located, and recording the gateway service information in the target node.
2. The method of claim 1, wherein the gateway role information comprises administrative level information and role information;
determining a target level where the API gateway is located and corresponding parent node information in a node metadata tree according to the gateway role information, wherein the determining comprises:
determining a target level where the API gateway is located according to the administrative level information;
and determining parent node information corresponding to the API gateway according to the function information.
3. The method of claim 1 or 2, wherein the determining target encoding information of the API gateway comprises:
acquiring gateway role information corresponding to each existing leaf node according to the coding information of the father node information on the existing leaf nodes of the target level;
comparing the gateway role information corresponding to each existing leaf node with the gateway role information of the API gateway to judge whether the node corresponding to the API gateway exists in the existing leaf nodes or not;
if so, taking the coding information corresponding to the corresponding node as the target coding information of the API gateway;
and if not, generating target coding information of the API gateway based on the coding information of the existing leaf nodes in the target level and the father node information.
4. The method of claim 3, wherein generating the target coding information of the API gateway based on the coding information of the existing leaf nodes in the target hierarchy and the parent node information comprises:
determining the recently generated coding information from the coding information of all existing leaf nodes of the target hierarchy;
and determining a next code based on the recently generated code information and a preset code rule, and generating target code information of the API gateway according to the next code and the father node information.
5. The method of claim 1 or 2, wherein the gateway node information further comprises the target code information, and wherein the determining the target code information of the API gateway comprises:
and extracting the target coding information from the gateway node information.
6. The method of claim 3, wherein the determining a target node identified by the target coding information as a node in the branch where the parent node information is located, and recording the gateway service information in the target node comprises:
if the node corresponding to the API gateway exists in the existing leaf nodes, taking the corresponding node as a target node;
and if the node corresponding to the API gateway does not exist in the existing leaf nodes, creating a target node with the target coding information as a node identifier in the branch where the father node information is located.
7. The method of claim 1, wherein after said recording the gateway service information, the method further comprises:
and synchronizing the newly generated node metadata tree to the API gateways corresponding to all nodes of the node metadata tree.
8. The method of claim 1 or 7, wherein after said recording the gateway service information, the method further comprises:
responding to the received update information, and positioning a node corresponding to the update information in the node metadata tree as a node to be updated;
updating the node to be updated according to the updating information;
and acquiring the updated node branch, and synchronizing the updated node branch to the API gateways corresponding to all nodes of the node metadata tree.
9. A method of gateway data processing, the method comprising:
receiving a data access request, wherein the data access request comprises a target URL address;
if the target URL address is judged not to be the URL address corresponding to the API gateway, searching the target URL address in a node metadata tree stored locally to obtain the coding information of the target API gateway required to be accessed;
generating a new URL address according to the URL address corresponding to the API gateway and the coding information of the target API gateway;
and jumping to the webpage corresponding to the new URL address.
10. An apparatus for gateway data processing, the apparatus comprising:
the gateway information receiving module is used for receiving gateway node information reported by the API gateway, wherein the gateway node information comprises gateway role information and gateway service information;
a father node and target level information determining module, configured to determine, according to the gateway role information, a target level where the API gateway is located and corresponding father node information in a node metadata tree;
a target coding information determination module for determining target coding information of the API gateway, the target coding information being related to the parent node information and the target hierarchy;
and the target node determining module is used for determining a target node which takes the target coding information as a node identifier in a branch where the father node information is located, and recording the gateway service information in the target node.
11. An apparatus for gateway data processing, the apparatus comprising:
an access request receiving module, configured to receive a data access request, where the data access request includes a target URL address;
the coding information searching module is used for searching the target URL address in a locally stored node metadata tree to obtain the coding information of the target API gateway required to be accessed if the target URL address is judged not to be the URL address corresponding to the API gateway;
the URL address generating module is used for generating a new URL address according to the URL address corresponding to the API gateway and the coding information of the target API gateway;
and the webpage skipping module is used for skipping to the webpage corresponding to the new URL address.
12. A computing device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1-9 when executing the program.
13. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-9.
CN202110771411.0A 2021-07-08 2021-07-08 Gateway data processing method and device Active CN113438317B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110771411.0A CN113438317B (en) 2021-07-08 2021-07-08 Gateway data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110771411.0A CN113438317B (en) 2021-07-08 2021-07-08 Gateway data processing method and device

Publications (2)

Publication Number Publication Date
CN113438317A true CN113438317A (en) 2021-09-24
CN113438317B CN113438317B (en) 2022-08-05

Family

ID=77759702

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110771411.0A Active CN113438317B (en) 2021-07-08 2021-07-08 Gateway data processing method and device

Country Status (1)

Country Link
CN (1) CN113438317B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338502A (en) * 2021-12-28 2022-04-12 数字广东网络建设有限公司 Gateway data processing method, device, equipment and storage medium
CN115134398A (en) * 2022-08-30 2022-09-30 国网信息通信产业集团有限公司 Method and system for realizing universal RPC gateway
CN114338502B (en) * 2021-12-28 2024-07-05 数字广东网络建设有限公司 Gateway data processing method, device, equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106599280A (en) * 2016-12-23 2017-04-26 北京奇虎科技有限公司 Webpage node path information determination method and apparatus
CN109522707A (en) * 2018-10-30 2019-03-26 珠海伟诚科技股份有限公司 A kind of the user data read-write security permission control method and system of based role and resource
EP3496367A1 (en) * 2016-08-04 2019-06-12 ZTE Corporation Method and apparatus for determining cooperating node
CN110347401A (en) * 2019-06-18 2019-10-18 西安交通大学 A kind of API Framework service discovery method based on semantic similarity
CN110505096A (en) * 2019-08-27 2019-11-26 西安闻泰电子科技有限公司 Internet of things equipment management method, device, equipment and medium
CN111274242A (en) * 2020-01-07 2020-06-12 南京天溯自动化控制***有限公司 Data searching method and device of tree structure for hospital logistics operation and maintenance
CN112351015A (en) * 2020-10-28 2021-02-09 广州助蜂网络科技有限公司 Gateway control method based on API
CN112925957A (en) * 2021-05-12 2021-06-08 北京明略昭辉科技有限公司 Method, device, equipment and medium for determining position of father node in graph

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3496367A1 (en) * 2016-08-04 2019-06-12 ZTE Corporation Method and apparatus for determining cooperating node
CN106599280A (en) * 2016-12-23 2017-04-26 北京奇虎科技有限公司 Webpage node path information determination method and apparatus
CN109522707A (en) * 2018-10-30 2019-03-26 珠海伟诚科技股份有限公司 A kind of the user data read-write security permission control method and system of based role and resource
CN110347401A (en) * 2019-06-18 2019-10-18 西安交通大学 A kind of API Framework service discovery method based on semantic similarity
CN110505096A (en) * 2019-08-27 2019-11-26 西安闻泰电子科技有限公司 Internet of things equipment management method, device, equipment and medium
CN111274242A (en) * 2020-01-07 2020-06-12 南京天溯自动化控制***有限公司 Data searching method and device of tree structure for hospital logistics operation and maintenance
CN112351015A (en) * 2020-10-28 2021-02-09 广州助蜂网络科技有限公司 Gateway control method based on API
CN112925957A (en) * 2021-05-12 2021-06-08 北京明略昭辉科技有限公司 Method, device, equipment and medium for determining position of father node in graph

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338502A (en) * 2021-12-28 2022-04-12 数字广东网络建设有限公司 Gateway data processing method, device, equipment and storage medium
CN114338502B (en) * 2021-12-28 2024-07-05 数字广东网络建设有限公司 Gateway data processing method, device, equipment and storage medium
CN115134398A (en) * 2022-08-30 2022-09-30 国网信息通信产业集团有限公司 Method and system for realizing universal RPC gateway

Also Published As

Publication number Publication date
CN113438317B (en) 2022-08-05

Similar Documents

Publication Publication Date Title
AU2015401229B2 (en) Website access method, apparatus, and website system
CN107623729B (en) Caching method, caching equipment and caching service system
CN103942281B (en) The method and device that a kind of object to persistent storage is operated
CN104539681B (en) The processing method of distributed GIS acceleration systems and GIS service
US7895176B2 (en) Entry group tags
US20110307455A1 (en) Contact information merger and duplicate resolution
CN109194711B (en) Synchronization method, client, server and medium for organization architecture
CN111736775A (en) Multi-source storage method, device, computer system and storage medium
CN104412266A (en) Method and apparatus for multidimensional data storage and file system with a dynamic ordered tree structure
CN109213792A (en) Method, server-side, client, device and the readable storage medium storing program for executing of data processing
CN101997901B (en) P2P file transfer management method and system
US8015195B2 (en) Modifying entry names in directory server
CN102769640A (en) Method, server and system for user information updating
CN113438317B (en) Gateway data processing method and device
CN113342746A (en) File management system, file management method, electronic device, and storage medium
CN102945239B (en) The search of location-based clearing house
CN112241474B (en) Information processing method, apparatus and storage medium
CN106850747A (en) A kind of transcoding node administration system and method for distributed real-time transcoding system
US9529855B2 (en) Systems and methods for point of interest data ingestion
CN112765169A (en) Data processing method, device, equipment and storage medium
CN110445859A (en) The processing method of distributed GIS acceleration system and GIS service
CN115686497A (en) Business development data management method, development engine, electronic device, and storage medium
CN115617781A (en) Digital object creating and data management method and device
CN110099117B (en) Method and device for issuing full amount of multi-version DNS zone files
CN113076204A (en) Calling method and device for multi-time zone service

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
GR01 Patent grant
GR01 Patent grant