CN113381928A - Gateway request chain management method and device, electronic equipment and computer medium - Google Patents

Gateway request chain management method and device, electronic equipment and computer medium Download PDF

Info

Publication number
CN113381928A
CN113381928A CN202110638793.XA CN202110638793A CN113381928A CN 113381928 A CN113381928 A CN 113381928A CN 202110638793 A CN202110638793 A CN 202110638793A CN 113381928 A CN113381928 A CN 113381928A
Authority
CN
China
Prior art keywords
routing
filter
request
gateway
packet
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
CN202110638793.XA
Other languages
Chinese (zh)
Other versions
CN113381928B (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202110638793.XA priority Critical patent/CN113381928B/en
Publication of CN113381928A publication Critical patent/CN113381928A/en
Application granted granted Critical
Publication of CN113381928B publication Critical patent/CN113381928B/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
    • 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
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Abstract

The disclosure relates to a management method and device of a gateway request chain, electronic equipment and a computer readable medium, and belongs to the technical field of computers. The method comprises the following steps: responding to an external request entering a gateway, and determining a routing path corresponding to the external request; obtaining a routing rule corresponding to the external request according to the routing path, wherein the routing rule comprises a routing packet identifier of the external request; traversing each filter in a gateway request chain, and acquiring a routing packet set corresponding to each filter; and executing the service processing logic in the filter when the routing packet set corresponding to the filter contains the routing packet identification of the external request. The method and the device can reduce the logic complexity of the management control in the request chain of the gateway and enhance the flexibility of the gateway system by using a grouping mechanism to process the corresponding relation between the external request and the gateway filter.

Description

Gateway request chain management method and device, electronic equipment and computer medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for managing a gateway request chain, an electronic device, and a computer-readable medium.
Background
Modern internet projects are developed greatly, and often, a plurality of sub-application systems and a main application system are involved to cooperate to serve the whole project, but in order to achieve a unified entry for the outside in one project, a plurality of sub-systems are co-established, and a gateway is usually introduced as a unified entry for a user to access all systems.
When more subsystems are accessed by one application, the request chain in the gateway is longer, and if the request chain is maintained only by the internal controllers of the filters in the request chain, the logic complexity of management control is higher, which is not beneficial to improving the flexibility of the system.
In view of this, there is a need in the art for a method for managing a gateway request chain, which can reduce the logic complexity of the management control of the gateway request chain and improve the flexibility of the system.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a method for managing a gateway request chain, a device for managing a gateway request chain, an electronic device, and a computer-readable medium, so as to reduce the logic complexity of management control of the gateway request chain at least to a certain extent and improve the flexibility of the system.
According to a first aspect of the present disclosure, there is provided a method for managing a gateway request chain, including:
responding to an external request entering a gateway, and determining a routing path corresponding to the external request;
obtaining a routing rule corresponding to the external request according to the routing path, wherein the routing rule comprises a routing packet identifier of the external request;
traversing each filter in a gateway request chain, and acquiring a routing packet set corresponding to each filter;
and executing the service processing logic in the filter when the routing packet set corresponding to the filter contains the routing packet identification of the external request.
In an exemplary embodiment of the present disclosure, the method further comprises:
and when the filter does not bind the corresponding routing packet set, directly executing the service processing logic in the filter.
In an exemplary embodiment of the present disclosure, the method further comprises:
and executing service processing logic in all the filters when the routing packet identifier in the routing rule corresponding to the external request is empty.
In an exemplary embodiment of the present disclosure, the obtaining, according to the routing path, a routing rule corresponding to the external request includes:
acquiring a pre-configured routing rule table, and determining a routing name in the routing rule table according to the routing path;
and acquiring a routing rule corresponding to the external request from the routing rule table according to the routing name.
In an exemplary embodiment of the present disclosure, the method further comprises:
dividing the routing grouping identification in the routing rule table into a plurality of service grouping identifications and public grouping identifications;
and putting the filters containing the same service grouping identification in the routing grouping set into the same service grouping set, and putting the filters containing the same public grouping identification in the routing grouping set into the same public grouping set.
In an exemplary embodiment of the present disclosure, the method further comprises:
processing, by a packet router, a correspondence between a set of routing packets for the filter and a routing packet identification for the external request before each filtering request enters a respective one of the filters.
In an exemplary embodiment of the present disclosure, the processing, by the packet router, a correspondence between the set of routing packets of the filter and the routing packet identifier of the external request includes:
intercepting all the filtering requests under the filter base class by a section-oriented programming technology before the filtering requests enter each filter;
and forwarding the filtering request to the packet router, and processing the corresponding relation between the routing packet set of the filter and the routing packet identification of the external request through the packet router.
According to a second aspect of the present disclosure, there is provided a management apparatus of a gateway request chain, including:
the routing path determining module is used for responding to an external request entering a gateway and determining a routing path corresponding to the external request;
a routing rule determining module, configured to obtain a routing rule corresponding to the external request according to the routing path, where the routing rule includes a routing packet identifier of the external request;
the routing packet acquisition module is used for traversing each filter in a gateway request chain and acquiring a routing packet set corresponding to each filter;
and the routing identifier matching module is used for executing the service processing logic in the filter when the routing packet set corresponding to the filter contains the routing packet identifier of the external request.
According to a third aspect of the present disclosure, there is provided an electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method for managing a gateway request chain of any one of the above via execution of the executable instructions.
According to a fourth aspect of the present disclosure, there is provided a computer readable medium, on which a computer program is stored, which computer program, when executed by a processor, implements the method of managing a gateway request chain as set forth in any one of the above.
The exemplary embodiments of the present disclosure may have the following advantageous effects:
in the method for managing a gateway request chain according to the exemplary embodiment of the present disclosure, by determining a routing packet identifier corresponding to an external request and acquiring a routing packet set corresponding to each filter, when the routing packet set corresponding to the filter includes the routing packet identifier of the external request, a service processing logic in the filter is executed. In the management method of the gateway request chain in the exemplary embodiment of the disclosure, the corresponding relationship between the external request and the gateway filter is processed by using the grouping mechanism, and it is not necessary to wait until the request enters each filter, and then perform logic judgment by the internal controller of each filter to determine whether the request passes through the filter and execute the service processing logic in the filter, so that the logic complexity of the internal management control of the gateway request chain can be reduced, and the flexibility of the gateway system can be enhanced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
Fig. 1 schematically illustrates a gateway for route forwarding according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram illustrating a request chain after an external request enters a gateway according to one embodiment of the present disclosure;
fig. 3 shows a flow diagram of a method of managing a gateway request chain of an example embodiment of the present disclosure;
FIG. 4 is a schematic diagram illustrating the partitioning of routing packet identifiers in a routing rule table according to one embodiment of the present disclosure;
FIG. 5 illustrates a flow diagram of a method for managing a gateway request chain in accordance with one embodiment of the present disclosure;
FIG. 6 is a schematic flow chart diagram illustrating the processing of routing packet identification by a packet router in accordance with one embodiment of the present disclosure;
fig. 7 shows a block diagram of a management apparatus of a gateway request chain of an example embodiment of the present disclosure;
FIG. 8 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Zuul is an Application Programming Interface (API) gateway that can provide edge services such as dynamic routing, monitoring, authorization, security, scheduling, and one of its core functions is routing forwarding. The route forwarding means that when each request enters the gateway, the request is matched with a corresponding route first, and then forwarding is performed according to a route rule.
Fig. 1 schematically illustrates a schematic diagram of routing forwarding performed by a gateway according to a specific embodiment of the present disclosure, and after a Request (external Request) enters the gateway, a gateway locator matches a corresponding routing path according to a preconfigured routing forwarding rule table, and then obtains a corresponding subsystem address in the routing rule table according to the routing path, and forwards the corresponding subsystem address to each subsystem.
Another core function of Zuuul is the Filter chain, Filter, which is used to perform some logical processing on requests and does not itself block requests from entering the system. The main purpose of Filter is to perform customized service logic filtering processing on different stages of a Request life cycle, which is divided into three types, namely Pre (Pre-Filter), Routing (Routing Filter) and Post (Post-Filter). After the Request acquires the corresponding Routing forwarding rule, all filters in the two types of Pre and Routing are sequentially traversed, the filters are forwarded to the corresponding subsystem after being traversed, all filters in the Post type are continuously traversed after being returned from the subsystem, wherein each type of Filter is provided with an internal controller for controlling whether the Request executes the service processing logic corresponding to the Filter. When the traversal is finished, the gateway completes the request forwarding. Fig. 2 is a schematic diagram illustrating a Request chain after an external Request enters a gateway according to an embodiment of the present disclosure, and a lifecycle of a Request after the Request enters the gateway is shown in fig. 2.
However, when the Zuul gateway accesses multiple subsystems, the following obvious disadvantages exist: when more subsystems are accessed by an application, the Filter chain as shown in fig. 2 is longer, but not all requests need to pass through all the Filter chains.
In some related embodiments, each Filter in the Zuul gateway may be dedicated to maintain and control whether a Request goes to the Filter through an internal controller, and as the number of requests increases, because there is no unified place to manage the relationship between the Request and the Filter, the maintenance through the internal controller alone may result in that when a new Request comes in, the internal controllers of all filters in the Zuul need to perform a logic update to determine whether the new Request executes the Filter, and the maintenance cost may gradually increase, which is not favorable for improving the flexibility and extensibility of the system.
In view of the above problems that may occur when accessing multiple subsystems using Zuul as a gateway, the present exemplary embodiment first provides a method for managing a request chain of a gateway. Referring to fig. 3, the method for managing a gateway request chain may include the following steps:
step S310, responding to an external request entering a gateway, and determining a routing path corresponding to the external request.
Step S320, obtaining a routing rule corresponding to the external request according to the routing path, wherein the routing rule comprises a routing group identifier of the external request.
And S330, traversing each filter in the gateway request chain, and acquiring a routing packet set corresponding to each filter.
Step s340, when the route packet set corresponding to the filter includes the route packet identifier of the external request, executing the service processing logic in the filter.
In the method for managing a gateway request chain according to the exemplary embodiment of the present disclosure, by determining a routing packet identifier corresponding to an external request and acquiring a routing packet set corresponding to each filter, when the routing packet set corresponding to the filter includes the routing packet identifier of the external request, a service processing logic in the filter is executed. In the management method of the gateway request chain in the exemplary embodiment of the disclosure, the corresponding relationship between the external request and the gateway filter is processed by using the grouping mechanism, and it is not necessary to wait until the request enters each filter, and then perform logic judgment by the internal controller of each filter to determine whether the request passes through the filter and execute the service processing logic in the filter, so that the logic complexity of the internal management control of the gateway request chain can be reduced, and the flexibility of the gateway system can be enhanced.
Next, the above steps of the present exemplary embodiment will be described in more detail with reference to fig. 4 to 6.
In step S310, in response to the external request entering the gateway, a routing path corresponding to the external request is determined.
When an external Request enters a gateway, a routing path corresponding to the external Request needs to be acquired first. The routing path corresponding to the external request can be obtained through the routing path provided by the front-end personnel.
In step S320, a routing rule corresponding to the external request is obtained according to the routing path, where the routing rule includes a routing packet identifier of the external request.
In this exemplary embodiment, when the gateway is started, a corresponding routing packet identifier may be configured for each route in the routing rule table, so as to establish a mapping mechanism between the external request and the routing packet, so that when the external request enters the gateway and is matched to a corresponding routing path, the gateway locator loads the routing rule including routing packet information according to the routing path, and thus, a one-to-one correspondence relationship is established between each external request and the routing packet.
In this exemplary embodiment, when obtaining the routing rule corresponding to the external request according to the routing path, the routing rule table configured in advance may be obtained first, the routing name in the routing rule table is determined according to the routing path, and then the routing rule corresponding to the external request is obtained from the routing rule table according to the routing name.
The mapping mechanism between external requests and routed packets may be implemented by means of a locator in the Zuul framework. After the external request is matched with the corresponding routing path, the locator acquires a pre-configured routing rule table according to the routing path, and an attribute value, namely a routing packet identifier, is added in the routing rule table, so that the external request carries corresponding routing packet information while loading the routing rule.
In step S330, each filter in the gateway request chain is traversed, and a routing packet set corresponding to each filter is obtained.
In this exemplary embodiment, for each filter in the gateway request chain, each filter may be bound to an associated routing packet identifier in advance, and the routing packet identifier associated with each filter is placed in the routing packet set corresponding to the filter, so as to establish a mapping mechanism between the routing packet and the filter.
In step S340, when the routing packet set corresponding to the filter includes the routing packet identifier of the external request, the service processing logic in the filter is executed.
In this example embodiment, before each filtering request enters a respective filter, the correspondence between the set of routing packets of the filter and the routing packet identification of the external request may be processed by the packet router. The present exemplary embodiment provides a concept of a packet router, and a packet router is added on an existing Zuul architecture, and is used for performing a routing processing operation before each filtering request enters each filter, so as to implement a logic that an external request only traverses a part of the filters.
In this exemplary embodiment, when an external request enters a gateway, a corresponding routing packet identifier is obtained according to a routing rule table, and then a packet router performs matching processing on the routing packet identifier and a routing packet set corresponding to each filter, and only when a routing packet set bound to a filter includes a corresponding routing packet identifier, service processing logic in the filter is executed, otherwise, the filter is removed from a request chain.
In addition to the above, the routing packet processing logic in the present exemplary embodiment may also have the following two cases:
and when the filter does not bind the corresponding routing packet set, directly executing the service processing logic in the filter. And executing the service processing logic in all the filters when the routing grouping mark in the routing rule corresponding to the external request is empty.
When the corresponding routing packet set is not bound on the filter, the service processing logic in the filter is directly executed, which may occur when a mapping mechanism of the routing packet and the filter is established, so as to be compatible with the built-in filter of Zuul and the existing filter which is temporarily configured with routing packet information.
When the routing packet identifier on the routing rule table corresponding to the external request is empty, the service processing logic in the filter is directly executed, and this may happen when a mapping mechanism of the external request and the routing packet is established, so as to be compatible with built-in routing of Zuul and existing routing rules which are not provided with routing packet information temporarily.
In the present exemplary embodiment, by providing a concept of routing packets, establishing a mapping mechanism between an external request and a routing packet, and establishing a mapping mechanism between a routing packet and a filter, a one-to-many relationship between an external request and a part of related filters can be established, so that an external request can be managed to flow only to the related part of filters without entering all filters to perform internal logic judgment, and the complexity of maintaining the relationship by using an internal controller of a single filter is reduced.
In this exemplary embodiment, if the Java technology is taken as an example, before the filtering request enters each filter, all filtering requests in the filter base class may be intercepted by using a facet-oriented programming technology, and then the filtering request is forwarded to the packet router, and the packet router processes the correspondence between the routing packet set of the filter and the routing packet identifier of the external request.
Specifically, in the Zuul gateway routing configuration file, the corresponding routing packet identifier is configured in the routing rule of each route, and when the gateway starts to load the routing rule table into the memory, the routing rule can load the corresponding routing packet identifier into the memory together. When the external request enters the system and is matched with the corresponding routing rule, the relationship between the external request and the routing packet can be established at the same time. Then, by means of Java annotation (a specific semantic expression marked on the method header or the class header by a specific identifier), configuring the relevant routing packet annotation identifier at the head of each filter chain in advance, and then setting the profile as the base class of the filter by using the AOP (Aspect organized Programming) profile technology of Java, all filtering requests under the base class of the filter can be intercepted and enter the packet router for the logical processing of routing packet information.
In addition, in actual service, the management method of the gateway request chain in the present exemplary embodiment can also achieve the purpose of filter abstraction multiplexing, and the specific method is as follows: dividing the route grouping mark in the route rule table into a plurality of service grouping marks and public grouping marks, then putting the filter containing the same service grouping mark in the route grouping set into the same service grouping set, and putting the filter containing the same public grouping mark in the route grouping set into the same public grouping set.
In the actual service, the routing grouping identification in the routing rule table can be divided into two types, one type is service grouping, and the purpose is to divide the grouping identification which is strongly related to each service together; the second is common grouping, and many service requests have some same service logics which are processed by a series of same filters together, so that the filters of the types can be abstracted and put into the common grouping to achieve the aim of abstract multiplexing. Thus, after applying the gateway request chain management method in this exemplary embodiment, the actually obtained request chain is as shown in fig. 4, and each service packet and common packet includes one or more related reusable filters.
By abstracting the filter with the common service logic into the common packet, not only can the multiplexing of the filters among different subsystems be realized, and the purpose of requesting chain packet isolation is achieved by using a routing packet mechanism, but also the isolation with the filter existing before can be realized by introducing a new filter into a new subsystem to divide a new packet, and the expandability of a gateway system is enhanced.
Fig. 5 is a complete flowchart of a method for managing a gateway request chain according to an embodiment of the present disclosure, which is an illustration of the above steps in this exemplary embodiment. The specific steps of the flow chart are as follows:
step s510, configuring a corresponding group identifier for each route in the routing rule table.
Firstly, when the gateway is started, a corresponding routing grouping identifier is configured for each route in a routing rule table.
Step S520, establishing a mapping mechanism of the external request and the routing grouping identification.
And establishing a mapping mechanism of the external request and the routing packet identifier, and mapping the corresponding relation between the external request and the routing packet identifier by using a locator. When the external request enters the gateway and is matched with the corresponding routing path, the gateway locator loads the routing rule containing routing packet information according to the routing path, and therefore, a one-to-one corresponding relation is established between each external request and the routing packet.
Step S530, establishing a mapping mechanism of the routing grouping identification and the filter.
Establishing a mapping mechanism of the routing packet identifier and the filter, firstly binding the associated routing packet identifier to the related filter, and then processing the corresponding relation between the routing packet identifier and the filter by using the packet router. When an external request enters a gateway, the corresponding routing packet identifier is obtained according to a routing rule table, then the routing packet identifier and the routing packet set corresponding to each filter are matched through a packet router, only when the routing packet set bound on the filter contains the corresponding routing packet identifier, the service processing logic in the filter is executed, otherwise, the filter is removed from a request chain. Thus, a one-to-many relationship is established between the external request and the partially related filters, and the external request can be managed to flow to the related partially related filters only without entering all the filters to judge the internal logic.
In summary, through the two mapping mechanisms, a one-to-many relationship can be established between the external request and the partially related filters, so that the external request is controlled to flow only to the related partial filters, and the complexity of maintaining the relationship by using a single internal controller of the filter is reduced.
Fig. 6 shows a complete flowchart of processing a routing packet identifier by a packet router in an embodiment of the present disclosure, where the specific steps of the flowchart are as follows:
and S610, traversing all the filters.
When an external request enters the gateway, all filters in the gateway request chain are first traversed and the logical processing of the routed packets is performed by the packet router.
And S620, judging whether the filter binds the corresponding routing packet set.
If the filter binds the corresponding routing packet set, go to step S630; if the filter does not bind the corresponding routing packet set, the process proceeds to step S670, and the service processing logic in the filter is directly executed.
Step S630, judging whether the route grouping set is empty.
If the route packet set bound by the filter is empty, step S670 is entered, and the service processing logic in the filter is directly executed; otherwise, the process proceeds to step S640.
And step S640, determining the routing grouping identifier under the routing rule corresponding to the external request.
Step S650, judging whether the value of the route grouping identification is null.
If the route packet identifier corresponding to the external request is empty, step S670 is entered, and the service processing logic in the filter is directly executed; otherwise, the process proceeds to step S660.
And S660, judging whether the routing packet set contains a routing packet identifier.
If the routing packet set bound by the filter contains the routing packet identifier corresponding to the external request, step S670 is performed to directly execute the service processing logic in the filter; otherwise, go to step S680, remove the filter from the gateway request chain.
And S670, executing a filter.
And S680, removing the filter.
It should be noted that although the various steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that these steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Further, the present disclosure also provides a management apparatus for a gateway request chain. Referring to fig. 7, the management device of the gateway request chain may include a module 710, a module 720, and a module 730. Wherein:
the routing path determining module 710 may be configured to determine, in response to an external request entering a gateway, a routing path corresponding to the external request;
the routing rule determining module 720 may be configured to obtain a routing rule corresponding to the external request according to the routing path, where the routing rule includes a routing packet identifier of the external request;
the routing packet obtaining module 730 may be configured to traverse each filter in the gateway request chain and obtain a routing packet set corresponding to each filter;
the routing identifier matching module 740 may be configured to execute the service processing logic in the filter when the routing packet set corresponding to the filter includes the routing packet identifier of the external request.
In some exemplary embodiments of the present disclosure, a management apparatus of a gateway request chain provided by the present disclosure may further include a first logic processing module, which may be configured to directly execute a service processing logic in a filter when the filter does not bind a corresponding routing packet set.
In some exemplary embodiments of the present disclosure, the management apparatus of a gateway request chain provided in the present disclosure may further include a second logic processing module, which may be configured to execute the service processing logic in all filters when the routing packet in the routing rule corresponding to the external request is identified as empty.
In some exemplary embodiments of the present disclosure, the routing rule determining module 720 may include a routing name determining unit and a routing rule obtaining unit. Wherein:
the route name determining unit may be configured to obtain a preconfigured route rule table, and determine a route name in the route rule table according to the route path;
the routing rule obtaining unit may be configured to obtain a routing rule corresponding to the external request from the routing rule table according to the routing name.
In some exemplary embodiments of the present disclosure, a management apparatus of a gateway request chain provided by the present disclosure may further include an identification type dividing module, which may include a packet identification dividing unit and a filter packet unit. Wherein:
the packet identifier dividing unit may be configured to divide the routing packet identifier in the routing rule table into a plurality of service packet identifiers and a public packet identifier;
the filter grouping unit may be configured to put filters that include the same service packet identifier in the routing packet set into the same service packet set, and put filters that include the same common packet identifier in the routing packet set into the same common packet set.
In some exemplary embodiments of the present disclosure, a management apparatus of a gateway request chain provided by the present disclosure may further include a packet router processing module, which may be configured to process, by the packet router, a correspondence between a set of routing packets of the filter and a routing packet identifier of the external request before each filtering request enters the respective filter.
In some exemplary embodiments of the present disclosure, the packet router processing module may include a filtering request intercepting unit and a filtering request forwarding unit. Wherein:
the filtering request intercepting unit can be used for intercepting all filtering requests under the filter base class through a section-oriented programming technology before the filtering requests enter each filter;
the filtering request forwarding unit may be configured to forward the filtering request to the packet router, and process a correspondence between the routing packet set of the filter and the routing packet identifier of the external request through the packet router.
The details of each module/unit in the management apparatus of the gateway request chain have been described in detail in the corresponding method embodiment section, and are not described herein again.
FIG. 8 illustrates a schematic structural diagram of a computer system suitable for use with the electronic device to implement an embodiment of the invention.
It should be noted that the computer system 800 of the electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiment of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for system operation are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to an embodiment of the present invention, the processes described below with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the invention include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. When the computer program is executed by the Central Processing Unit (CPU)801, various functions defined in the system of the present application are executed.
It should be noted that the computer readable media shown in the present disclosure may be computer readable signal media or computer readable storage media or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer-readable signal medium may include a propagated data signal with computer-readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method as described in the embodiments below.
It should be noted that although in the above detailed description several modules of the device for action execution are mentioned, this division is not mandatory. Indeed, the features and functionality of two or more of the modules described above may be embodied in one module, in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module described above may be further divided into embodiments by a plurality of modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method for managing a gateway request chain, comprising:
responding to an external request entering a gateway, and determining a routing path corresponding to the external request;
obtaining a routing rule corresponding to the external request according to the routing path, wherein the routing rule comprises a routing packet identifier of the external request;
traversing each filter in a gateway request chain, and acquiring a routing packet set corresponding to each filter;
and executing the service processing logic in the filter when the routing packet set corresponding to the filter contains the routing packet identification of the external request.
2. The method for managing a gateway request chain according to claim 1, further comprising:
and when the filter does not bind the corresponding routing packet set, directly executing the service processing logic in the filter.
3. The method for managing a gateway request chain according to claim 1, further comprising:
and executing service processing logic in all the filters when the routing packet identifier in the routing rule corresponding to the external request is empty.
4. The method for managing a gateway request chain according to claim 1, wherein the obtaining a routing rule corresponding to the external request according to the routing path includes:
acquiring a pre-configured routing rule table, and determining a routing name in the routing rule table according to the routing path;
and acquiring a routing rule corresponding to the external request from the routing rule table according to the routing name.
5. The method for managing a gateway request chain according to claim 1, further comprising:
dividing the routing grouping identification in the routing rule table into a plurality of service grouping identifications and public grouping identifications;
and putting the filters containing the same service grouping identification in the routing grouping set into the same service grouping set, and putting the filters containing the same public grouping identification in the routing grouping set into the same public grouping set.
6. The method for managing a gateway request chain according to claim 1, further comprising:
processing, by a packet router, a correspondence between a set of routing packets for the filter and a routing packet identification for the external request before each filtering request enters a respective one of the filters.
7. The method for managing a gateway request chain according to claim 6, wherein said processing, by a packet router, a correspondence between the set of routing packets of the filter and the routing packet identifier of the external request comprises:
intercepting all the filtering requests under the filter base class by a section-oriented programming technology before the filtering requests enter each filter;
and forwarding the filtering request to the packet router, and processing the corresponding relation between the routing packet set of the filter and the routing packet identification of the external request through the packet router.
8. An apparatus for managing a gateway request chain, comprising:
the routing path determining module is used for responding to an external request entering a gateway and determining a routing path corresponding to the external request;
a routing rule determining module, configured to obtain a routing rule corresponding to the external request according to the routing path, where the routing rule includes a routing packet identifier of the external request;
the routing packet acquisition module is used for traversing each filter in a gateway request chain and acquiring a routing packet set corresponding to each filter;
and the routing identifier matching module is used for executing the service processing logic in the filter when the routing packet set corresponding to the filter contains the routing packet identifier of the external request.
9. An electronic device, comprising:
a processor; and
memory for storing one or more programs which, when executed by the processor, cause the processor to implement the method of managing a gateway request chain according to any one of claims 1 to 7.
10. A computer-readable medium, on which a computer program is stored, which program, when being executed by a processor, carries out a method of managing a gateway request chain according to any one of claims 1 to 7.
CN202110638793.XA 2021-06-08 2021-06-08 Gateway request chain management method and device, electronic equipment and computer medium Active CN113381928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110638793.XA CN113381928B (en) 2021-06-08 2021-06-08 Gateway request chain management method and device, electronic equipment and computer medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110638793.XA CN113381928B (en) 2021-06-08 2021-06-08 Gateway request chain management method and device, electronic equipment and computer medium

Publications (2)

Publication Number Publication Date
CN113381928A true CN113381928A (en) 2021-09-10
CN113381928B CN113381928B (en) 2022-11-08

Family

ID=77572750

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110638793.XA Active CN113381928B (en) 2021-06-08 2021-06-08 Gateway request chain management method and device, electronic equipment and computer medium

Country Status (1)

Country Link
CN (1) CN113381928B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277289A (en) * 2022-06-27 2022-11-01 重庆长安汽车股份有限公司 Automobile bus message data routing system, method and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7769873B1 (en) * 2002-10-25 2010-08-03 Juniper Networks, Inc. Dynamically inserting filters into forwarding paths of a network device
CN109597854A (en) * 2018-10-31 2019-04-09 深圳壹账通智能科技有限公司 A kind of method for routing of service request, device, computer equipment and computer storage medium
CN111901238A (en) * 2020-07-09 2020-11-06 中移(杭州)信息技术有限公司 Dynamic routing service method, device, electronic equipment and storage medium
CN112565469A (en) * 2021-02-23 2021-03-26 常州微亿智造科技有限公司 Method for realizing dynamic gray strategy for micro-service and micro-service system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7769873B1 (en) * 2002-10-25 2010-08-03 Juniper Networks, Inc. Dynamically inserting filters into forwarding paths of a network device
CN109597854A (en) * 2018-10-31 2019-04-09 深圳壹账通智能科技有限公司 A kind of method for routing of service request, device, computer equipment and computer storage medium
CN111901238A (en) * 2020-07-09 2020-11-06 中移(杭州)信息技术有限公司 Dynamic routing service method, device, electronic equipment and storage medium
CN112565469A (en) * 2021-02-23 2021-03-26 常州微亿智造科技有限公司 Method for realizing dynamic gray strategy for micro-service and micro-service system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277289A (en) * 2022-06-27 2022-11-01 重庆长安汽车股份有限公司 Automobile bus message data routing system, method and readable storage medium

Also Published As

Publication number Publication date
CN113381928B (en) 2022-11-08

Similar Documents

Publication Publication Date Title
CN108537543B (en) Parallel processing method, device, equipment and storage medium for blockchain data
CN106489251B (en) The methods, devices and systems of applied topology relationship discovery
US10310900B2 (en) Operating programs on a computer cluster
CN110650037B (en) Heterogeneous network device configuration method and device
CN113709810B (en) Method, equipment and medium for configuring network service quality
CN113765982A (en) Request response method, device, system, server and storage medium
US20150040144A1 (en) Program, information processing apparatus, and event processing method
CN113381928B (en) Gateway request chain management method and device, electronic equipment and computer medium
CN109412967B (en) System flow control method and device based on token, electronic equipment and storage medium
CN111491012A (en) SaaS multi-tenant data isolation access method and device, electronic equipment and storage medium
CN107133243A (en) A kind of data processing method and server
CN109542590A (en) The method of virtual Socket communication under Docker cluster multi-tenant
US20140366039A1 (en) Computer system, computer-implemented method and computer program product for sequencing incoming messages for processing at an application
US20150095476A1 (en) Dynamic port naming in a chassis
CN111865868A (en) Cross-network regional service calling method and system
CN113760242A (en) Data processing method, device, server and medium
CN111078789B (en) Data sharing method and device, storage medium and electronic equipment
CN110096543B (en) Data operation method, device, server and medium of application program
CN107506369A (en) A kind of data access method and equipment
CN111897643A (en) Thread pool configuration system, method, device and storage medium
CN104796465B (en) Cloud platform method for processing business and system
CN115150268A (en) Network configuration method and device of Kubernetes cluster and electronic equipment
CN112671567B (en) 5G core network topology discovery method and device based on service interface
WO2015183016A1 (en) Data processing device and method for checking data recorded on memory of data processing device
CN112671565A (en) 5G core network topology discovery method and device based on signaling link

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