Method and device for processing message information
By dynamically extracting the staining characteristics of message information, finding and applying dyeing strategies, updating and distributing message information, the problem of insufficient flexibility and scalability in the existing technology is solved, and more efficient message information processing and distribution is achieved.
Patent Information
- Application Number
- CN202311797843.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-25
- Publication Date
- 2025-06-27
AI Technical Summary
In the case of rapid update and frequent increase in dyeing rules, the prior art has problems of poor flexibility, scalability and maintainability, which affects the efficiency of gateway processing packet information.
By obtaining message information, extracting staining features, finding matching staining strategies, using staining marks in the staining strategy to update message information, and dynamically distribute message information based on the correspondence between staining marks and processing information.
It improves the flexibility and scalability of processing message information, and improves the real-time and efficiency of distributing message information.
Smart Images

Figure CN120223777A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a method and apparatus for processing message information. Background Art
[0002] As the services for Internet applications become more and more complex and the requirements for the running speed and performance of applications are getting higher and higher, it is usually necessary to perform operations such as management, filtering, and distribution of a large amount of message information (i.e., network traffic) generated by applications through gateways in the application network structure.
[0003] Before distributing message information, a gateway usually performs coloring processing on the received messages for distribution to different backend servers. Currently, the method for implementing coloring processing is to modify the code of the gateway or the backend server that receives the messages according to coloring rules. Existing methods have problems of poor flexibility, poor scalability, and poor maintainability in the case of rapid update of coloring rules and frequent addition of coloring rules, which affects the efficiency of the gateway in processing message information. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method and apparatus for processing message information, which can obtain message information, extract coloring features, find coloring strategies matching the coloring features, update the message information using coloring identifiers included in the coloring strategies; and based on the correspondence between the coloring identifiers and processing end information, distribute the updated message information to the corresponding processing ends. Embodiments of the present invention improve the flexibility and scalability of processing message information and the real-time performance and efficiency of distributing message information through dynamic configuration of coloring strategies and dynamic coloring operations on message information.
[0005] To achieve the above object, according to one aspect of embodiments of the present invention, there is provided a method for processing message information, which is applied to a gateway and is characterized by including: obtaining message information and extracting coloring features from the message information; finding one or more coloring strategies matching the coloring features, where one or more of the coloring strategies are assembled based on externally input configuration item information; updating the message information using coloring identifiers included in the coloring strategies; and based on the correspondence between the coloring identifiers included in the coloring strategies and processing end information, distributing the updated message information to the corresponding processing ends.
[0006] Optionally, the gateway is configured with an interception component; the obtaining message information includes: intercepting the message information received by the gateway through the interception component.
[0007] Optionally, the method for processing message information further includes: receiving a configuration request or a change request for a coloring policy; providing a plurality of configuration items, and obtaining configuration item information corresponding to the plurality of configuration items; wherein the configuration item information indicates a target coloring feature to be configured, a target coloring identifier corresponding to the configured target coloring feature, processing end information, and an identifier position; assembling the target coloring feature to be configured indicated by the configuration item information, the target coloring identifier corresponding to the configured target coloring feature, the processing end information, and the identifier position to obtain one or more of the coloring policies.
[0008] Optionally, updating the message information by using coloring identifiers included in one or more coloring policies includes: obtaining coloring identifiers included in one or more coloring policies; using dynamic instrumentation technology to update the message information based on the coloring identifiers; wherein the dynamic instrumentation technology includes one or more of dynamic proxy, aspect-oriented programming, and bytecode operation.
[0009] Optionally, updating the message information by using coloring identifiers included in one or more coloring policies includes: determining an identifier position of the coloring identifier in the message information according to the coloring policy; wherein the identifier position is one or more of a request header, message-carrying text, and a request body; updating the coloring identifiers included in the plurality of coloring policies to the corresponding identifier positions in the message information.
[0010] Optionally, distributing the updated message information to a corresponding processing end based on the correspondence between the coloring identifier included in the coloring policy and the processing end information includes: distributing the updated message information to one or more processing ends corresponding to the coloring identifier according to the correspondence between the coloring identifier included in the coloring policy and the processing end information, wherein the corresponding distribution policy includes one or more of round-robin, weighted round-robin, and custom distribution based on load balancing technology.
[0011] Optionally, distributing the updated message information to a corresponding processing end based on the correspondence between the coloring identifier included in the coloring policy and the processing end information further includes: generating log information for the process of distributing the updated message information to a corresponding processing end; analyzing evaluation data of the gateway's coloring processing of a plurality of message information based on the plurality of log information; optimizing the coloring policy according to the evaluation data.
[0012] To achieve the above object, according to a second aspect of the embodiments of the present invention, there is provided an apparatus for processing message information, including: a message obtaining module, a message coloring module, and a message distributing module; wherein,
[0013] The message obtaining module is configured to obtain message information and extract a coloring feature from the message information;
[0014] The message coloring module is used to find one or more coloring strategies that match the coloring features; wherein, one or more of the coloring strategies are assembled based on the configuration item information input externally; and update the message information by using the coloring identifiers included in the coloring strategies.
[0015] The message distributing module is used to distribute the updated message information to the corresponding processing end based on the correspondence between the coloring identifiers included in the coloring strategies and the processing end information.
[0016] Optionally, the device for processing message information includes: the gateway is configured with an interception component; and the obtaining of the message information includes: intercepting the message information received by the gateway through the interception component.
[0017] Optionally, the device for processing message information is further used to receive a configuration request or a change request for the coloring strategy; provide a plurality of configuration items, and obtain the configuration item information corresponding to the plurality of configuration items, wherein the configuration item information indicates the target coloring feature to be configured, the target coloring identifier corresponding to the configured target coloring feature, the processing end information, and the identifier position; and assemble the target coloring feature to be configured, the target coloring identifier corresponding to the configured target coloring feature, the processing end information, and the identifier position indicated by the configuration item information to obtain one or more of the coloring strategies.
[0018] Optionally, the device for processing message information is used to update the message information by using the coloring identifiers included in one or more coloring strategies, including: obtaining the coloring identifiers included in one or more coloring strategies; and updating the message information based on the coloring identifiers by using dynamic instrumentation technology, wherein the dynamic instrumentation technology includes one or more of dynamic proxy, aspect-oriented programming, and bytecode operation.
[0019] Optionally, the device for processing message information is used to update the message information by using the coloring identifiers included in one or more coloring strategies, including: determining the identifier position of the coloring identifier in the message information according to the coloring strategy, wherein the identifier position is one or more of the request header, the message-carrying text, and the request body; and updating the coloring identifiers included in the plurality of coloring strategies to the corresponding identifier positions of the message information.
[0020] Optionally, the device for processing message information is configured to distribute the updated message information to the corresponding processing end based on the correspondence between the coloring identifier and the processing end information included in the coloring policy, including: distributing the updated message information to one or more processing ends corresponding to the coloring identifier according to the correspondence between the coloring identifier and the processing end information included in the coloring policy, where the corresponding distribution policy includes one or more of round-robin, weighted round-robin, and custom distribution based on load balancing technology.
[0021] Optionally, the device for processing message information is configured to distribute the updated message information to the corresponding processing end based on the correspondence between the coloring identifier and the processing end information included in the coloring policy, and further includes: generating log information for the process of distributing the updated message information to the corresponding processing end; analyzing the evaluation data of the coloring process of the gateway for multiple message information based on multiple log information; and optimizing the coloring policy according to the evaluation data.
[0022] To achieve the above object, according to the third aspect of the embodiments of the present invention, there is provided an electronic device for processing message information, which is characterized by including: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the methods for processing message information as described above.
[0023] To achieve the above object, according to the fourth aspect of the embodiments of the present invention, there is provided a computer-readable medium having a computer program stored thereon, which is characterized in that when the program is executed by a processor, it implements any one of the methods for processing message information as described above.
[0024] One embodiment of the above invention has the following advantages or beneficial effects: It can obtain message information, extract coloring features, find a coloring policy that matches the coloring features, and update the message information (coloring operation) using the coloring identifier included in the coloring policy; and based on the correspondence between the coloring identifier and the processing end information, distribute the updated message information to the corresponding processing end. The embodiments of the present invention improve the flexibility and scalability of processing message information and the real-time performance and efficiency of distributing message information through dynamic configuration of the coloring policy and dynamic coloring operation for message information.
[0025] The further effects of the above non-conventional optional methods will be described in combination with specific embodiments below. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:
[0027] Figure 1 It is a schematic flow chart of a method for processing message information provided by an embodiment of the present invention;
[0028] Figure 2 It is a schematic flow chart of a process for processing message information provided by another embodiment of the present invention;
[0029] Figure 3 It is a schematic flow chart of a process for processing message information provided by an embodiment of the present invention;
[0030] Figure 4 It is a schematic structural diagram of a device for processing message information provided by an embodiment of the present invention;
[0031] Figure 5 It is an exemplary system architecture diagram to which the embodiments of the present invention can be applied;
[0032] Figure 6 It is a schematic structural diagram of a computer system of a terminal device or a server suitable for implementing the embodiments of the present invention. Detailed implementation manners
[0033] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, the description below omits the description of well-known functions and structures.
[0034] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing, transfer and other processing of the user's personal information all comply with the provisions of relevant laws and regulations, and the user needs to be informed and obtain the consent or authorization of the user. When applicable, technical processing of de-identifying and / or anonymizing and / or encrypting the user's personal information is performed.
[0035] After collecting the message information sent by the client, we will perform de-identifying processing on the data through technical means. As Figure 1 shown, an embodiment of the present invention provides a method for processing message information, and the method may include the following steps:
[0036] Step S101: Obtain message information and extract coloring features from the message information.
[0037] Specifically, in the embodiments of the present invention, the message information is a data block for data interaction transmitted by a client or a server. Taking an HTTP request message as an example, generally, the HTTP message information consists of three parts: a start line that describes the message, a message header that contains attributes, and an optional message body part that contains data.
[0038] Further, coloring features are extracted from the message information; generally, traffic can be identified by adding preset identifiers or metadata to the message information (i.e., network traffic) to implement processing such as personalized traffic control and distribution. In the embodiments of the present invention, "coloring" is used to describe the operation of adding preset identifiers to distinguish different traffic; among them, the coloring feature refers to the feature data in the message information used for coloring, for example: one or more of the source IP address, destination IP address, destination URL path, request method, request parameters, etc. Further, coloring has a corresponding coloring strategy (i.e., coloring rule), and the coloring rule (Coloring Rules) is a rule for determining the conditions and methods of the coloring operation. The coloring rule can determine the logic and rules of the coloring identifier based on the attributes of the request (such as the source IP address, destination URL path, request method, etc.) or business requirements (such as access control policies, routing policies, etc.).
[0039] In the embodiments of the present invention, the execution entity is a gateway (such as a gateway server, gateway device, gateway component, etc.). Preferably, the gateway includes an interception component, that is, the gateway is configured with an interception component; the obtaining of the message information includes: intercepting the message information received by the gateway through the interception component. Further coloring operations for the message information are performed by intercepting the message information. Among them, the coloring operation (Traffic Coloring) refers to an operation of marking, modifying, or adding coloring information (i.e., coloring identifier) to the message information (traffic). The coloring operation can identify traffic by adding specific marks or metadata (i.e., distinguish traffic by coloring identifiers) to implement personalized traffic control and processing.
[0040] Step S102: Find one or more coloring strategies that match the coloring features; among them, one or more of the coloring strategies are assembled based on externally input configuration item information; update the message information with the coloring identifier included in the coloring strategy.
[0041] Specifically, in the embodiments of the present invention, the configuration item information for the coloring strategy can be dynamically added, modified, or deleted, and the configuration item information can be stored in a configuration file, database, zookeeper data source, other data sources, etc.
[0042] Further, embodiments of the present invention can provide multiple configuration items through a page to receive configuration item information and store the configuration items and the corresponding configuration item information. The configuration item information includes the configured target coloring feature, the target coloring identifier corresponding to the configured target coloring feature, the processing end information, and the identification position, etc. For example, the target coloring identifiers configured for the message information with the target URL of xxx.yyy.com are: label:a, label:vip, etc., one or more; the identification positions for adding the target coloring identifier: for example, one or more of the request header, the message-carrying text (i.e., the Cookie carried by the message), and the request body; the processing end information corresponding to the target coloring identifier of the message information, where the processing end information includes the host identifier uniquely identifying the processing end (such as a server, etc.), the IP address, the function identifier (such as a server for testing and gray release), etc. Thus, it can be seen that the embodiments of the present invention assemble the coloring strategy (including the coloring identifier configured for the coloring feature, the adding position of the coloring identifier in the message, the corresponding relationship between the coloring identifier and the processing end information, etc.) based on the configuration item information input from outside the gateway, greatly improving the flexibility and scalability of determining the coloring strategy, decoupling from the coloring code of the gateway or the backend server of the processing end, and improving the flexibility and efficiency of processing message information.
[0043] Further, find one or more coloring strategies that match the coloring feature; wherein, the one or more coloring strategies are assembled based on the configuration item information input from outside. Specifically, receive a configuration request or a change request for the coloring strategy; provide multiple configuration items and obtain the configuration item information corresponding to the multiple configuration items. The configuration item information indicates the configured target coloring feature, the target coloring identifier corresponding to the configured target coloring feature, the processing end information, and the identification position; assemble the configured target coloring feature, the target coloring identifier corresponding to the configured target coloring feature, the processing end information, and the identification position indicated by the configuration item information to obtain one or more of the coloring strategies. Further, according to the received configuration item information, store the corresponding relationship of each configuration item information, and store the corresponding relationship between the coloring feature and the coloring strategy. The coloring strategy is one or more of the access strategy for sending message information (such as different access permissions for different user roles, different IP addresses, etc.), the request path strategy included in the message information (such as distributing the message information to different processing ends according to different request paths), and the request parameter (such as distributing the message information to different processing ends according to different parameter values corresponding to different parameters) strategy included in the message information.
[0044] Further, update the message information by using the coloring identifier included in the coloring strategy; wherein, the coloring identifier is, for example, a coloring field, or a set identifier, or a string customized according to the scenario. The present application does not limit the specific form and content of the coloring identifier.
[0045] An example of a request header with the coloring identifier "label:a" added to the message information is as follows:
[0046] Accept:application / json,text / plain,* / *
[0047] Referer:http: / / xxxx.xx.com /
[0048] User-Agent:Mozilla / 5.0(Macintosh;Intel Mac OS X 10_15_7)AppleWebKit / 537.36(KHTML,like Gecko)Chrome / 119.0.0.0Safari / 537.36
[0049] X-Requested-With:XMLHttpRequest
[0050] label:a
[0051] Among them, "label" is the coloring identifier field, and "a" is the value of the coloring identifier field; "label:a" is described as the coloring identifier.
[0052] The following takes the coloring policy for access control (i.e., user roles) as an example to illustrate. For example, according to requirements, there are the following configuration item information of user roles associated with message information access control: ordinary users, VIP users, and administrators; the corresponding coloring policies include: if the user role is an ordinary user, the value of the coloring identification field is "normal". If the user role is a VIP user, the value of the coloring identification field is "vip". If the user role is an administrator, the value of the coloring identification field is "admin". The coloring operation (i.e., updating the message information) includes: receiving the message information, parsing the user identification of the message information, determining the role information of the user, if the user role is an ordinary user, adding a coloring identification field (such as label) to the request and setting its value to "normal". If the user role is a VIP user, adding a coloring identification field to the request and setting its value to "vip". If the user role is an administrator, adding a coloring identification field to the request and setting its value to "admin". Different dimensions of coloring can be added to the same request. Further, according to different application scenarios, different coloring policies are matched for different services. For example: service a matches access control (user roles); service b matches the request path, and service c matches the request parameters, etc. If multiple rules are defined and multiple are matched, multiple different coloring identification fields and / or coloring field values, i.e., multiple coloring identifications, can be added (or modified) to the message information. When distributing the message subsequently, it can be determined based on the dynamic distribution policy (such as the priority policy or the first-matched policy, etc.) which dimension the request performs the distribution action on.
[0053] Further, using the dynamic instrumentation technology, update the message information based on the coloring identifier, where the dynamic instrumentation technology includes one or more of dynamic proxy, aspect-oriented programming (i.e., AOP technology), and bytecode operation; that is, a technical solution for traffic coloring is implemented by performing dynamic instrumentation operations in the gateway, and real-time instrumentation operations are performed on requests using the dynamic instrumentation technology; that is, updating the message information using the coloring identifiers included in one or more coloring strategies includes: obtaining the coloring identifiers included in one or more coloring strategies; using the dynamic instrumentation technology, updating the message information based on the coloring identifiers; where the dynamic instrumentation technology includes one or more of dynamic proxy, aspect-oriented programming, and bytecode operation. Among them, the dynamic instrumentation technology is a technology for modifying or injecting instrumentation code during code execution. In the message information processing (traffic coloring) of the gateway, dynamic instrumentation refers to implementing traffic coloring operations by modifying or injecting code in the gateway. Instrumentation code is the code that is injected or modified in dynamic instrumentation. The instrumentation code is used to implement the coloring operation, mark, modify, or add coloring identifiers to the traffic according to the coloring rules to achieve the coloring operation of the message information; among them, one or more of dynamic proxy, aspect-oriented programming (i.e., AOP technology), and bytecode operation (for example, bytecode enhancement operations performed in combination with Java probes) can be used to perform corresponding coloring operations. For the same message information (such as an HTTP request), different dynamic instrumentation technologies are selected for different coloring strategies according to different application scenarios.
[0054] Further, the coloring enhancement effect can be achieved by adding or changing coloring identifiers at different identification positions in the message information through the dynamic instrumentation technology (the identification positions are one or more of the request header, the message-carrying text Cookie, and the request body). That is, updating the message information using the coloring identifiers included in one or more coloring strategies includes: determining the identification position of the coloring identifier in the message information according to the coloring strategy; where the identification position is one or more of the request header, the message-carrying text, and the request body; updating the coloring identifiers included in the multiple coloring strategies to the corresponding identification positions of the message information.
[0055] Step S103: Based on the correspondence between the coloring identifiers included in the coloring strategy and the processing end information, distribute the updated message information to the corresponding processing end.
[0056] Specifically, after using the dynamic instrumentation technology to perform coloring processing on the message information (i.e., updating the message information), obtain the correspondence between the coloring features included in the coloring strategy corresponding to the message information and the processing end, and distribute the updated message information to the corresponding processing end, that is, based on the correspondence between the coloring identifier included in the coloring strategy and the processing end information, distributing the updated message information to the corresponding processing end includes: according to the correspondence between the coloring identifier included in the coloring strategy and the processing end information, distributing the updated message information to one or more processing ends corresponding to the coloring identifier, where the corresponding distribution strategy includes one or more of round-robin, weighted round-robin, and custom distribution based on the load balancing technology. The processing type of the processing end can be set according to the actual application scenario. For example, the processing end is used to process different types of services such as traffic routing and complex balancing, A / B testing and gray release, fault isolation and fault tolerance processing, dynamic requests and personalized customization, monitoring and statistical analysis, and custom services.
[0057] Thus, the embodiments of the present invention can achieve the following beneficial effects:
[0058] 1) Precise control of message information (i.e., colored traffic): By performing dynamic instrumentation operations in the gateway, precise coloring of traffic can be achieved. This solution can mark and process specific traffic according to predefined coloring rules and conditions to meet personalized traffic control and processing requirements.
[0059] 2) Real-time coloring operation: This solution can perform coloring operations in real-time traffic to ensure immediate processing of traffic. Through dynamic instrumentation, traffic can be immediately colored when it passes through the gateway, marking and processing the traffic in real-time to meet real-time requirements.
[0060] 3) Flexibility and customization: The dynamic instrumentation gateway traffic coloring solution has high flexibility and customization. Dynamic instrumentation code and coloring operations can be customized according to specific business requirements and coloring rules to meet personalized needs in different scenarios and improve the scalability and adaptability of the system.
[0061] As Figure 2 shown, the embodiments of the present invention provide a method for processing message information, and the method may include the following steps:
[0062] Step S201: Obtain message information and extract coloring features from the message information.
[0063] Step S202: Search for one or more coloring strategies that match the coloring features, where one or more of the coloring strategies are assembled based on externally input configuration item information; update the message information using the coloring identifier included in the coloring strategy.
[0064] Step S203: Based on the correspondence between the coloring identifiers and the processing end information included in the coloring strategy, distribute the updated message information to the corresponding processing end.
[0065] Specifically, the descriptions of the steps of searching for the coloring strategy, performing coloring, and performing distribution according to the coloring strategy are the same as those in steps S101 - S103, and will not be elaborated here.
[0066] Step S204: Generate log information for the process of distributing the updated message information to the corresponding processing end; based on multiple pieces of log information, analyze the evaluation data of the coloring process of the gateway for multiple message information; optimize the coloring strategy according to the evaluation data.
[0067] Preferably, in the embodiments of the present invention, the coloring effect of the coloring process is evaluated to further optimize the coloring strategy. Specifically, the step of distributing the updated message information to the corresponding processing end based on the correspondence between the coloring identifiers and the processing end information included in the coloring strategy further includes: generating log information for the process of distributing the updated message information to the corresponding processing end; based on multiple pieces of log information, analyze the evaluation data of the coloring process of the gateway for multiple message information; optimize the coloring strategy according to the evaluation data. Among them, the evaluation data includes the effect and performance of message information coloring, that is, by establishing a monitoring and tuning mechanism, monitor and analyze the colored traffic. Use technical means such as log analysis and metric monitoring to evaluate the distribution effect and performance of the colored traffic. According to the monitoring results, make necessary adjustments and improvements to optimize the processing and distribution strategy of the colored traffic. Further, the security of the traffic coloring scheme can also be considered, and security measures such as encryption and signature are used to protect the credibility and integrity of the coloring identifier field, preventing the coloring identifier field from being tampered with or forged. Conduct security audits and access controls on the gateway to prevent unauthorized message information from performing coloring operations. Through the embodiments of the present invention, the traceability and monitorability of the coloring process for message information are improved: by performing coloring operations, coloring information can be added to the traffic, enabling subsequent traffic processing and analysis to trace the coloring information. This helps with tasks such as traffic monitoring, fault troubleshooting, and security control, improving the traceability and monitorability of the system.
[0068] As Figure 3 shown, the embodiments of the present invention provide a method for processing message information, and the method may include the following steps;
[0069] The gateway 301 receives message information (message information 1 to message information n) sent by multiple clients or servers. The gateway obtains the message information, extracts a coloring feature from the message information; searches for one or more coloring strategies that match the coloring feature, where one or more of the coloring strategies are assembled based on externally input configuration item information; updates the message information using the coloring identifier included in the coloring strategy; and distributes the updated message information to the corresponding processing end 302 (processing end 1 to processing end n) based on the correspondence between the coloring identifier included in the coloring strategy and the processing end information.
[0070] As Figure 4 shown, an embodiment of the present invention provides an apparatus 400 for processing message information, including: a message obtaining module 401, a message coloring module 402, and a message distributing module 403; where
[0071] The message obtaining module 401 is configured to obtain message information and extract a coloring feature from the message information;
[0072] The message coloring module 402 is configured to search for one or more coloring strategies that match the coloring feature, where one or more of the coloring strategies are assembled based on externally input configuration item information; and update the message information using the coloring identifier included in the coloring strategy;
[0073] The message distributing module 403 is configured to distribute the updated message information to the corresponding processing end based on the correspondence between the coloring identifier included in the coloring strategy and the processing end information
[0074] An embodiment of the present invention further provides an electronic device for processing message information, including: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.
[0075] An embodiment of the present invention further provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method provided in any of the above embodiments is implemented.
[0076] Figure 5 An exemplary system architecture 500 to which the method for processing message information or the apparatus for processing message information according to the embodiments of the present invention can be applied is shown.
[0077] As Figure 5As shown, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves as a medium for providing communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0078] Users can use the terminal devices 501, 502, 503 to interact with the server 505 via the network 504 to receive or send messages, etc. Various client applications may be installed on the terminal devices 501, 502, 503, such as e-commerce client applications, web browser applications, search applications, instant messaging tools, and email clients, etc.
[0079] The terminal devices 501, 502, 503 can be various electronic devices with a display screen and supporting various client applications, including but not limited to smartphones, tablets, laptop computers, and desktop computers, etc.
[0080] The server 505 can be a server that provides various services (such as a gateway or a backend processing server). The gateway server can receive the message information sent by the terminal for coloring processing, and distribute the message information to the corresponding backend server according to the coloring processing result. The backend server feeds back the response data after processing the message information to the terminal device.
[0081] It should be noted that the method for processing message information provided by the embodiments of the present invention is generally executed by the server 505. Correspondingly, the device for processing message information is generally arranged in the server 505.
[0082] It should be understood that Figure 5 the numbers of terminal devices, networks, and servers in
[0083] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 6 Figure 6 The terminal device shown is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0084] Figure 6 As shown in Figure 6As shown, computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0085] The following components are connected to the I / O 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 LAN 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 I / O 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 from it can be installed into the storage section 608 as needed.
[0086] Specifically, according to an embodiment disclosed by the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment disclosed by the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above functions defined in the system of the present invention are executed.
[0087] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the above two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0088] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram can represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks can occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0089] The modules and / or units involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules and / or units can also be provided in a processor. For example, it can be described as: a processor includes a packet acquisition module, a packet coloring module, and a packet distribution module. Among them, the names of these modules do not constitute a limitation to the module itself in some cases. For example, the packet acquisition module can also be described as "a module for acquiring packet information and extracting coloring features".
[0090] As another aspect, the present invention also provides a computer-readable medium, which can be included in the device described in the above embodiments; or can exist separately without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the device, the device includes: acquiring packet information, extracting coloring features from the packet information; finding one or more coloring strategies that match the coloring features, where the one or more coloring strategies are assembled based on externally input configuration item information; updating the packet information using the coloring identifiers included in the coloring strategies; and distributing the updated packet information to the corresponding processing end based on the correspondence between the coloring identifiers included in the coloring strategies and the processing end information.
[0091] The embodiments of the present invention can use a gateway to acquire packet information and extract coloring features, find a coloring strategy that matches the coloring features, and update the packet information using the coloring identifiers included in the coloring strategy (coloring operation); and based on the correspondence between the coloring identifiers and the processing end information, distribute the updated packet information to the corresponding processing end. The embodiments of the present invention improve the flexibility and scalability of processing packet information and the real-time performance and efficiency of distributing packet information through dynamic configuration of coloring strategies and dynamic coloring operations on packet information.
[0092] The above specific implementation manners do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for processing message information, applied to a gateway, characterized in that Including: Obtain message information and extract a coloring feature from the message information; Search for one or more coloring strategies that match the coloring feature; wherein, one or more of the coloring strategies are assembled based on externally input configuration item information; Update the message information using the coloring identifier included in the coloring strategy; Based on the correspondence between the coloring identifier included in the coloring strategy and the processing end information, distribute the updated message information to the corresponding processing end.
2. The method according to claim 1, wherein The gateway is configured with an interception component; The obtaining of the message information includes: Intercept the message information received by the gateway through the interception component.
3. The method according to claim 1, wherein Further including: Receive a configuration request or a change request for the coloring strategy; Provide a plurality of configuration items and obtain configuration item information corresponding to the plurality of configuration items; wherein, the configuration item information indicates a target coloring feature to be configured, a target coloring identifier corresponding to the configured target coloring feature, processing end information, and an identifier position; Assemble the target coloring feature to be configured indicated by the configuration item information, the target coloring identifier corresponding to the configured target coloring feature, the processing end information, and the identifier position to obtain one or more of the coloring strategies.
4. The method according to claim 1, characterized in that, The updating of the message information using the coloring identifier included in one or more coloring strategies includes: Obtain the coloring identifier included in one or more coloring strategies; Using dynamic instrumentation technology, update the message information based on the coloring identifier; wherein, the dynamic instrumentation technology includes one or more of dynamic proxy, aspect-oriented programming, and bytecode operation.
5. The method according to claim 3, characterized in that, The updating of the message information using the coloring identifier included in one or more coloring strategies includes: Determine the identifier position of the coloring identifier in the message information according to the coloring strategy; wherein, the identifier position is one or more of a request header, message-carrying text, and a request body; Update the coloring identifier included in the plurality of coloring strategies to the corresponding identifier position of the message information.
6. The method according to claim 1, wherein The distributing of the updated message information to the corresponding processing end based on the correspondence between the coloring identifier included in the coloring strategy and the processing end information includes: According to the correspondence between the coloring identifier included in the coloring strategy and the processing end information, distribute the updated message information to one or more processing ends corresponding to the coloring identifier, wherein the distribution strategy includes one or more of round-robin, weighted round-robin, and custom distribution strategy based on load balancing technology.
7. The method according to claim 1, wherein The distributing of the updated message information to the corresponding processing end based on the correspondence between the coloring identifier included in the coloring strategy and the processing end information further includes: Generate log information for the process of distributing the updated message information to the corresponding processing end; Analyze the evaluation data of the coloring processing of the gateway for a plurality of message information based on a plurality of log information; Optimize the coloring strategy according to the evaluation data.
8. A device for processing message information, characterized in that Applied to a gateway, including: a message obtaining module, a message coloring module, and a message distributing module; wherein, The message obtaining module is used to obtain message information and extract a coloring feature from the message information; The message coloring module is used to find one or more coloring strategies that match the coloring features; wherein, one or more of the coloring strategies are assembled based on the configuration item information input externally; update the message information by using the coloring identifiers included in the coloring strategies; The message distribution module is used to distribute the updated message information to the corresponding processing end based on the correspondence between the coloring identifiers included in the coloring strategies and the processing end information.
9. An electronic device, characterized in that, Comprising: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-7.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, the method according to any one of claims 1-7 is implemented.