Data packet analysis method, device, equipment, storage medium and product
By using delimiters and multi-threaded parsing techniques in the network order data, the problems of transmission delay and server performance bottleneck in large-scale order data messages were solved, achieving fast transmission and efficient parsing.
Patent Information
- Application Number
- CN202411573558.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-11-05
AI Technical Summary
In the ordering of computing network services, a single order may contain a large number of sub-orders, which leads to message transmission delays and server performance bottlenecks. Existing technologies cannot quickly transmit and fully parse large-scale order data messages.
By receiving order data from the computing network, the sub-order data is divided into assembled data messages using delimiters, data nodes that do not contain subordinate nodes are converted into parameter values, data objects are parsed using a multi-threaded approach, and read and process data using preset message parsing configurations.
It reduced the size of data packets, improved packet parsing efficiency, reduced resource consumption, and significantly reduced order processing time.
Smart Images

Figure CN119316499B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular to a data message parsing method, apparatus, device, storage medium, and computer program product. Background Technology
[0002] In network service ordering, it is common for a single order to contain a large number of sub-orders. Each sub-order also contains numerous product attributes and quantity attributes. Furthermore, each sub-order derives nodes at different levels, and each node contains data packets. This makes the transmission and parsing of the order's packets more demanding than traditional packets. If the order quantity is very large, transmission will significantly increase network latency, leading to a degraded user experience. In addition, the processing and parsing of large packets will consume a large amount of CPU and memory resources, potentially causing server performance bottlenecks.
[0003] Therefore, how to quickly transmit and fully parse such ever-expanding messages is a challenge faced by those skilled in the art.
[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this application is to provide a data packet parsing method, apparatus, device, storage medium, and computer program product, aiming to solve the technical problem in the related art that a single order transaction may contain a large number of product attributes, making the requirements for the transmission and parsing of the order-related packets higher than those of previous packets, thus making it impossible to achieve fast transmission and complete parsing of order data packets.
[0006] To achieve the above objectives, this application proposes a data packet parsing method, which includes:
[0007] Receive computing network order data, wherein the computing network order data includes multiple sub-order data, and the sub-order data includes multiple data nodes;
[0008] Based on each of the data nodes, the sub-order data is divided by a delimiter to obtain an assembly data message, wherein data nodes that do not contain subordinate nodes in the assembly data message are converted into node parameter values;
[0009] The assembled data message is read and processed by a preset message parsing configuration. After reading, the data objects in the network order data are parsed in a multi-threaded manner.
[0010] In one embodiment, the step of dividing the sub-order data based on each data node using a delimiter to obtain an assembled data message includes:
[0011] Determine whether any subordinate nodes exist in the data nodes of each sub-order data;
[0012] If it is determined that the data node does not have any subordinate nodes, then the data in the data node is compressed into node parameter values;
[0013] If it is determined that the data node has a subordinate node, then the data tag of the data node is saved;
[0014] The data tags and node parameter values are integrated using a delimiter to obtain an assembled data message.
[0015] In one embodiment, the step of reading and processing the assembled data packet through a preset message parsing configuration includes:
[0016] The assembled message data is read segment by segment using a streaming processing method to determine the subordinate order of each data node in the assembled data message;
[0017] For data nodes with subordinate nodes, the data content in each data node is read sequentially according to the subordinate order relationship and data tags;
[0018] For data nodes that do not have subordinate nodes, the node parameter values corresponding to the data node are written into a preset algorithm instance to obtain the data content in the data node.
[0019] In one embodiment, the step of parsing the data objects in the network order data in a multi-threaded manner includes:
[0020] Data is read synchronously from each data node using a multi-threaded approach to obtain data for multiple subtasks.
[0021] The data from each of the subtasks is placed in an independent task for parsing to obtain the parsed data;
[0022] For each data node, the parsed data is written to the instance object of the parent node corresponding to the current node.
[0023] In one embodiment, the data nodes include parameter value nodes and no parameter value nodes. The step of writing the parsed data to the instance object of the parent node corresponding to the current node for each data node includes:
[0024] For parameter value nodes, after the data parsing processing of all parameter value nodes is completed, the parsed data of the parameter value nodes that currently have no subordinate nodes are integrated to obtain a parsed data set;
[0025] Write the parsed data set into the instance object of the parent node;
[0026] For nodes without parameter values, the delimiter is used to segment the nodes without parameter values to obtain multiple first parameter values;
[0027] Write the first parameter value to the instance object of the first node to which the current node belongs.
[0028] In one embodiment, the preset message parsing configuration includes multiple configuration fields, including interface name, data node attributes, and current node processing method. The configuration fields are used to synchronously read or parse the data content of each separated data node.
[0029] Furthermore, to achieve the above objectives, this application also proposes a data packet parsing apparatus, which includes:
[0030] The receiving module is used to receive computing network order data, which includes multiple sub-order data and multiple data nodes.
[0031] The partitioning module is used to partition each of the sub-order data based on each of the data nodes using a delimiter to obtain an assembly data message, wherein data nodes in the assembly data message that do not contain subordinate nodes are converted into node parameter values;
[0032] The processing module is used to read and process the assembled data message through a preset message parsing configuration, and after reading, parse the data objects in the computing network order data in a multi-threaded manner.
[0033] In addition, to achieve the above objectives, this application also proposes a data packet parsing device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the data packet parsing method described above.
[0034] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the data packet parsing method described above.
[0035] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the data packet parsing method described above.
[0036] This application proposes a data packet parsing method, apparatus, device, storage medium, and computer program product. This application receives network order data, which includes multiple sub-order data and multiple data nodes. Data nodes without subordinate nodes are converted into parameter values, reducing the size of the transmitted data packets. This allows for a streamlined packet structure and compressed data volume through packet reassembly. The assembled data packets are then read and processed using a preset packet parsing configuration. After reading, data objects in the network order data are parsed using a multi-threaded approach. This approach improves packet parsing efficiency and reduces resource consumption while effectively parsing the data packets, significantly reducing order processing time. Attached Figure Description
[0037] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0038] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 This is a flowchart illustrating an embodiment of the data packet parsing method of this application.
[0040] Figure 2 This is a schematic diagram illustrating the order message flow and processing procedure involved in the data message parsing method of this application;
[0041] Figure 3 This is a schematic diagram of the XML message structure provided in the data message parsing method of this application;
[0042] Figure 4 This is a schematic diagram illustrating the structure of the data packet assembled using the data packet parsing method of this application;
[0043] Figure 5 This is a schematic diagram of the preset message parsing configuration fields involved in the data message parsing method of this application;
[0044] Figure 6 This is a flowchart illustrating Embodiment 2 of the data packet parsing method of this application.
[0045] Figure 7 This is a schematic diagram illustrating the message parsing process involved in the data message parsing method of this application;
[0046] Figure 8 This is a schematic diagram of the parsed message structure involved in the data message parsing method of this application;
[0047] Figure 9 This is a schematic diagram of the module structure of the data packet parsing device according to an embodiment of this application;
[0048] Figure 10 This is a schematic diagram of the device structure of the hardware operating environment involved in the data packet parsing method in the embodiments of this application.
[0049] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0050] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0051] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0052] The main solution in this application embodiment is:
[0053] Receive computing network order data, wherein the computing network order data includes multiple sub-order data, and the sub-order data includes multiple data nodes;
[0054] Based on each of the data nodes, the sub-order data is divided by a delimiter to obtain an assembly data message, wherein data nodes that do not contain subordinate nodes in the assembly data message are converted into node parameter values;
[0055] The assembled data message is read and processed by a preset message parsing configuration. After reading, the data objects in the network order data are parsed in a multi-threaded manner.
[0056] In existing ordering systems, one system typically assembles order data into an XML (Extensible Markup Language) message and calls other systems' service interfaces via HTTP (Hypertext Transfer Protocol) or HTTPS. Normally, the order message data volume is not large, and this method of interaction is sufficient. However, for network-based combined ordering, a single message often contains hundreds of sub-order data, and each sub-order has a considerable number of product attributes and quantity attributes. Continuing with the existing method would slow down order data transmission. Due to its structural characteristics, XML messages contain numerous tags to express hierarchical relationships and attribute information. As the number of sub-orders and the complexity of attributes increase, the size of the XML message also increases, requiring more time and bandwidth resources during network transmission. This is because XML messages are not effectively compressed before transmission, and coupled with network latency and bandwidth limitations, data transmission speed is naturally affected. Therefore, for large-scale order processing technologies on the network, the only option is to write the data to a file and synchronize the file to other platforms. This approach is very unfriendly to customers, and existing technologies would face significant challenges in parsing the messages. For customers, asynchronously processing large-scale orders using file synchronization leads to noticeable latency. Order data is first written to a file and then synchronized to other platforms for processing, rather than responding in real-time. This undoubtedly increases waiting time and degrades the customer experience. Furthermore, when the server receives and parses such large XML messages, the numerous tags and complex hierarchical structure require traversing the entire XML tree structure, consuming significant CPU and memory resources. This results in low parsing efficiency and can easily cause server performance bottlenecks. This is why current technologies face immense pressure when parsing large-scale network order messages.
[0057] This application proposes a data packet parsing method, apparatus, device, storage medium, and computer program product. This application receives network order data, which includes multiple sub-order data and multiple data nodes. Data nodes without subordinate nodes are converted into parameter values, reducing the size of the transmitted data packets. This allows for a streamlined packet structure and compressed data volume through packet reassembly. The assembled data packets are then read and processed using a preset packet parsing configuration. After reading, data objects in the network order data are parsed using a multi-threaded approach. This approach improves packet parsing efficiency and reduces resource consumption while effectively parsing the data packets, significantly reducing order processing time.
[0058] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device, ordering platform, or data packet parsing device capable of performing the above functions. The following description uses a data packet parsing device as an example to illustrate this embodiment and the subsequent embodiments.
[0059] Based on this, embodiments of this application provide a data packet parsing method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the data message parsing method of this application.
[0060] In this embodiment, the data packet parsing method includes steps S10 to S30:
[0061] Step S10: Receive computing network order data, wherein the computing network order data includes multiple sub-order data, and the sub-order data includes multiple data nodes;
[0062] It should be noted that the computing network is a new type of information infrastructure that is centered on computing and based on the network, deeply integrating network, cloud, data, intelligence, security, edge, terminal, and blockchain to provide integrated services. Various order data can be processed on the computing network. The order data on the computing network includes multiple types of data such as product data and product attributes. During transmission, the order data on the computing network contains a large amount of information and data packets.
[0063] Specifically, the order message flow and processing procedure involved in this embodiment is as follows: Figure 2 As shown, by Figure 2 As can be seen, the order placement process takes place on the front end. The order system receives the order data from the computing network and assembles the data message to obtain the assembled data message. Then, the assembled data message is transmitted to the ordering platform for parsing. The parsing process mainly uses the parsing configuration interface to parse the data in multiple threads and encapsulates the parsed data into an instance object for subsequent use.
[0064] It should be noted that the entire network order data is divided into multiple sub-order data because it contains various types of information. For each sub-order data, there are also multiple different data nodes to store the data. Figure 3For example, considering the data nodes at each level, in the hierarchical structure of the interface specification, ProvInfo (a file containing various data types, generally used as the initial node) is a first-level node. There are usually multiple first-level nodes, each ProvInfo representing a sub-order. A first-level node can have multiple second-level nodes, such as AccountInfo (account information) and ProductInfo (product information). Second-level nodes can have the same or different tag names. If multiple second-level nodes have the same tag name, they are considered parallel; otherwise, they are not.
[0065] Each second-level node can further contain third-level nodes, such as SubProductInfo (sub-product information). Third-level nodes belong to their respective second-level nodes; that is, SubProductInfo belongs to ProductInfo. Similarly, third-level nodes can have the same or different tag names. If multiple third-level nodes have the same tag name, they are considered parallel; otherwise, they are not. This process continues, with each node capable of deriving multiple child nodes, and nodes at the same level can have multiple identical or different tag names, forming a parallel relationship.
[0066] It should be noted that in the above example, each parent node, which is the next level node, can continuously derive child nodes downwards, and each child node can also continuously derive further child nodes downwards, and this derivation relationship can be infinitely looped.
[0067] Step S20: Based on each data node, the sub-order data is divided by a delimiter to obtain an assembly data message, wherein data nodes that do not contain subordinate nodes in the assembly data message are converted into node parameter values;
[0068] It should be noted that existing data messages contain data tags for multiple nodes. Typically, XML messages have a start tag (such as...). <provinfo> ) and an ending tag (such as< / provinfo> When other elements are contained within the ProvInfo tag (which represents system status information, such as start / end status), they become child elements of ProvInfo. This structure can clearly represent the hierarchy of data, but the number of tag names is often very large, which makes the message size very large.
[0069] To reduce message size, in this embodiment, most tags in each sub-order data are ignored, and only tags with child nodes are retained. For child nodes without a next-level node or data nodes without subordinate nodes, only parameter values are retained, which can greatly reduce message size.
[0070] It should be noted that the assembled data packet is a data packet obtained by merging the labels of each node after data conversion. Compared with ordinary data packets, the assembled data packet is smaller in size and consumes less network resources during data transmission.
[0071] It should be noted that the delimiter in the data message mainly serves to separate the data so that the range of each parameter value can be clearly distinguished during the subsequent parsing process, making it easier to identify.
[0072] Specifically, taking the above XML message as an example, firstly, the first-level node is retained. <provinfo>, since the secondary node <AccountId (account label)> has no lower-level nodes, only the parameter value, i.e., "account code", is retained, and the secondary node <productinfo>Include a third-level node <SubProductInfo (sub-product information)>, and the third-level node <subproductinfo>Include the four-level nodes <ProductOrderID (Product Order Label)> and <FeeInfo (Fee Information)>, so this three-level node is retained, and the four-level nodes <productorderid>Since there are no child nodes, only the parameter value, i.e., "order code," is retained, and so on, until the data is fully assembled. In addition, when multiple child tags without next-level nodes are adjacent, they are separated by [|] (separator). This clearly distinguishes the range of parameter values and makes them easy to identify during parsing.
[0073] It is important to understand that the structural diagram for assembling a data packet is as follows: Figure 4 As shown, data nodes without a next-level node are displayed as parameter values, while other data nodes retain their corresponding data tags. The format of the assembled data message in this application needs to be used in conjunction with the preset parsing configuration interface. The content of the message is assembled according to the node order of the interface specification. Each parameter value corresponds to a node in the interface specification. The content of the message cannot be read when viewed alone, but the resulting lightweight design is well utilized.
[0074] In one feasible implementation, step S20, which involves dividing the sub-order data based on each data node using a delimiter to obtain the assembled data message, includes:
[0075] Determine whether any subordinate nodes exist in the data nodes of each sub-order data;
[0076] It should be noted that in the process of dividing the data of each sub-order, it is necessary to first determine whether there are subordinate nodes in the data nodes of the sub-order data. Subordinate nodes are the next level nodes, and different division steps are performed according to different situations.
[0077] If it is determined that the data node does not have any subordinate nodes, then the data in the data node is compressed into node parameter values;
[0078] It should be noted that when it is determined that there is no data node in the current data node, the data in the data node is compressed and stored as parameter values in the data packet to reduce the size of the data packet.
[0079] If it is determined that the data node has a subordinate node, then the data tag of the data node is saved;
[0080] It should be noted that when it is determined that a data node has slave nodes, and the data node contains a large amount of data, the label of the data node is retained to ensure normal data storage. Similar operations are performed on other data nodes with slave nodes.
[0081] The data tags and node parameter values are integrated using a delimiter to obtain an assembled data message.
[0082] It should be noted that the data tags and node parameter values are separated by delimiters to facilitate the subsequent parsing process, and then the various data nodes are assembled together to obtain the assembled data message.
[0083] Step S30: The assembled data message is read and processed through a preset message parsing configuration. After reading, the data objects in the network order data are parsed in a multi-threaded manner.
[0084] It should be noted that the preset message parsing configuration corresponds to the assembly specification of the assembled data message, which includes a variety of configuration fields. By receiving the assembled data message through the preset message parsing configuration interface, information can be extracted from each data node in the assembled data message through each configuration field, so as to achieve the purpose of fast transmission.
[0085] In one feasible implementation, step S30, which involves reading and processing the assembled data packet using a preset message parsing configuration, includes:
[0086] The assembled message data is read segment by segment using a streaming processing method to determine the subordinate order of each data node in the assembled data message;
[0087] It should be noted that during the reading process, the ordering service platform interface service framework, upon receiving the request message, employs the SAX parsing mechanism (Simple API for XML, an event-driven parsing method) to read and parse the message content segment by segment in real time using a streaming processing approach. During this process, the system cleverly synchronizes the reading and parsing tasks, while simultaneously leveraging a pre-defined JavaBean object system (a Java class instance that follows specific coding standards, primarily used to encapsulate data, provide business logic, and facilitate code reuse and decoupling) to instantly capture and store key data for each node within the message, covering diverse information such as node name, attribute details, and parameter values. This customized data model is specifically designed to address the potentially deep nested structures within the message, ensuring accurate and efficient carrying and reproduction of the hierarchical relationships within the message. This embodiment, by decomposing the parsing process into several continuous, collaborative steps, fully utilizes the read-and-parse working mode, significantly improving the execution efficiency of message parsing, thereby powerfully promoting the rapid and efficient achievement of post-parsing data storage operations.
[0088] It should be noted that due to the hierarchical relationship between data nodes, they will also be at different levels. At different levels, the hierarchical order will be different. For example, if A is a first-level node and B is a second-level node, then A's order will be higher than B's.
[0089] For data nodes with subordinate nodes, the data content in each data node is read sequentially according to the subordinate order relationship and data tags;
[0090] It should be noted that for data nodes with subordinate nodes, the data tags of each data node are retained according to the order of different levels, and the data content in each data node is read sequentially according to the hierarchical relationship from primary to secondary.
[0091] For data nodes that do not have subordinate nodes, the node parameter values corresponding to the data node are written into a preset algorithm instance to obtain the data content in the data node.
[0092] It should be noted that for data nodes without subordinate nodes, these data nodes have been converted into node parameter values. The preset algorithm instance is a JavaBean object in the preset message parsing configuration. By writing the node parameter values into the preset algorithm instance, all data nodes without subordinate nodes / without descendants under the first node can be parsed.
[0093] In one feasible implementation, the preset message parsing configuration includes multiple configuration fields, including interface name, data node attributes, and current node processing method. The configuration fields are used to synchronously read or parse the data content of each separated data node.
[0094] It should be noted that the preset message parsing configuration includes various configuration fields, which will be loaded when the subscription platform interface service starts. Figure 5 The interface parsing message configuration is shown, and based on the bean_map (an application interface for manipulating JavaBeans, which can convert JavaBean objects into Map objects (objects that map keys to values)) information in the configuration, a certain number of JavaBean objects are pre-created and managed.
[0095] Depend on Figure 5 Therefore, the descriptions of each configuration field are as follows:
[0096] interface_name: Interface name;
[0097] field: Node name;
[0098] field_level: Node level;
[0099] is_child_nodes: Whether there are descendants, 0 - no, 1 - yes;
[0100] is_mult_thread: Whether multi-threaded processing is used, 0-no, 1-yes;
[0101] is_same: Whether there are identical nodes, 0-no, 1-yes;
[0102] bean_map: Parent node JavaBean object (algorithm instance object).
[0103] This application proposes a data packet parsing method, apparatus, device, storage medium, and computer program product. This application receives network order data, which includes multiple sub-order data and multiple data nodes. Data nodes without subordinate nodes are converted into parameter values, reducing the size of the transmitted data packets. This allows for a streamlined packet structure and compressed data volume through packet reassembly. The assembled data packets are then read and processed using a preset packet parsing configuration. After reading, data objects in the network order data are parsed using a multi-threaded approach. This approach improves packet parsing efficiency and reduces resource consumption while effectively parsing the data packets, significantly reducing order processing time.
[0104] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 6 The step S30, which parses the data objects in the computer network order data in a multi-threaded manner, includes steps S31 to S33:
[0105] Step S31: Synchronously read data from each data node using a multi-threaded approach to obtain multiple subtask data.
[0106] Step S32: Place the data of each subtask into an independent task for parsing to obtain parsed data;
[0107] It should be noted that each data node may contain hundreds of data entries. For example, the value of is_mult_thread for node SubProductInfo in the default message parsing configuration is 1, indicating that multi-threaded processing is required. <subproductinfo>The node can contain hundreds of data entries. Using multi-threaded processing will reduce the time spent parsing the message. After a complete SubProductInfo data entry is read from the message, it is immediately put into a separate task for parsing. This process is repeated until all SubProductInfo entries are put into separate tasks. After parsing is completed in the separate tasks, the parsed and processed data is obtained.
[0108] It should be noted that after each task parses the SubProductInfo, it returns a com.newland.crm.cmc.bean.order.SubProductInfoBean object (a type of bean-map object used to represent subproduct information objects, as will be discussed below), and writes this object into a List collection. This process continues until all data has been processed, at which point the collection is written into the com.newland.crm.cmc.bean.order.ProvInfoBean object of the parent node (the starting node object). This is the logic of multi-threaded processing.
[0109] Step S33: For each data node, write the parsed data into the instance object of the parent node corresponding to the current node.
[0110] It should be noted that the key innovation of this application involves: regarding the large message structure involved in this proposal, it is based on the existing... Figure 7 Based on the XML message format shown, all tag names without descendants and closing tags with descendants have been omitted, resulting in the following: Figure 8 The message structure shown is required. Therefore, a structure configuration needs to be provided according to the interface specification. This configuration can easily display the hierarchical relationship and subordinate relationship of the messages. In fact, the preset message analysis configuration is the key to parsing the messages.
[0111] It should be noted that when processing SubProductInfo in a multi-threaded, independent task, the next-level node without descendants is also retrieved, for example, ProductOrderID. The corresponding parameter in the message is order code 1 (e.g., Figure 8 As shown in the figure, after parsing the parameter value of ProductOrderID, the data is written into the parent node com.newland.crm.cmc.bean.order.SubProductInfoBean object.
[0112] In one feasible implementation, the data nodes include parameter value nodes and parameterless value nodes. Step S33, for each data node, writing the parsed data to the instance object of the parent node corresponding to the current node, includes:
[0113] For parameter value nodes, after the data parsing processing of all parameter value nodes is completed, the parsed data of the parameter value nodes that currently have no subordinate nodes are integrated to obtain a parsed data set;
[0114] It should be noted that a parameter value node is a data node that contains data. Parameter value nodes include data nodes that retain data labels and data nodes without subordinate nodes. A node without parameter values is a data node that does not contain data.
[0115] Write the parsed data set into the instance object of the parent node;
[0116] It should be noted that after obtaining the parsed data set, the parsed data set is written to the instance object of the parent node.
[0117] It should be noted that, as shown in the preset message parsing configuration field, the processing method is different from that of data nodes that retain data tags. For data nodes without subordinate nodes, the configuration can distinguish that there are two no-descendant nodes PaySeq (payment transaction record) and PayType (payment method) under this node, and there is no other data afterward. After reading all the no-descendant node strings, they are split according to the delimiter [|]. The first part of the delimiter is the parameter value of PaySeq, and the second part of the delimiter is the parameter value of PayType. The parameter values are written into the com.newland.crm.cmc.bean.order.ExtendInfoBean object (extended information object) in the bean_map field.
[0118] For nodes without parameter values, the delimiter is used to segment the nodes without parameter values to obtain multiple first parameter values;
[0119] Write the first parameter value to the instance object of the first node to which the current node belongs.
[0120] It should be noted that the first parameter value is the parameter value representing the empty data obtained after splitting.
[0121] Specifically, in addition, there is a case without parameter values, for example, such as Figure 8 Nodes in <extendinfo>The only parameter value is "Payment Method 1". This node has two descendants. When assembling the message, the [|] separator is used for separation. After the data is obtained and parsed, it is split according to the [|] separator. The data will be split into 'empty' and 'Payment Method 1' and put into an array. The data in array 0 is the node. <payseq>The parameter value is obviously 'empty', and the data in array 1 is the node. <paytype>The parameter value. In other words, when parsing the request message according to the node configuration, if a node with no descendants appears in the configuration, its data will be split using the delimiter [|]. The empty data after splitting also represents the parameter value of a node.
[0122] After all the data for the sub-order has been parsed, the processed JavaBean objects are written to the parent node's JavaBean objects sequentially from the deepest level upwards. For example, ExtendInfoBean (extended information object) is written to the parent node's FeeInfoBean (payment information object), and FeeInfoBean is written to the parent node's SubProductInfoBean (sub-product information object). Finally, the request message is parsed into ProvInfoBean (status information) objects, and these objects are used as parameters for the API service. This way, the API service only needs to retrieve the data from the JavaBean objects when processing its logic, which not only increases the efficiency of request message parsing but also makes data manipulation more convenient and easier.
[0123] In this embodiment, multiple sub-orders are parsed in parallel by asynchronous parallel processing and multi-threading technology, which improves message parsing efficiency and reduces resource consumption, significantly reducing order processing time.
[0124] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the data packet parsing method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0125] This application also provides a data packet parsing apparatus; please refer to... Figure 9 The data packet parsing device includes:
[0126] The receiving module 10 is used to receive computing network order data, which includes multiple sub-order data and multiple data nodes in each sub-order data.
[0127] The partitioning module 20 is used to partition each of the sub-order data based on each of the data nodes using a delimiter to obtain an assembly data message, wherein data nodes in the assembly data message that do not contain subordinate nodes are converted into node parameter values;
[0128] The processing module 30 is used to read and process the assembled data message through a preset message parsing configuration, and after reading, parses the data objects in the computing network order data in a multi-threaded manner.
[0129] Optionally, the partitioning module includes:
[0130] The judgment unit is used to determine whether there is a subordinate node in the data node of each sub-order data;
[0131] A compression processing unit is used to compress the data in the data node into node parameter values if it is determined that the data node does not have any subordinate nodes.
[0132] A data storage processing unit is used to save the data tag of the data node if it is determined that the data node has a subordinate node;
[0133] The integration processing unit is used to integrate the data tags and node parameter values using delimiters to obtain an assembled data message.
[0134] Optionally, the processing module includes:
[0135] The first reading unit is used to read the assembled message data segment by segment through streaming processing to determine the subordinate order of each data node in the assembled data message.
[0136] The second reading unit is used to read the data content of each data node in turn according to the subordinate order relationship and the data tag for data nodes with subordinate nodes;
[0137] The first writing unit is used to write the node parameter value corresponding to the data node into a preset algorithm instance for a data node that does not have a subordinate node, so as to obtain the data content in the data node.
[0138] Optionally, the processing module includes:
[0139] The third reading unit is used to synchronously read data from each data node in a multi-threaded manner to obtain multiple subtask data.
[0140] The parsing unit is used to place the data of each subtask into an independent task for parsing to obtain parsed data;
[0141] The second writing unit is used to write the parsed data of each data node to the instance object of the parent node corresponding to the current node.
[0142] Optionally, the second writing unit includes:
[0143] The integration subunit is used to integrate the parsed data of the parameter value nodes that currently have no subordinate nodes after the data parsing processing of all parameter value nodes is completed, to obtain a parsed data set;
[0144] The first writing sub-unit is used to write the parsed data set into the instance object of the parent node;
[0145] A segmentation subunit is used to segment a node without a parameter value using the delimiter to obtain multiple first parameter values;
[0146] The second write subunit is used to write the first parameter value to the instance object of the first node to which the current node belongs.
[0147] The data packet parsing apparatus provided in this application, employing the data packet parsing method described in the above embodiments, can solve the technical problem of data packet parsing. Compared with the prior art, the beneficial effects of the data packet parsing apparatus provided in this application are the same as those of the data packet parsing method described in the above embodiments, and other technical features in the data packet parsing apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0148] This application provides a data packet parsing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the data packet parsing method in Embodiment 1 above.
[0149] The following is for reference. Figure 10 The diagram illustrates a structural schematic of a data packet parsing device suitable for implementing embodiments of this application. The data packet parsing device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 10 The data packet parsing device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0150] like Figure 10 As shown, the data packet parsing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the data packet parsing device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the data packet parsing device to communicate wirelessly or wiredly with other devices to exchange data. Although data packet parsing devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0151] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0152] The data packet parsing device provided in this application, employing the data packet parsing method described in the above embodiments, can solve the technical problem of data packet parsing. Compared with the prior art, the beneficial effects of the data packet parsing device provided in this application are the same as those of the data packet parsing method provided in the above embodiments, and other technical features of this data packet parsing device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.
[0153] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0154] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0155] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the data packet parsing method described in the above embodiments.
[0156] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0157] The aforementioned computer-readable storage medium may be included in the data packet parsing device; or it may exist independently and not be assembled into the data packet parsing device.
[0158] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by a data packet parsing device, cause the data packet parsing device to:
[0159] Receive computing network order data, wherein the computing network order data includes multiple sub-order data, and the sub-order data includes multiple data nodes;
[0160] Based on each of the data nodes, the sub-order data is divided by a delimiter to obtain an assembly data message, wherein data nodes that do not contain subordinate nodes in the assembly data message are converted into node parameter values;
[0161] The assembled data message is read and processed by a preset message parsing configuration. After reading, the data objects in the network order data are parsed in a multi-threaded manner.
[0162] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0163] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0164] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0165] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described data packet parsing method, thereby solving the technical problem of data packet parsing. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the data packet parsing method provided in the above embodiments, and will not be repeated here.
[0166] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the data packet parsing method described above.
[0167] The computer program product provided in this application can solve the technical problem of data packet parsing. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the data packet parsing method provided in the above embodiments, and will not be repeated here.
[0168] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.< / paytype> < / payseq> < / extendinfo> < / subproductinfo> < / productorderid> < / subproductinfo> < / productinfo> < / provinfo>
Claims
1. A data packet parsing method, characterized in that, The method includes: Receive computing network order data, wherein the computing network order data includes multiple sub-order data, and the sub-order data includes multiple data nodes; Based on each of the data nodes, the sub-order data is divided by a delimiter to obtain an assembly data message, wherein data nodes that do not contain subordinate nodes in the assembly data message are converted into node parameter values; The assembled data message is read and processed by a preset message parsing configuration. After reading, the data objects in the network order data are parsed in a multi-threaded manner.
2. The method as described in claim 1, characterized in that, The step of dividing the sub-order data based on each data node using a delimiter to obtain the assembled data message includes: Determine whether any subordinate nodes exist in the data nodes of each sub-order data; If it is determined that the data node does not have any subordinate nodes, then the data in the data node is compressed into node parameter values; If it is determined that the data node has a subordinate node, then the data tag of the data node is saved; The data tags and node parameter values are integrated using a delimiter to obtain an assembled data message.
3. The method as described in claim 2, characterized in that, The step of reading and processing the assembled data packet through a preset message parsing configuration includes: The assembled message data is read segment by segment using a streaming processing method to determine the subordinate order of each data node in the assembled data message; For data nodes with subordinate nodes, the data content in each data node is read sequentially according to the subordinate order relationship and data tags; For data nodes that do not have subordinate nodes, the node parameter values corresponding to the data node are written into a preset algorithm instance to obtain the data content in the data node.
4. The method as described in claim 1, characterized in that, The step of parsing the data objects in the network order data in a multi-threaded manner includes: Data is read synchronously from each data node using a multi-threaded approach to obtain data for multiple subtasks. The data from each of the subtasks is placed in an independent task for parsing to obtain the parsed data; For each data node, the parsed data is written to the instance object of the parent node corresponding to the current node.
5. The method as described in claim 4, characterized in that, The data nodes include parameter value nodes and parameterless value nodes. The step of writing the parsed data to the instance object of the parent node corresponding to each data node includes: For parameter value nodes, after the data parsing processing of all parameter value nodes is completed, the parsed data of the parameter value nodes that currently have no subordinate nodes are integrated to obtain a parsed data set; Write the parsed data set into the instance object of the parent node; For nodes without parameter values, the delimiter is used to segment the nodes without parameter values to obtain multiple first parameter values; Write the first parameter value to the instance object of the first node to which the current node belongs.
6. The method as described in claim 1, characterized in that, The preset message parsing configuration includes multiple configuration fields, including interface name, data node attributes, and current node processing method. These configuration fields are used to synchronously read or parse the data content of each separated data node.
7. A data packet parsing device, characterized in that, The data packet parsing device includes: The receiving module is used to receive computing network order data, which includes multiple sub-order data and multiple data nodes. The partitioning module is used to partition each of the sub-order data based on each of the data nodes using a delimiter to obtain an assembly data message, wherein data nodes in the assembly data message that do not contain subordinate nodes are converted into node parameter values; The processing module is used to read and process the assembled data message through a preset message parsing configuration, and after reading, parse the data objects in the computing network order data in a multi-threaded manner.
8. A data packet parsing device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the data packet parsing method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the data packet parsing method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the data packet parsing method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Message generation method and device, electronic equipment and storage medium
CN114499759A
Data processing method, controller and first network equipment
CN114690680A