Data processing method and device, storage medium and electronic equipment
Through the introduction of target interfaces and modules in the gateway, the dynamic protocol conversion and plug -in processing of service request messages and response messages solves the problem of low efficiency of existing gateway data processing, and achieve efficient and flexible data processing capabilities.
Patent Information
- Application Number
- CN202411658929.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-01-28
AI Technical Summary
Existing gateways have problems such as high resource usage, long response time and insufficient dynamic configuration capabilities when processing data, resulting in low data processing efficiency.
Through the introduction of target interfaces, decoding modules, front chain filter modules, receiving modules, rear chain filter modules and encoding modules, the dynamic protocol conversion and plug -in processing of service request messages and response messages.
Improve the data processing efficiency and flexibility of the gateway, intelligently identify and adapt to various communication protocols, reduce data processing overhead, and maintain efficient operation at high merger and large -scale data traffic.
Smart Images

Figure CN119383230A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a data processing method and device, a storage medium, and an electronic device. Background Art
[0002] In related technologies, gateways, as key components in microservice architectures, are mainly responsible for tasks such as data routing, security control, and traffic management. However, the architectural design and technology selection of most gateway services often only focus on achieving the stability of functions and static configurations, resulting in limitations in the gateway's ability to process data. For example, the use of resource-intensive programming languages often requires high memory usage and a long response time. For another example, the dynamic configuration capabilities of gateways using a static configuration model based on Nginx are insufficient, making it difficult to cope with frequently changing routing requirements and protocol adaptation, especially when faced with large-scale, highly concurrent data traffic, leading to technical problems such as low data processing efficiency.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present application provide a data processing method and device, a storage medium, and an electronic device to at least solve the technical problem that the gateway has limited data processing capabilities, resulting in low data processing efficiency.
[0005] According to one aspect of an embodiment of the present application, a data processing method is provided, including: obtaining a service request message from a target terminal through a target interface, wherein the service request message is used to request a call to a target service deployed in a cloud native architecture; decoding the service request message to determine a first object; performing a pre-chain filtering process on the first object, and sending the filtered first object to a target node; receiving a second object returned by the target node based on the first object; performing a post-chain filtering process on the second object; encoding the filtered second object to determine a service response message, and returning the service response message to the target terminal through the target interface.
[0006] According to another aspect of an embodiment of the present application, a data processing device is also provided, including: an acquisition module, used to acquire a service request message from a target terminal through a target interface, wherein the service request message is used to request a call to a target service deployed in a cloud native architecture; a decoding module, used to decode the service request message to determine a first object; a first filtering module, used to perform a pre-chain filtering operation on the first object, and send the filtered first object to a target node; a receiving module, used to receive a second object returned by the target node based on the first object; a second filtering module, used to perform a post-chain filtering operation on the second object; an encoding module, used to perform an encoding operation on the filtered second object, determine a service response message, and return the service response message to the target terminal through the target interface.
[0007] Optionally, the device is used to perform pre-chain filtering on the first object in the following manner, and send the filtered first object to the target node: use a pre-chain filter plug-in to process the first object; the device is used to perform post-chain filtering on the second object in the following manner: use a post-chain filter plug-in to process the second object.
[0008] Optionally, the device is used to perform pre-chain filtering processing on the first object in the following manner: determine a first processing order based on a pre-set configuration rule, wherein the first processing order represents the chain process of the pre-chain filtering processing; perform at least one of the following operations according to the first processing order: authenticate the first object, determine whether the first object is allowed to be sent to the target node according to the authentication result, perform overload protection on the first object, adjust the load in the cloud native architecture, limit the flow of the first object, and perform security detection on the first object.
[0009] Optionally, the device is used to perform post-chain filtering processing on the second object in the following manner: determine a second processing order based on the configuration rules, wherein the second processing order represents the chain process of the post-chain filtering processing; perform at least one of the following operations according to the second processing order: dynamically retry the second object, and in the event of failure to transmit the service response message, re-return the service response message to the target terminal, monitor the second object, obtain the processing status of the second object, and transmit the processing status to the output port of the target gateway.
[0010] Optionally, the device is used to decode the service request message to determine the first object in the following manner: determine a target encoder and a target decoder based on the communication protocol used by the service request message, and use the target decoder to decode the service request message to determine the first object; encoding the filtered second object to determine a service response message, and returning the service response message to the target terminal through the target interface, including: using the target encoder to encode the second object to determine a service response message, and returning the service response message to the target terminal through the target interface provided by the target gateway.
[0011] Optionally, the device is used to determine a target encoder and a target decoder based on the communication protocol used by the service request message, and use the target decoder to decode the service request message to determine the first object: obtain a set of communication protocols configured for the target interface; when the communication protocol used by the service request message is a first communication protocol, determine a first encoder and a first decoder corresponding to the first communication protocol; use the first decoder to decode and deserialize the service request message to obtain the first object.
[0012] Optionally, the device is used to send the filtered first object to a target node in the following manner: convert the first object according to the communication protocol used by the target service to obtain a first structure, and send the first structure to the target node, wherein the target node represents a node in the cloud native architecture where the target service is deployed; the device is used to receive a second object returned by the target node based on the first object in the following manner: receive a second structure returned by the target node based on the first structure, convert the second structure according to the communication protocol used by the service request message to obtain a second object.
[0013] Optionally, the device is used to convert the first object according to the communication protocol used by the target service to obtain a first structure, and send the first structure to the target node in the following manner: obtain a second communication protocol used by the target service; convert the first object according to the second communication protocol to obtain the first structure; determine path information for the first structure to reach the target node based on the second communication protocol; and send the first structure to the target node according to the path information.
[0014] Optionally, the device is used to receive a second structure returned by the target node based on the first structure in the following manner, and convert the second structure according to the communication protocol used by the service request message to obtain a second object: receive the second structure returned by the target node based on the first structure, wherein the communication protocol used by the second structure is the second communication protocol; convert the second structure according to the communication protocol used by the service request message to obtain the second object.
[0015] Optionally, the device is used to determine the path information of the first structure reaching the target node based on the second communication protocol in the following manner: performing an absolute matching operation on the first structure based on the second communication protocol to determine a first matching result; if the first matching result fails to find the target service, performing a regular matching operation on the first structure to determine a second matching result; if the second matching result fails to find the target service, performing a matching operation on the first structure according to dynamic rules to determine a third matching result; if any one of the first matching result, the second matching result and the third matching result indicates that the target service has been found, performing grayscale calculation on the target service to determine the target node and the path information.
[0016] Optionally, the device is used to perform a matching operation on the first structure according to dynamic rules to determine a third matching result when the second matching result fails to find the target service in the following manner: obtaining the dynamic rules; obtaining a target expression by parsing the dynamic rules, and extracting request parameters from the first structure, wherein the target expression represents a logical processing condition corresponding to the target service, and the request parameters are determined by the target expression; processing the request parameters according to the target expression to obtain the third matching result.
[0017] Optionally, the device is used to perform grayscale calculation on the target service and determine the target node and the path information in the following manner when any one of the first matching result, the second matching result and the third matching result indicates that the target service is found: parse the grayscale release policy preset for the target service to obtain grayscale calculation rules, wherein the grayscale calculation rules include the traffic allocation ratio of each node in the target node and the target service version; extract target grayscale parameters from the first structure, wherein the target grayscale parameters are used to indicate the target node participating in the grayscale calculation; process the target grayscale parameters according to the grayscale calculation rules to obtain the path information.
[0018] According to one aspect of an embodiment of the present application, a data processing system is also provided, including: a target gateway, used to obtain a service request message from a target terminal through a target interface, wherein the service request message is used to request a call to a target service deployed in a cloud native architecture; the target interface, used to convert according to the service request message and the communication protocol used by the target service, so that the target service can recognize the service request message, and the target terminal can recognize the service response message returned by the target service; the cloud native architecture, used to provide services allowed to be called by the target terminal, wherein each service in the cloud native architecture is independently deployed in the form of a plug-in, and the cloud native architecture includes a pre-chain filter plug-in and a post-chain filter plug-in; the pre-chain filter plug-in is used to process the service request message before the service request message arrives at the target node corresponding to the target service; the post-chain filter plug-in is used to process the service response message after the service request message arrives at the target node corresponding to the target service.
[0019] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned data processing method when running.
[0020] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above data processing method.
[0021] According to another aspect of the embodiments of the present application, there is further provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the data processing method through the computer program.
[0022] In the embodiments of the present application, the purpose of efficient data processing and flexible protocol adaptation is achieved through dynamic protocol conversion and plug-in encoding / decoding processing, thereby realizing a high-performance and highly flexible gateway technical effect. Specifically, the target gateway can intelligently identify and adapt to various communication protocols (such as HTTP, gRPC, Dubbo-RPC, etc.), and use plug-in target encoders and target decoders to perform efficient data conversion and complete efficient calls to target services. At the same time, it effectively reduces the overhead of data processing and improves the overall processing efficiency. In addition, the embodiments of the present application also allow dynamic loading and configuration of plug-ins according to actual needs, further enhancing the data processing capabilities and flexibility of the gateway, ensuring its efficient operation under high concurrency and large-scale data traffic, and thus solving the technical problem of limited data processing capabilities of the gateway, resulting in low data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0024] Figure 1 is a schematic diagram of an application environment of an optional data processing method according to an embodiment of the present application;
[0025] Figure 2 is a flowchart of an optional data processing method according to an embodiment of the present application;
[0026] Figure 3 is a schematic diagram of an architecture of an optional data processing method according to an embodiment of the present application;
[0027] Figure 4 is a flowchart of an optional data processing method according to an embodiment of the present application;
[0028] Figure 5 is a schematic structural diagram of an optional data processing device according to an embodiment of the present application;
[0029] Figure 6 is a schematic diagram of the structure of an optional data processing product according to an embodiment of the present application;
[0030] Figure 7 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] The present application is described below in conjunction with embodiments:
[0034] According to one aspect of an embodiment of the present application, a data processing method is provided. Optionally, in this embodiment, the data processing method can be applied to Figure 1 In the hardware environment composed of the server 101 and the terminal device 103 shown in FIG. Figure 1As shown, the server 101 is connected to the terminal 103 via a network, and can be used to provide services for the terminal device or an application 107 installed on the terminal device. The application can be a video application, an instant messaging application, a browser application, an educational application, a game application, etc. A database 105 may be set up on the server or independently of the server to provide data storage services for the server 101, for example, a game data storage server. The above-mentioned network may include, but is not limited to, a wired network and a wireless network, wherein the wired network includes, for example, a local area network, a metropolitan area network, and a wide area network; the wireless network includes, for example, Bluetooth, WIFI, and other networks that implement wireless communication; the terminal device 103 may be a terminal configured with an application program, and may include, but is not limited to, at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop computer, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, an intelligent voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft, a virtual reality (VR) terminal, an augmented reality (AR) terminal, a mixed reality (MR) terminal, and other computer devices; the above-mentioned server may be a single server, a server cluster consisting of multiple servers, or a cloud server.
[0035] Combination Figure 1 As shown, the above data processing method can be executed by an electronic device, which can be a terminal device or a server. The above data processing method can be implemented by the terminal device or the server respectively, or by the terminal device and the server together.
[0036] The above is only an example and is not specifically limited in this embodiment.
[0037] Optionally, as an optional implementation, as Figure 2 As shown, the above data processing method includes:
[0038] S202, obtaining a service request message from a target terminal through a target interface, wherein the service request message is used to request to call a target service deployed in a cloud native architecture;
[0039] Optionally, the embodiments of the present application can be applied to a target gateway, which refers to a high-performance, plug-in-based intelligent API gateway; the target gateway can provide services including but not limited to gateway services developed based on Golang, etc., to dynamically load and manage plug-ins to achieve flexible data processing and routing functions; the above-mentioned target terminal may include but is not limited to mobile devices, desktop computers, Internet of Things devices, cloud service call programs, etc., and the target terminal can send the above-mentioned service request message through the network, and the service request message will be parsed, routed and processed by the target gateway; the above-mentioned cloud-native architecture refers to a software architecture designed and built based on a cloud platform. In the cloud-native architecture, each service is deployed independently, communicates through an API interface, and can be dynamically expanded and adjusted according to business needs and load conditions.
[0040] Exemplarily, in the application scenario of the big data operation service platform, when a user sends a data query message (the above-mentioned service request message) through the front-end interface of the target terminal, the request is first received through the target interface provided by the target gateway.
[0041] It should be noted that the protocol type of the above-mentioned target service can be any type, including but not limited to HTTP, gRPC, Dubbo-RPC, etc., and the target gateway can support and convert these different protocols by dynamically loading and configuring the corresponding encoder and decoder plug-ins.
[0042] In addition, the plug-in architecture of the target gateway also allows it to dynamically adjust routing policies, security controls, traffic management and other behaviors according to actual needs to adapt to different microservice scenarios and business needs. For example, by configuring a specific plug-in, stateful routing based on user numbers can be implemented to ensure that request messages with the same user number are always routed to the same service instance, thereby implementing grayscale release or canary deployment strategies, which are not limited in this application.
[0043] S204, decoding the service request message to determine the first object;
[0044] S206, performing a pre-chain filtering process on the first object, and sending the filtered first object to the target node;
[0045] S208, receiving a second object returned by the target node based on the first object;
[0046] S210, performing post-chain filtering processing on the second object;
[0047] Exemplarily, after the service request message arrives at the target gateway, it is first decoded into an internal unified data format (first object) by the target decoder, and then pre-processed by authentication, security check, flow control, etc. through the front chain filter plug-in in sequence; after the front chain filter plug-in is processed, according to the communication protocol of the target service deployed at the back end, the corresponding Codec plug-in is selected for protocol conversion, and the data is sent to the target service; after the target service is processed, the second structure is returned, and the target gateway performs post-processing such as result logging and response format adjustment through the post-chain filter plug-in, and finally uses the target encoder to encode the data into a service response message in the protocol format used by the service request message.
[0048] Exemplarily, when the target gateway receives a service request and decodes it into the above-mentioned first object, the composition of the first group of plug-ins and the first processing order can be determined according to pre-set configuration rules. Then, the target gateway calls each plug-in in the first group of plug-ins in turn according to the determined first processing order to process the first object.
[0049] Optionally, in an embodiment of the present application, the above-mentioned decoding operation can be implemented through a target encoder and a target decoder. Correspondingly, the corresponding second object can also be encoded through the target encoder, which refers to a data processing component customized according to a specific communication protocol, including but not limited to Codec plug-ins for HTTP, gRPC, Dubbo-RPC and other protocols, to achieve encoding or decoding of service request messages, ensuring the accurate conversion of the above-mentioned first object between different protocols. The above-mentioned first object refers to the data structure inside the gateway after decoding by the target decoder, which can be understood as a unified representation of the service request message inside the target gateway.
[0050] Exemplarily, in an application scenario of a hybrid protocol microservice architecture, it is assumed that the target terminal sends a service request message of the HTTP protocol, requesting to call the back-end target service based on the gRPC protocol. After the target gateway receives the service request message, it determines the target decoder according to the HTTP protocol, decodes the request message in the HTTP format, and converts it into an internal unified data representation (first object); then, the target gateway converts the first object into a first structure in the gRPC request format according to the gRPC protocol used by the target service, and sends it to the back-end service node for processing.
[0051] It should be noted that the target gateway is internally designed with a protocol identification module that can automatically identify the protocol type of the service request message and dynamically select the corresponding target encoder and target decoder. In addition, the target gateway also supports plug-in encoders and decoders, which means that users can directly add or replace Codec plug-ins of different protocols according to actual needs to adapt to the ever-changing technical environment and business needs; in addition, the target gateway can include but is not limited to the use of a series of optimization technologies (such as object reuse, link pool, etc.) in the decoding and encoding process to reduce resource consumption and improve data processing efficiency.
[0052] For example, if a company decides to migrate its internal services from Dubbo-RPC to gRPC, it only needs to update the corresponding Codec plug-in in the target gateway without making large-scale modifications to the main code or architecture of the gateway, thereby improving the flexibility and maintainability of the system.
[0053] Optionally, in an embodiment of the present application, the first structure may refer to the data format or structure after the first object is converted according to the communication protocol used by the target service, including but not limited to converting HTTP format data into request messages in gRPC or Dubbo-RPC format, etc., to realize service calls between different protocols; the target node refers to the specific server or container instance where the target service is deployed in the cloud native architecture, for example, a Kubernetes Pod, Docker container, virtual machine or physical server running a microservice.
[0054] Exemplarily, in an application scenario of a microservice architecture, assuming that the target gateway receives an HTTP service request message requesting to call a backend microservice based on the gRPC protocol (the above-mentioned target service), the target gateway first uses the target decoder of the HTTP protocol to decode the service request message into a first object. Subsequently, according to the gRPC protocol used by the target service, the gateway uses a preset gRPC Codec plug-in to convert the first object into a first structure in the gRPC request format. Then, the first structure is sent to the gRPC node running the target service (ie, the target node).
[0055] It should be noted that the above-mentioned target services can be deployed in different cloud-native architecture components, such as Pods in Kubernetes clusters, Docker containers, cloud server instances, etc. The above-mentioned target gateway can intelligently select the target node according to the deployment location and communication protocol of the service, and forward the service request.
[0056] Optionally, in an embodiment of the present application, the service request message can be processed by a second structure, wherein the second structure refers to the result data structure returned by the above-mentioned target node processing the service request message according to the communication protocol used by its service, including but not limited to the data response format of gRPC, Dubbo-RPC or other custom protocols; the above-mentioned second object refers to the response data that matches the communication protocol used by the service request message after conversion by the target encoder, including but not limited to HTTP response messages, etc.
[0057] For example, in a hybrid service call scenario under a cloud-native architecture, a user initiates an HTTP request message (the above-mentioned service request message) through a target terminal device to access a data query service (the above-mentioned target service), and the data query service is implemented based on the gRPC protocol in the backend.
[0058] Furthermore, the target gateway first converts the HTTP request into a first structure in the gRPC request format, and forwards it to the gRPC node (the target node) running the target service. After the gRPC node completes the processing, a second structure in the gRPC response format is returned to the target gateway.
[0059] S212: perform encoding operation on the filtered second object, determine a service response message, and return the service response message to the target terminal through the target interface.
[0060] Optionally, in an embodiment of the present application, the above-mentioned target encoder refers to a component or module in the target gateway responsible for converting the above-mentioned second object into a format required by a specific communication protocol, that is, the above-mentioned second structure, including but not limited to an HTTP encoder, a gRPC encoder, a Dubbo-RPC encoder, etc.; the above-mentioned service response message refers to data encoded by the target encoder and used to provide a service response result to the target terminal, including the processing result of requesting the above-mentioned target service, and its data format conforms to the communication protocol expected by the target terminal. For example, if the target terminal uses the HTTP protocol, the service response message will be encoded as an HTTP response message.
[0061] For example, in an e-commerce system based on a cloud-native architecture, a front-end user sends a product query request message through the HTTP protocol, and the product query service (the above-mentioned target service) is implemented using the gRPC protocol on the back end. After the request is processed, the product query service returns the product data in the second structure of the gRPC response format.
[0062] Furthermore, after receiving the second structure, the target gateway uses the gRPC encoder to convert it into a second object, and the target gateway uses the HTTP encoder to encode the second object, and finally determines it as a service response message that complies with the HTTP protocol, and returns it to the front-end user through the target interface, completing an efficient service call process from HTTP to gRPC and then back to HTTP.
[0063] It should be noted that the usage scenarios of the above-mentioned target encoders may vary according to actual needs. Therefore, the target service in the embodiments of the present application may use other non-mainstream communication protocols. Accordingly, the above-mentioned target gateway may be able to support and dynamically load corresponding encoder plug-ins to achieve support for these protocols. In addition, the target interface can dynamically select or switch the target encoder according to different client requirements and communication protocols to ensure the correctness and compatibility of the response message.
[0064] In an exemplary embodiment, Figure 3 is a schematic diagram of an optional data processing method according to an embodiment of the present application, such as Figure 3 As shown, the functional architecture diagram of the above target gateway is as follows Figure 3 As shown, taking information query service as an example, it includes but is not limited to:
[0065] S1: Receiving service request message: The target gateway receives an information query service request message sent by a front-end user via the HTTP protocol;
[0066] S2: Determine the communication protocol: The target gateway identifies that the service request message uses the HTTP communication protocol based on the Content-Type field in the request header;
[0067] S3: Decoding operation: using the HTTP decoder (target decoder) to decode the service request message, extracting key parameters and data in the request, and forming a unified internal data model (first object);
[0068] S4: Protocol conversion: According to the communication protocol (e.g., gRPC) used by the backend target service, the target gateway calls the gRPC encoder to convert the first object into a gRPC request format (a first structure);
[0069] S5: Routing forwarding: according to the dynamic routing rules and configuration, the first structure is sent to the gRPC microservice node (target node) that processes the product information query;
[0070] S6: Service response processing: After the target node processes the request, it returns the second structure in the gRPC response format;
[0071] S7: Response conversion: The target gateway uses the gRPC decoder to convert the second structure back to the internal unified data model (second object);
[0072] S8: Encoding response: using the HTTP encoder (target encoder) to encode the second object and determine it as a service response message in the HTTP response format;
[0073] S9: Return service response: The target gateway returns the service response message in HTTP response format to the front-end user through the target interface, completing the entire service call process.
[0074] Through the embodiments of the present application, the purpose of efficient data processing and flexible protocol adaptation is achieved through dynamic protocol conversion and plug-in encoding / decoding processing, thereby realizing a high-performance and highly flexible gateway technical effect. Specifically, the target gateway can intelligently identify and adapt to various communication protocols (such as HTTP, gRPC, Dubbo-RPC, etc.), and use plug-in target encoders and target decoders to perform efficient data conversion, complete efficient calling of target services, and at the same time, effectively reduce the data processing overhead and improve the overall processing efficiency. In addition, the embodiments of the present application also allow dynamic loading and configuration of plug-ins according to actual needs, further enhancing the data processing capabilities and flexibility of the gateway, ensuring its efficient operation under high concurrency and large-scale data traffic, and thus solving the technical problem of limited data processing capabilities of the gateway, resulting in low data processing efficiency.
[0075] As an optional solution, the above-mentioned pre-chain filtering processing on the above-mentioned first object, and sending the filtered first object to the target node, includes: using a pre-chain filter plug-in to process the above-mentioned first object; the above-mentioned post-chain filtering processing on the above-mentioned second object includes: using a post-chain filter plug-in to process the above-mentioned second object.
[0076] Optionally, in an embodiment of the present application, the above-mentioned front-chain filter plug-in refers to a series of plug-ins deployed in the above-mentioned target gateway, which can be executed in sequence to pre-process the first object, including but not limited to authentication verification, security check, flow control and other functions; the above-mentioned post-chain filter plug-in is also deployed on the above-mentioned target gateway, and is used to post-process the second object before the target encoder encoding operation, such as result logging, response data format adjustment or additional business logic operations.
[0077] In an exemplary embodiment, in a multi-tenant SaaS (Software as a Service) platform application scenario, after the service request message arrives at the target gateway, the pre-chain filter plug-in starts working, including but not limited to:
[0078] S1, verify tenant permissions to ensure that the request comes from a legitimate tenant;
[0079] S2, executes the security scanning plug-in to check whether the request carries malicious data;
[0080] S3, the traffic control plug-in decides whether to forward the request to the target service based on the current system load and the preset traffic limit policy;
[0081] Furthermore, after the target service is processed and the second object is obtained, the post-chain filter plug-in starts working, including but not limited to:
[0082] S1, the logging plug-in records the key information of the response result for subsequent analysis and monitoring;
[0083] S2, the error handling plug-in checks whether there is an error in the response, and performs corresponding processing or retries according to the error type.
[0084] It should be noted that the types and quantities of the above-mentioned pre-chain filter plug-ins and post-chain filter plug-ins can vary according to specific business needs and security policies, and the execution order and logical control of the plug-ins can also be dynamically adjusted through configuration to adapt to different business processes and policies. This application does not limit this.
[0085] Through the embodiment of the present application, a processing mechanism in which a front-chain filter plug-in and a post-chain filter plug-in work together is adopted to realize comprehensive pre-processing and post-processing of service request messages and service response messages, thereby achieving the purpose of improving the security, stability and service governance capabilities of the target gateway, and ensuring the technical effect of efficient execution of business processes and reasonable allocation of resources.
[0086] As an optional scheme, the above-mentioned pre-chain filtering processing on the above-mentioned first object includes: determining a first processing order based on a pre-set configuration rule, wherein the above-mentioned first processing order represents the chain process of the above-mentioned pre-chain filtering processing; performing at least one of the following operations according to the above-mentioned first processing order: authenticating the above-mentioned first object, determining whether the above-mentioned first object is allowed to be sent to the above-mentioned target node according to the authentication result, overload protecting the above-mentioned first object, adjusting the load in the above-mentioned cloud native architecture, limiting the flow of the above-mentioned first object, and performing security detection on the above-mentioned first object.
[0087] Optionally, in an embodiment of the present application, the pre-set configuration rules refer to a set of rules defined in the above-mentioned target gateway, which are used to determine plug-in enablement, disablement, processing logic and priority, including but not limited to plug-in enablement conditions, processing order, parameter configuration, etc.; the above-mentioned first group of plug-ins refers to a collection of plug-ins dynamically determined according to the configuration rules, which are used to perform operations such as authentication, overload protection, current limiting and security detection on the first object.
[0088] Exemplarily, when the target gateway receives a service request and decodes it into the above-mentioned first object, the composition of the first group of plug-ins and the first processing order can be determined according to pre-set configuration rules. Then, the target gateway calls each plug-in in the first group of plug-ins in turn according to the determined first processing order to process the first object.
[0089] In an exemplary embodiment, in a multi-tenant SaaS (Software as a Service) platform application scenario, if the target gateway receives a large number of product query request messages (the service request messages), the target gateway determines, according to pre-set configuration rules, that the first group of plug-ins includes an authentication plug-in, a current limiting plug-in, and a security detection plug-in, wherein the authentication plug-in is used to verify the tenant's access rights, the current limiting plug-in prevents a tenant's request from occupying too many system resources, and the security detection plug-in ensures the compliance of the request. Then, the target gateway confirms the user identity and access rights through the authentication plug-in in accordance with the first processing order, and then limits the request frequency according to the rules through the current limiting plug-in, and finally checks the legitimacy of the request data through the security detection plug-in.
[0090] It should be noted that the above-mentioned first group of plug-ins and their first processing order may be dynamically adjusted according to different request types and business scenarios. For example, during certain specific business peak periods, it may be necessary to enable the overload protection plug-in first to ensure the overall stability and response time of the system; in addition, the specific plug-in implementation and functions in the first group of plug-ins may also vary according to demand, such as using different authentication algorithms, current limiting strategies or security detection mechanisms, which are not limited in this application.
[0091] Through the embodiments of the present application, by adopting the dynamic configuration of plug-ins and the execution of processing order, the technical effects of efficient authentication, load balancing, current limiting control and security protection of service request messages are achieved, thereby achieving the purpose of improving the response speed, resource utilization and overall security of the target gateway.
[0092] As an optional scheme, the above-mentioned post-chain filtering processing on the above-mentioned second object includes: determining a second processing order based on the above-mentioned configuration rules, wherein the above-mentioned second processing order represents the chain process of the above-mentioned post-chain filtering processing; performing at least one of the following operations according to the above-mentioned second processing order: dynamically retrying the above-mentioned second object, and in the event that the transmission of the above-mentioned service response message fails, re-returning the above-mentioned service response message to the above-mentioned target terminal, monitoring the above-mentioned second object, obtaining the processing status of the above-mentioned second object, and transmitting the above-mentioned processing status to the output port of the above-mentioned target gateway.
[0093] Optionally, in an embodiment of the present application, the above-mentioned configuration rules refer to a set of rules defined in the target gateway, which are used to determine when to start a specific plug-in and the execution order of each plug-in, including but not limited to dynamic retry strategy, monitoring strategy and output port configuration, etc.; the above-mentioned second group of plug-ins refers to a set of plug-ins determined according to the configuration rules, which is used to perform dynamic retry on the above-mentioned second object, monitor the processing status, and transmit the status to the output port of the target gateway and other operations.
[0094] Exemplarily, after receiving the response of the target service (the second object), the target gateway determines the second group of plug-ins and the second processing order according to the configuration rules. If the service response message fails during transmission, the dynamic retry plug-in will retry to return the service response message to the target terminal according to the predefined retry mechanism; the monitoring plug-in is responsible for continuously monitoring the processing status of the second object to ensure the reliability and performance of the service response; and when the processing status needs to be recorded or analyzed, the status will be transmitted to the specific plug-in of the target gateway or the external monitoring system through the output port for logging or real-time analysis.
[0095] In an exemplary embodiment, after the target gateway receives the service response information of the backend service, it determines the second group of plug-ins as a dynamic retry plug-in, a performance monitoring plug-in and a log output plug-in according to the configuration rules, wherein the dynamic retry plug-in is responsible for retrying the failed service response when the network is unstable, the performance monitoring plug-in monitors the delay and throughput of the response data in real time, and the log output plug-in sends the processing status information to the output port of the target gateway for collection and analysis by the log server. Then, the target gateway follows the second processing order. The dynamic retry plug-in first tries to resend the failed response, the performance monitoring plug-in records the performance indicators of the response, and finally the log output plug-in transmits the processing status information to the log system of the target gateway.
[0096] It should be noted that the second group of plug-ins and their second processing order may be different in different business scenarios and requirements. For example, in some application scenarios that require strong data consistency, the dynamic retry plug-in may require a stricter retry strategy.
[0097] Through the embodiment of the present application, the second group of plug-ins and the second processing order are dynamically configured to achieve the technical effects of retrying the sending, real-time monitoring and status recording of the service response message, thereby achieving the purpose of improving the response reliability, performance monitoring capability and data processing transparency of the target gateway.
[0098] As an optional scheme, the above-mentioned decoding operation on the above-mentioned service request message to determine the first object includes: determining the target encoder and the target decoder based on the communication protocol used by the above-mentioned service request message, and using the above-mentioned target decoder to decode the above-mentioned service request message to determine the above-mentioned first object; the above-mentioned encoding operation on the filtered second object to determine the service response message, and returning the above-mentioned service response message to the above-mentioned target terminal through the above-mentioned target interface includes: using the above-mentioned target encoder to encode the above-mentioned second object to determine the service response message, and returning the above-mentioned service response message to the above-mentioned target terminal through the above-mentioned target interface provided by the above-mentioned target gateway.
[0099] Optionally, in an embodiment of the present application, the communication protocol set configured in the above-mentioned target gateway refers to a plug-in set pre-defined in the target gateway that supports multiple communication protocols, including but not limited to Codec plug-ins for protocols such as HTTP, gRPC, Dubbo-RPC, etc.; the above-mentioned first communication protocol refers to a specific communication protocol used by the service request message, and the corresponding first encoder and first decoder are Codec plug-ins for processing the protocol.
[0100] Exemplarily, when the target gateway receives the service request message, it first obtains the communication protocol set configured in the target gateway and identifies the communication protocol used by the request message; if the protocol is the first communication protocol, the target gateway selects a first decoder that matches the first communication protocol from the communication protocol set; then, the first decoder is used to decode and deserialize the service request message, and converts the protocol-specific request data into a unified internal data model, namely the first object, to provide standardized data input for subsequent processing flows.
[0101] In an exemplary embodiment, taking a microservice interaction application scenario in a hybrid cloud environment as an example, the target gateway serves as a service entry in the hybrid cloud environment and is used to receive external service request messages based on the HTTP protocol. The communication protocol set configured in the target gateway includes a variety of Codec plug-ins, including the HTTP Codec plug-in. If the target gateway recognizes that the request message uses the HTTP protocol, the HTTP Codec plug-in will be selected from the communication protocol set as the first encoder and the first decoder. Then, the first decoder will be used to decode and deserialize the HTTP service request message, and the service request message will be converted into a unified internal data model (the first object mentioned above) for subsequent authentication, routing, and protocol conversion operations.
[0102] It should be noted that the communication protocol set configured in the above target gateway may be dynamic, that is, plug-ins may be added or removed at runtime, so as to support more communication protocols or perform protocol upgrades.
[0103] Through the embodiments of the present application, the technical effect of flexible support and efficient processing of multiple communication protocols is achieved, the purpose of improving the adaptability and performance of the target gateway is achieved, and at the same time the complexity of protocol interaction between services in the cloud-native microservice architecture is simplified.
[0104] As an optional scheme, the target encoder and target decoder are determined based on the communication protocol used by the service request message, and the target decoder is used to decode the service request message to determine the first object, including: obtaining a communication protocol set configured for the target interface; when the communication protocol used by the service request message is the first communication protocol, determining the first encoder and the first decoder corresponding to the first communication protocol; using the first decoder to decode and deserialize the service request message to obtain the first object.
[0105] Optionally, in an embodiment of the present application, the above-mentioned second communication protocol refers to the protocol adopted for communication between the target service or target node and the API gateway, which may include but is not limited to gRPC, Dubbo-RPC, HTTP, etc.; the above-mentioned target router refers to a component or plug-in inside or outside the target gateway for determining the communication path, which is responsible for selecting the most appropriate routing strategy and path according to the target service and communication protocol of the service request; the above-mentioned path information refers to a detailed description of the communication path from the target gateway to the target node, including but not limited to the address, port, communication protocol, etc. of the target node.
[0106] Exemplarily, after the target gateway completes the preliminary processing of the service request message and determines the second communication protocol used by the target service, it will determine the target router based on the second communication protocol; then, the target router converts the first object into a data format suitable for the protocol according to the characteristics of the second communication protocol to obtain a first structure. The target router can analyze the location and communication requirements of the target service and generate detailed path information. The target gateway sends the first structure to the target node according to the path information to complete the proxy forwarding of the service request message.
[0107] In an exemplary embodiment, in an application scenario of a cloud-native microservice architecture, the API gateway receives a service request message using the HTTP protocol, and the target service is implemented using the gRPC protocol; the target gateway first obtains the second communication protocol (gRPC) of the target service, and then determines the target router based on the gRPC protocol; the target router converts the first object in HTTP format into a first structure in gRPC format, and determines the optimal path to the target node, including the gRPC service address and port of the target node; finally, the target gateway follows the path information and sends the first structure to the target node through the gRPC protocol, thereby realizing cross-protocol service request proxy.
[0108] It should be noted that in the embodiments of the present application, the second communication protocol of the above-mentioned target service and the determination strategy of the target router may vary in different scenarios; for example, the target service may adopt a non-standard or customized communication protocol, in which case corresponding Codec plug-in support is required; and the path selection of the target router may be based on load balancing, service availability, latency and other factors to ensure that the above-mentioned service request message can efficiently and reliably reach the target node.
[0109] Through the embodiments of the present application, based on the target router and path information of the communication protocol, the technical effects of cross-protocol service request proxy and routing functions are achieved, achieving the purpose of improving the protocol adaptation capability of the target gateway and the flexibility and efficiency of service calls.
[0110] As an optional scheme, the above-mentioned sending the filtered first object to the target node includes: converting the above-mentioned first object according to the communication protocol used by the above-mentioned target service to obtain a first structure, and sending the above-mentioned first structure to the target node, wherein the above-mentioned target node represents the node where the above-mentioned target service is deployed in the above-mentioned cloud native architecture; the above-mentioned receiving the second object returned by the above-mentioned target node based on the above-mentioned first object includes: receiving the second structure returned by the above-mentioned target node based on the above-mentioned first structure, converting the above-mentioned second structure according to the communication protocol used by the above-mentioned service request message to obtain the second object.
[0111] As an optional scheme, the above-mentioned first object is converted according to the communication protocol used by the above-mentioned target service to obtain the first structure, and the above-mentioned first structure is sent to the target node, including: obtaining the second communication protocol used by the above-mentioned target service; converting the above-mentioned first object according to the above-mentioned second communication protocol to obtain the above-mentioned first structure; determining the path information of the above-mentioned first structure to reach the above-mentioned target node based on the above-mentioned second communication protocol; and sending the above-mentioned first structure to the target node according to the above-mentioned path information.
[0112] As an optional scheme, the above-mentioned receiving the second structure returned by the above-mentioned target node based on the above-mentioned first structure, converting the above-mentioned second structure according to the communication protocol used by the above-mentioned service request message to obtain the second object, including: receiving the second structure returned by the above-mentioned target node based on the above-mentioned first structure, wherein the communication protocol used by the above-mentioned second structure is the above-mentioned second communication protocol; converting the above-mentioned second structure according to the communication protocol used by the above-mentioned service request message to obtain the above-mentioned second object.
[0113] Optionally, in an embodiment of the present application, the above-mentioned second structure refers to the data structure returned to the API gateway by the target node after processing based on the first structure, which uses the second communication protocol format adopted by the target service, including but not limited to the data formats of protocols such as gRPC, Dubbo-RPC, etc.; the above-mentioned second object is the data structure used to respond to the client after being converted again by the API gateway, and uses the communication protocol used by the client request, such as HTTP.
[0114] Exemplarily, when the target node completes processing of the first structure, it returns the second structure (such as response data in gRPC format) to the target gateway, and the target gateway converts the second structure into a second object according to the conversion rules between the first communication protocol (such as HTTP) and the second communication protocol (such as gRPC), that is, converts it into a data format that the client can understand and receive (such as HTTP response).
[0115] It should be noted that the conversion between the first communication protocol and the second communication protocol may include but is not limited to matching and conversion of data types, encoding formats, serialization methods, and other aspects.
[0116] Through the embodiments of the present application, the technical effect of cross-protocol response to service request information is achieved, the purpose of improving the compatibility of the target gateway communication protocol and the flexibility of the microservice architecture is achieved, and at the same time, it is ensured that service request messages and service response messages can be seamlessly converted between different protocols.
[0117] As an optional scheme, the above-mentioned determination of the path information of the first structure reaching the above-mentioned target node based on the above-mentioned second communication protocol includes: performing an absolute matching operation on the above-mentioned first structure based on the above-mentioned second communication protocol to determine a first matching result; when the above-mentioned first matching result fails to find the above-mentioned target service, performing a regular matching operation on the above-mentioned first structure to determine a second matching result; when the above-mentioned second matching result fails to find the above-mentioned target service, performing a matching operation on the above-mentioned first structure according to dynamic rules to determine a third matching result; when any one of the above-mentioned first matching result, the above-mentioned second matching result and the above-mentioned third matching result indicates that the above-mentioned target service has been found, performing grayscale calculation on the above-mentioned target service to determine the above-mentioned target node and the above-mentioned path information.
[0118] Optionally, in an embodiment of the present application, the above-mentioned absolute matching operation refers to a routing strategy for precise search based on a predefined service path or identifier; the above-mentioned regular matching operation is to use regular expressions to perform fuzzy matching on service requests after the absolute matching fails; the above-mentioned dynamic rule matching is to match service requests according to dynamic rules defined in real time when the first two fail to find the target service, and the above-mentioned grayscale calculation refers to calculating and determining the specific target nodes and path information according to a preset grayscale strategy (such as weighted random, blue-green grayscale, canary release, etc.) after matching the target service.
[0119] Exemplarily, when the target gateway receives the first structure, the target router first attempts to find the target service using an absolute match operation. If the absolute match fails to find the target service, a regular match operation is performed to try to fuzzily match the target service. If the regular match also fails to find the target service, the target router will perform a match operation according to the dynamic rules until the target service is determined. Once the match is successful, the target router will perform a grayscale calculation to determine the target node and the best path information based on the grayscale strategy to achieve stateful routing forwarding or service grayscale release.
[0120] In an exemplary embodiment, taking the personalized recommendation microservice scenario based on user behavior as an example, the API gateway receives the first structure of the recommendation request; first, the target router tries to use an absolute matching operation, such as directly querying the service registered under the " / recommendation / v1" path; if not found, it will use the regular matching " / recommendation / *" to try to match the recommendation service more broadly; if the regular matching is also unsuccessful, the target router will match the operation according to dynamic rules, such as matching a specific recommendation algorithm service according to the user ID and request time, and further, if the target service is matched, the grayscale calculation will be automatically performed to direct the service request message to the target node of the new and old recommendation algorithm versions of the target service.
[0121] It should be noted that the above-mentioned target service search and determination process can be adjusted according to the configuration of the target gateway, service registration information and changes in business needs, and this application does not limit this.
[0122] Through the embodiments of the present application, a multi-level routing matching strategy and grayscale calculation are adopted to achieve the technical effect of efficiently determining the target service and target node under multiple matching methods, thereby achieving the purpose of improving the routing flexibility of the target gateway and the accuracy of grayscale publishing. At the same time, it ensures that service requests can be correctly and efficiently routed to the target service, meeting the service call requirements in complex business scenarios.
[0123] As an optional scheme, when the target service is not found in the second matching result, a matching operation is performed on the first structure according to dynamic rules to determine a third matching result, including: obtaining the dynamic rules; obtaining a target expression by parsing the dynamic rules, and extracting request parameters from the first structure, wherein the target expression represents a logical processing condition corresponding to the target service, and the request parameters are determined by the target expression; processing the request parameters according to the target expression to obtain the third matching result.
[0124] Optionally, in an embodiment of the present application, the above-mentioned dynamic rules refer to routing matching rules that can be remotely updated and applied when the target gateway is running, including but not limited to conditional expressions based on HTTP request headers, form parameters, cookies, etc.; the above-mentioned target expression represents the logical processing conditions corresponding to the target service, which is generated by dynamic rule parsing and used to guide the routing decision of the service request. The above-mentioned request parameters are information extracted from the first structure according to the target expression, which is used to match and evaluate whether the service request meets the routing conditions.
[0125] Exemplarily, in the proxy process of the service request message, the target gateway first obtains the dynamic rules, then parses the rules, and extracts the target expression; the target gateway can also obtain request parameters related to the target expression from the first structure, and process the request parameters according to the logical conditions in the target expression to obtain a third matching result, thereby determining whether the service request meets the conditions for routing to a specific target service.
[0126] In an exemplary embodiment, when the target gateway receives a service request message with a method of GET and a path starting with / user / , and the devid parameter value contained in the service request message is xxx or zzz, and the appver parameter value is greater than or equal to v1.0.2, then the above target expression will take effect, and the target gateway will route according to the servicename in the return field and forward the request to the target service.
[0127] In another exemplary embodiment, taking an application scenario in which an e-commerce system dynamically adjusts a promotion strategy as an example, a target gateway receives a promotion service request message, and a dynamic rule includes a target expression, such as "user level in the request >= first level and request time > 8 p.m.", indicating that requests from first-level users in the evening period are preferentially routed to a new promotion strategy service; the target gateway parses the dynamic rule to obtain the target expression, extracts the user level and request time as request parameters from the first structure corresponding to the promotion service request message, and evaluates the request parameters according to the target expression. If the condition is met, the third matching result indicates that the service request message should be routed to the new promotion strategy service, otherwise the third matching result indicates that the service request message will be routed to the default or old strategy service.
[0128] Through the embodiments of the present application, the technical effect of determining the service request routing according to the real-time changing business logic when the target gateway is running is achieved, thereby achieving the purpose of improving the routing flexibility of the target gateway and the ability to respond to changes in business needs.
[0129] As an optional scheme, when any one of the above-mentioned first matching result, the above-mentioned second matching result and the above-mentioned third matching result indicates that the above-mentioned target service is found, grayscale calculation is performed on the above-mentioned target service to determine the above-mentioned target node and the above-mentioned path information, including: parsing the grayscale release strategy preset for the above-mentioned target service to obtain grayscale calculation rules, wherein the above-mentioned grayscale calculation rules include the traffic allocation ratio of each node in the above-mentioned target node and the target service version; extracting target grayscale parameters from the above-mentioned first structure, wherein the above-mentioned target grayscale parameters are used to indicate the above-mentioned target node participating in the above-mentioned grayscale calculation; processing the above-mentioned target grayscale parameters according to the above-mentioned grayscale calculation rules to obtain the above-mentioned path information.
[0130] Optionally, in an embodiment of the present application, the above-mentioned grayscale release strategy refers to a phased and proportional traffic allocation rule designed for a specific target service; the above-mentioned grayscale calculation rule includes the traffic allocation ratio of each node in the target node and the target service version, which is used to guide how to allocate traffic between different versions of service requests; the above-mentioned target grayscale parameters are parameters extracted from the first structure to indicate whether the service request participates in the grayscale calculation, such as user ID, device ID, etc. The target grayscale parameters determine which specific version of the target node the service request should be routed to.
[0131] Exemplarily, after receiving the service request message and determining the target service, the above-mentioned target gateway will parse the preset grayscale release strategy to obtain the grayscale calculation rules; then, extract the target grayscale parameters from the first structure, and process the target grayscale parameters according to the grayscale calculation rules, including but not limited to evaluating the parameter values, applying weighted random, hash algorithms or other strategies, and finally determining the path information of the target node to which the service request should be forwarded, including but not limited to the node address, port number and service version.
[0132] In an exemplary embodiment, taking the grayscale release scenario of a real-time recommendation engine as an example, the real-time recommendation engine has two versions, namely V1 and V2. V2 is a new version and is undergoing grayscale testing. First, the grayscale calculation rule is set to a node traffic allocation ratio of 5% for the V2 version and 95% for the V1 version, and the user ID is used as the target grayscale parameter.
[0133] Specifically, when the target gateway receives a user request (target service message), it determines that the request is related to the real-time recommendation engine service, then parses the grayscale release strategy, extracts the target grayscale parameters (user ID), and processes the target grayscale parameters according to the grayscale calculation rules.
[0134] For example, the target gateway uses a hash function to process the user ID. If the calculation result falls within the preset 5% ratio range, the request is routed to the target node of version V2; otherwise, the request is forwarded to the target node of version V1.
[0135] It should be noted that the traffic allocation ratio, target service version, and target grayscale parameter selection method in the grayscale calculation rules may change according to the characteristics of the service and business needs. For example, the traffic allocation ratio can be adjusted dynamically to gradually increase its traffic based on the test feedback of version V2; the target service version may involve the management and monitoring of more versions; the selection of target grayscale parameters may be based on other user characteristics such as geographic location and browser type. This application does not limit this, but only needs to ensure that the grayscale calculation rules can guide the traffic allocation of service requests based on specific parameters to support grayscale release operations.
[0136] Through the embodiments of the present application, intelligent routing allocation of service requests during grayscale release is achieved, ensuring the efficiency and security of target service updates while maintaining the continuity of the target service and the stability of the user experience.
[0137] As an optional solution, the present application also provides a data processing system, including: a target gateway, used to obtain a service request message from a target terminal through a target interface, wherein the service request message is used to request a call to a target service deployed in a cloud native architecture; the target interface, used to convert according to the service request message and the communication protocol used by the target service, so that the target service can recognize the service request message, and the target terminal can recognize the service response message returned by the target service; the cloud native architecture, used to provide services that allow the target terminal to call, wherein each service in the cloud native architecture is independently deployed in the form of a plug-in, and the cloud native architecture includes a pre-chain filter plug-in and a post-chain filter plug-in; the pre-chain filter plug-in is used to process the service request message before the service request message arrives at the target node corresponding to the target service; the post-chain filter plug-in is used to process the service response message after the service request message arrives at the target node corresponding to the target service.
[0138] Optionally, in an embodiment of the present application, the above-mentioned target gateway refers to an API gateway, which can be used as a middleware in a cloud-native architecture to receive and process service request messages from a target terminal; the above-mentioned target interface refers to a module or plug-in used for protocol conversion in the target gateway, ensuring that the target service can recognize the service request message, and the target terminal can recognize the service response message returned by the target service; the above-mentioned cloud-native architecture is a way of designing and building applications that allows services to be deployed and run with the characteristics of containerization, microservices, automated deployment and elastic scaling; the above-mentioned pre-chain filter plug-in and post-chain filter plug-in are two types of plug-ins in the API gateway, which are used to perform corresponding processing before and after the service request arrives at the target service node, such as authentication, logging, flow control, etc.
[0139] Exemplarily, after the target gateway receives the service request message sent by the target terminal, the target interface is converted according to the communication protocol used by the target service. If the target service uses the gRPC protocol and the service request message uses the HTTP protocol, the target interface will perform protocol conversion from HTTP to gRPC. Subsequently, the pre-chain filter plug-in performs a series of processing on the service request message, such as authentication, parameter verification, etc., to ensure the security and validity of the request. After the request arrives at the target service node and receives a response, the post-chain filter plug-in processes the received service response message, such as adding a response header, recording a response log, etc., and then converts the processed message back to a protocol recognizable by the target terminal through the target interface, such as HTTP, and sends it to the target terminal.
[0140] Through the embodiments of the present application, a plug-in intelligent target gateway and dynamic protocol conversion are adopted to achieve efficient, secure and flexible service request processing and response in a cloud-native architecture, thereby achieving the purpose of optimizing the service call process, enhancing service security and improving user experience, while ensuring a smooth transition and high reliability of service calls between different protocols.
[0141] In an exemplary embodiment, the data processing method proposed in the present application may include but is not limited to applications in business support fields and data business fields, and implements a high-performance plug-in intelligent API (interface) gateway technology, including integrated dynamic routing (for example, service, location (that is, the network location or endpoint of the service)), dynamic parameters), protocol conversion (for example, HTTP, gRPC, Dubbo-RPC, etc.), dynamic rule matching, multiple grayscale strategies (weighted random, blue-green grayscale, canary release), precise traffic control (current limiting, circuit breaking, timeout control, dynamic retry strategy, etc.), business authentication and other core important functions of the high-performance, high-reliability, high-stability, highly scalable, and extremely flexible microservice target gateway architecture.
[0142] For example, the functional architecture diagram is as follows Figure 3 As shown, the target gateway includes but is not limited to:
[0143] S1, internal service encapsulation: supports service encapsulation of three mainstream protocols in the industry, HTTP, gRPC, and Dubbo-RPC. Among them, HTTP has the highest priority and is the most commonly used communication protocol. The RPC protocol forwarding feature enables this target gateway to be applied to cloud-native service grid basic services as a sidecar grid for traffic proxy. It can also support protocol conversion. For example, internal services use the gRPC protocol, and the proxy is configured through this gateway to provide HTTP API interfaces to the outside world. The target gateway service starts multiple listening ports according to the configuration file, and supports request forwarding of multiple protocol types. The service handler is encapsulated in a componentized manner internally, and registered in the supported service type collection, and the corresponding service is dynamically loaded according to the startup type. For different communication protocols, the target gateway implements different types of Codec, Serialize, and Transport modules through interface encapsulation to achieve multi-protocol support and flexible custom extensions. The conversion classes of JSON protocol to Protobuf and Protobuf to json are encapsulated in a plug-in manner, and the protocol conversion class is registered in the corresponding collection. The protocol conversion type is dynamically selected through the factory mode.
[0144] S2, plug-in module: In order to more flexibly support and expand user-defined functions, some core functions of the gateway are developed in a plug-in manner. The plug-ins are implemented in a chain filter style and are divided into two categories: pre-filter plug-ins and post-filter plug-ins. The pre-filter plug-in call occurs before the traffic proxy, and mainly completes request authentication, security interception, traffic restriction and other functions. The post-filter plug-in call occurs after the traffic proxy, and is mainly for post-functions such as request retry and result reporting. The plug-ins are decoupled from each other and developed independently, and can also be independent of the code of the gateway service itself. Dynamic import and configuration according to demand before the gateway service is released. This improves flexibility and customizability, and reduces unnecessary performance loss;
[0145] S3, Configuration Management: Develop a dedicated target gateway configuration management system, including routing configuration, plug-in configuration, dynamic rule configuration, etc. The plug-in can be dynamically started and stopped through the configuration interface. Hot loading of related configuration data ensures that the configuration data takes effect in real time;
[0146] S4, dynamic plug-in third-party component access support: third-party components such as remote logging platform, distributed link tracking (Zipkin or Jaeger), and prometheus monitoring are accessed in a plug-in manner and can be flexibly replaced and plugged in; the target gateway is developed based on Golang, using coroutine pool, connection pool, object reuse, connection reuse, absolute path priority and other technologies to improve service performance. Through dynamic parameter routing, you can customize control parameters (such as HTTP form parameters, Header parameters, and Cookie parameters) and add rule matching to perform dynamic routing forwarding. The specific implementation includes but is not limited to: (1) users customize parameter fields and field values. Parameters do not need to specify form types or HTTP header types. The program automatically extracts them according to the priority, and forms a Condition through operators (>, <, ==, in, !=, etc.). Multiple Conditions form a rule set; (2) user-defined rule set configurations are synchronized to the service memory of the target gateway in real time through hot loading. When a request passes through the target gateway, the parameter field name in the rule (the above-mentioned request parameter) can be automatically extracted from the request according to the matched path, and logical operations can be performed according to the specified expression (the above-mentioned target expression). If the conditions are met, routing forwarding is performed according to the return value;
[0147] It should be noted that the target gateway can also perform a stateful routing mechanism. By configuring the Hash_key parameter, when the user releases the service in grayscale, the target gateway automatically extracts the Hask_key parameter (such as the user device number) and performs a unified Hash operation, and routes requests with the same key parameter to a fixed grayscale node, thereby realizing stateful routing forwarding.
[0148] In an exemplary embodiment, Figure 4 is a flow chart of an optional data processing method according to an embodiment of the present application. The traffic processing process of the target gateway is as follows Figure 4 As shown in the figure: the network traffic enters the target gateway, is decoded and deserialized according to the protocol type, and then passes through the front chain filter and is processed step by step according to the function of each plug-in; then dynamic route matching is performed according to the routing rules, during which user-defined dynamic parameters can be used, or stateful route matching can be performed; after finding the route, it is determined whether to perform protocol conversion based on the conditions, and the connection pool is used to send a proxy call. After the call is completed, it is processed after the traffic proxy through the post-chain filter plug-in, and finally the result is returned to the caller.
[0149] In another exemplary embodiment, it is assumed that there is a big data data operation service platform, which is composed of many microservices such as user tenants, permissions, portals, consoles, data queries, data connection, data fusion, intelligent analysis, and data management; through the embodiment of the present application, important functions such as permission management, traffic management, authentication management, and interface management can be integrated into one, and the platform service interface registers the target gateway to provide data service capabilities for the business, making the data service more dynamic, flexible, highly available, customized, etc., including but not limited to:
[0150] S1, unified traffic entry, front-end requests (the above service request messages) are uniformly sent to the API gateway for unified routing forwarding. According to user-defined forwarding rules, it can flexibly implement any customized grayscale ratio, blue-green release and canary release;
[0151] S2, unified user authentication and interface authentication, no need to implement user login status judgment and interface permission judgment for each interface in the business layer, the API gateway layer will handle it uniformly;
[0152] S3 can dynamically configure distributed link tracking plug-ins, interface performance monitoring plug-ins, log reporting plug-ins, security interception plug-ins, circuit breaker and current limiting plug-ins according to needs;
[0153] S4, internal gRPC type microservices can provide HTTP type interface calls to the outside world through this gateway configuration interface without changing any business code;
[0154] S5, user configuration can be hot-loaded, take effect in real time, and dynamically adjust forwarding rules;
[0155] S6, dynamically and flexibly create an external API (the above-mentioned target interface) for a unified data query service through configuration;
[0156] Specifically, the chain call plug-in mechanism proposed in the embodiment of the present application uniformly defines the plug-in interface, and all plug-ins must implement this interface. The specific implementation of the plug-in is divided into two categories: pre-filter plug-in and post-filter plug-in; among them, the pre-plug-in call occurs before the traffic proxy, mainly to complete the request authentication, security interception, traffic restriction and other functions. The post-plug-in call occurs after the traffic proxy, mainly for post-functions such as request retry and result reporting. Define the plug-in chain structure, the request is executed in the order of the plug-in chain, the plug-in controls the call internally, and can jump out or skip this node if it fails. At the same time, the plug-in can be hot-swapped, the configuration can be loaded remotely, and the plug-in can be started and stopped dynamically; dynamic rule matching mechanism: users define a series of rule sets by customizing parameter fields and value contents, and then the rule set configuration is synchronized to the service memory of the target gateway in real time through hot loading. When the request passes through the target gateway, the key parameter in the rule is automatically extracted from the request according to the matched path, and logical operations are performed according to the specified expression. If the conditions are met, the routing is forwarded according to the return value; stateful routing forwarding mechanism: by configuring the Hash_key parameter, when the user performs grayscale release of the service, the target gateway automatically extracts the Hask_key parameter (such as the user device number) and performs a unified Hash operation, and routes requests with the same key parameter to a fixed grayscale node, thereby realizing stateful routing forwarding; multi-protocol forwarding support mechanism: the gateway service integrates multiple protocol adapter plug-ins such as HTTP to gRPC and HTTP to Dubbo-RPC, performs corresponding decoding and deserialization according to the request protocol type, and then calls the adapter plug-in for encoding and serialization according to the protocol type of the target service, and then forwards the data to the target server.
[0157] Through the embodiments of the present application, based on Golang development, multiple technologies such as coroutine pool, link pool, object reuse, link reuse, absolute path priority, etc. are used to improve service performance; in addition, plug-in architecture, dynamic rule matching, configuration hot loading, configuration platform diversification support (etcd, consul, nacos, etc.), configuration file diversification (support Yaml, Json, etc.); the reliability of the target gateway is improved through timeout control and backoff retry strategy; the stability of the target gateway is improved through monitoring plug-ins (hardware indicator monitoring, distributed link monitoring); the security of the target gateway is improved through authentication plug-ins, security scanning plug-ins, etc. Compared with traditional API gateway technical methods, the target gateway in the embodiments of the present application has lower performance loss and higher flexibility, can also support more protocol types, and convert between different protocols, and its custom extensibility is stronger.
[0158] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0159] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0160] According to another aspect of the embodiment of the present application, a data processing device for implementing the above data processing method is also provided. Figure 5 As shown, the device comprises:
[0161] An acquisition module 502 is used to acquire a service request message from a target terminal through a target interface, wherein the service request message is used to request to call a target service deployed in a cloud native architecture;
[0162] A decoding module 504, configured to decode the service request message to determine a first object;
[0163] A first filtering module 506, configured to perform a pre-chain filtering process on the first object and send the filtered first object to a target node;
[0164] A receiving module 508, configured to receive a second object returned by the target node based on the first object;
[0165] A second filtering module 510, configured to perform post-chain filtering on the second object;
[0166] The encoding module 512 is used to perform an encoding operation on the filtered second object, determine a service response message, and return the service response message to the target terminal through the target interface.
[0167] As an optional solution, the above-mentioned device is used to perform pre-chain filtering on the first object in the following manner, and the filtered first object is sent to the target node: the first object is processed using a pre-chain filter plug-in; the above-mentioned device is used to perform post-chain filtering on the second object in the following manner: the second object is processed using a post-chain filter plug-in.
[0168] As an optional solution, the above-mentioned device is used to perform pre-chain filtering processing on the first object in the following manner: determine a first processing order based on a pre-set configuration rule, wherein the first processing order represents a chain process of the pre-chain filtering processing; perform at least one of the following operations according to the first processing order: authenticate the first object, determine whether the first object is allowed to be sent to the target node according to the authentication result, perform overload protection on the first object, adjust the load in the cloud native architecture, limit the flow of the first object, and perform security detection on the first object.
[0169] As an optional scheme, the above-mentioned device is used to perform post-chain filtering processing on the second object in the following manner: determine a second processing order based on a configuration rule, wherein the second processing order represents a chain process of post-chain filtering processing; perform at least one of the following operations according to the second processing order: dynamically retry the second object, and in the event of a service response message transmission failure, re-return the service response message to the target terminal, monitor the second object, obtain the processing status of the second object, and transmit the processing status to the output port of the target gateway.
[0170] As an optional scheme, the above-mentioned device is used to decode the service request message in the following manner to determine the first object: determine the target encoder and the target decoder based on the communication protocol used by the service request message, and use the target decoder to decode the service request message to determine the first object; encode the filtered second object to determine the service response message, and return the service response message to the target terminal through the target interface, including: use the target encoder to encode the second object to determine the service response message, and return the service response message to the target terminal through the target interface provided by the target gateway.
[0171] As an optional scheme, the above-mentioned device is used to determine the target encoder and the target decoder based on the communication protocol used by the service request message in the following manner, and use the target decoder to decode the service request message to determine the first object: obtain the communication protocol set configured for the target interface; when the communication protocol used by the service request message is the first communication protocol, determine the first encoder and the first decoder corresponding to the first communication protocol; use the first decoder to decode and deserialize the service request message to obtain the first object.
[0172] As an optional solution, the above-mentioned device is used to send the filtered first object to the target node in the following manner: convert the first object according to the communication protocol used by the target service to obtain a first structure, and send the first structure to the target node, wherein the target node represents the node where the target service is deployed in the cloud native architecture; the above-mentioned device is used to receive the second object returned by the target node based on the first object in the following manner: receive the second structure returned by the target node based on the first structure, convert the second structure according to the communication protocol used by the service request message to obtain the second object.
[0173] As an optional solution, the above-mentioned device is used to convert the first object according to the communication protocol used by the target service to obtain a first structure, and send the first structure to the target node in the following manner: obtain the second communication protocol used by the target service; convert the first object according to the second communication protocol to obtain the first structure; determine the path information of the first structure reaching the target node based on the second communication protocol; and send the first structure to the target node according to the path information.
[0174] As an optional scheme, the above-mentioned device is used to receive the second structure returned by the target node based on the first structure in the following manner, and convert the second structure according to the communication protocol used by the service request message to obtain the second object: receive the second structure returned by the target node based on the first structure, wherein the communication protocol used by the second structure is the second communication protocol; convert the second structure according to the communication protocol used by the service request message to obtain the second object.
[0175] As an optional solution, the above-mentioned device is used to determine the path information of the first structure reaching the target node based on the second communication protocol in the following manner: perform an absolute matching operation on the first structure based on the second communication protocol to determine a first matching result; if the first matching result does not find the target service, perform a regular matching operation on the first structure to determine a second matching result; if the second matching result does not find the target service, perform a matching operation on the first structure according to dynamic rules to determine a third matching result; if any one of the first matching result, the second matching result and the third matching result indicates that the target service has been found, perform grayscale calculation on the target service to determine the target node and path information.
[0176] As an optional solution, the above-mentioned device is used to perform a matching operation on the first structure according to dynamic rules to determine a third matching result when the second matching result fails to find the target service in the following manner: obtain the dynamic rules; obtain the target expression by parsing the dynamic rules, and extract the request parameters from the first structure, wherein the target expression represents the logical processing conditions corresponding to the target service, and the request parameters are determined by the target expression; process the request parameters according to the target expression to obtain the third matching result.
[0177] As an optional solution, the above-mentioned device is used to perform grayscale calculation on the target service and determine the target node and path information in the following manner when any one of the first matching result, the second matching result and the third matching result indicates that the target service is found: parse the grayscale release policy preset for the target service to obtain the grayscale calculation rules, wherein the grayscale calculation rules include the traffic allocation ratio of each node in the target node and the target service version; extract the target grayscale parameters from the first structure, wherein the target grayscale parameters are used to indicate the target nodes participating in the grayscale calculation; process the target grayscale parameters according to the grayscale calculation rules to obtain the path information.
[0178] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0179] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0180] According to one aspect of the present application, a computer program product is provided. The computer program product includes a computer program.
[0181] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0182] Figure 6 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.
[0183] It should be noted that Figure 6 The computer system 600 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0184] like Figure 6 As shown, the computer system 600 includes a central processing unit 601 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 602 (ROM) or the program loaded from the storage part 608 to the random access memory 603 (RAM). Various programs and data required for system operation are also stored in the random access memory 603. The central processing unit 601, the read-only memory 602 and the random access memory 603 are connected to each other through a bus 604. An input / output interface 605 (Input / Output interface, i.e., I / O interface) is also connected to the bus 604.
[0185] The following components are connected to the input / output interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a local area network card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.
[0186] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processor 601, various functions defined in the system of the present application are executed.
[0187] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processor 601, various functions provided by the embodiment of the present application are performed.
[0188] According to another aspect of the embodiment of the present application, an electronic device for implementing the above data processing method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a terminal device as an example. Figure 7 As shown, the electronic device includes a memory 702 and a processor 704. The memory 702 stores a computer program, and the processor 704 is configured to execute the steps in any of the above method embodiments through the computer program.
[0189] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0190] Optionally, in this embodiment, the above-mentioned processor can be configured to execute the methods in each embodiment of the present application through a computer program.
[0191] Alternatively, a person skilled in the art may understand that: Figure 7 The structure shown is for illustration only. Figure 7 The structure of the electronic device is not limited. Figure 7 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 7 Different configurations shown.
[0192] Among them, the memory 702 can be used to store software programs and modules, such as program instructions / modules corresponding to the data processing method and device in the embodiments of the present application. The processor 704 executes various functional applications and data processing by running the software programs and modules stored in the memory 702, that is, realizing the above-mentioned data processing method. The memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 702 may further include a memory remotely arranged relative to the processor 704, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 702 can be specifically, but not limited to, used to store information such as service request messages and service response messages. As an example, such as Figure 7 As shown, the memory 702 may include, but is not limited to, the acquisition module 502, the decoding module 504, the first filtering module 506, the receiving module 508, the second filtering module 510, and the encoding module 512 in the data processing device. In addition, other module units in the data processing device may also be included but are not limited to, which will not be repeated in this example.
[0193] Optionally, the transmission device 706 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 706 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 706 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0194] In addition, the electronic device further comprises: a display 708 for displaying the service request message and the service response message; and a connection bus 710 for connecting various module components in the electronic device.
[0195] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. The nodes may form a peer-to-peer network, and any form of computing device, such as a server, terminal or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0196] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the data processing method provided in various optional implementations of the above-mentioned data processing aspects.
[0197] Optionally, in this embodiment, the above-mentioned computer-readable storage medium can be configured to store data for executing the methods in various embodiments of the present application.
[0198] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0199] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0200] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for one or more electronic devices to execute all or part of the steps of the methods described in each embodiment of the present application.
[0201] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0202] In the several embodiments provided in the present application, it should be understood that the disclosed application can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0203] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0204] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0205] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A data processing method, characterized in that: include: Obtaining a service request message from a target terminal through a target interface, wherein the service request message is used to request to call a target service deployed in a cloud native architecture; Decoding the service request message to determine a first object; Performing a pre-chain filtering process on the first object, and sending the filtered first object to a target node; Receiving a second object returned by the target node based on the first object; performing post-chain filtering processing on the second object; An encoding operation is performed on the filtered second object to determine a service response message, and the service response message is returned to the target terminal through the target interface.
2. The method according to claim 1, characterized in that The performing pre-chain filtering on the first object and sending the filtered first object to the target node includes: using a pre-chain filter plug-in to process the first object; The performing post-chain filtering on the second object includes: using a post-chain filter plug-in to process the second object.
3. The method according to claim 1, characterized in that The performing pre-chain filtering on the first object includes: Determining a first processing sequence based on a preset configuration rule, wherein the first processing sequence represents a chain flow of the pre-chain filtering process; Perform at least one of the following operations in accordance with the first processing order: authenticate the first object, determine whether the first object is allowed to be sent to the target node according to the authentication result, perform overload protection on the first object, adjust the load in the cloud native architecture, limit the flow of the first object, and perform security detection on the first object.
4. The method according to claim 3, characterized in that: The performing post-chain filtering on the second object includes: Determining a second processing sequence based on the configuration rule, wherein the second processing sequence represents a chain flow of the post-chain filtering process; Perform at least one of the following operations in accordance with the second processing order: dynamically retry the second object, and if the service response message fails to be transmitted, re-return the service response message to the target terminal, monitor the second object, obtain the processing status of the second object, and transmit the processing status to the output port of the target gateway.
5. The method according to claim 1, characterized in that The decoding operation on the service request message to determine the first object includes: Determine a target encoder and a target decoder based on the communication protocol used by the service request message, and use the target decoder to decode the service request message to determine the first object; The encoding operation is performed on the filtered second object to determine the service response message, and the service response message is returned to the target terminal through the target interface, including: using the target encoder to encode the second object to determine the service response message, and the service response message is returned to the target terminal through the target interface provided by the target gateway.
6. The method according to claim 5, characterized in that The step of determining a target encoder and a target decoder based on a communication protocol used by the service request message, and using the target decoder to decode the service request message to determine the first object includes: Obtaining a communication protocol set configured for the target interface; In a case where the communication protocol used by the service request message is a first communication protocol, determining a first encoder and a first decoder corresponding to the first communication protocol; The first decoder is used to perform decoding operations and deserialization operations on the service request message to obtain the first object.
7. The method according to claim 1, characterized in that The sending the filtered first object to the target node includes: converting the first object according to the communication protocol used by the target service to obtain a first structure, and sending the first structure to the target node, wherein the target node represents a node in the cloud native architecture where the target service is deployed; The receiving a second object returned by the target node based on the first object includes: A second structure returned by the target node based on the first structure is received, and the second structure is converted according to the communication protocol used by the service request message to obtain a second object.
8. The method according to claim 7, characterized in that The converting the first object according to the communication protocol used by the target service to obtain a first structure, and sending the first structure to the target node includes: Acquire a second communication protocol used by the target service; Convert the first object according to the second communication protocol to obtain the first structure; Determine path information for the first structure to reach the target node based on the second communication protocol; The first structure is sent to a target node according to the path information.
9. The method according to claim 8, characterized in that The receiving target node converts the second structure returned by the first structure according to the communication protocol used by the service request message to obtain a second object, including: receiving a second structure returned by the target node based on the first structure, wherein a communication protocol used by the second structure is the second communication protocol; The second structure is converted according to the communication protocol used by the service request message to obtain the second object.
10. The method according to claim 8, characterized in that The determining, based on the second communication protocol, path information for the first structure to reach the target node includes: Performing an absolute matching operation on the first structure based on the second communication protocol to determine a first matching result; If the target service is not found in the first matching result, a regular matching operation is performed on the first structure to determine a second matching result; If the target service is not found in the second matching result, performing a matching operation on the first structure according to a dynamic rule to determine a third matching result; In the case that any one of the first matching result, the second matching result, and the third matching result indicates that the target service is found, grayscale calculation is performed on the target service to determine the target node and the path information.
11. The method according to claim 10, characterized in that In the case that the target service is not found in the second matching result, performing a matching operation on the first structure according to a dynamic rule to determine a third matching result includes: Obtaining the dynamic rules; By parsing the dynamic rule, a target expression is obtained, and a request parameter is extracted from the first structure, wherein the target expression represents a logical processing condition corresponding to the target service, and the request parameter is determined by the target expression; The request parameter is processed according to the target expression to obtain the third matching result.
12. The method according to claim 10, characterized in that When any one of the first matching result, the second matching result, and the third matching result indicates that the target service is found, performing grayscale calculation on the target service to determine the target node and the path information includes: Parse the preset grayscale release strategy for the target service to obtain a grayscale calculation rule, wherein the grayscale calculation rule includes the traffic allocation ratio of each node in the target node and the target service version; Extracting a target grayscale parameter from the first structure, wherein the target grayscale parameter is used to indicate the target node involved in the grayscale calculation; The target grayscale parameter is processed according to the grayscale calculation rule to obtain the path information.
13. A data processing system, characterized in that: include: A target gateway, used to obtain a service request message from a target terminal through a target interface, wherein the service request message is used to request to call a target service deployed in a cloud native architecture; The target interface is used to convert according to the service request message and the communication protocol used by the target service, so that the target service can recognize the service request message, and the target terminal can recognize the service response message returned by the target service; The cloud native architecture is used to provide services that allow the target terminal to call, wherein each service in the cloud native architecture is independently deployed in the form of a plug-in, and the cloud native architecture includes a pre-chain filter plug-in and a post-chain filter plug-in; The pre-chain filter plug-in is used to process the service request message before the service request message reaches the target node corresponding to the target service; The post-chain filter plug-in is used to process the service response message after the service request message arrives at the target node corresponding to the target service.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein the computer program can be executed by an electronic device to perform the method described in any one of claims 1 to 12.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 12 are implemented.
16. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 12 through the computer program.
Citation Information
Cited By
Plug-in-based front-end page rendering method and system
CN120909588A
A plug-in-based front-end page rendering method and system
CN120909588B
Service calling method and device of adaptive matching communication protocol
CN121000788A
Cloud native gateway aggregation service method and device based on dynamic configuration and plug-in architecture, and medium
CN122496451A
A cloud-native gateway aggregation service method and device based on a dynamic configuration and plugin architecture, and a medium
CN122496451B