Message parsing method and electronic device
By directly generating a message resolution strategy and parsing messages using the correspondence between the preset URL and the data related to the plug-in package, the problem of low packet resolution efficiency in the existing technology is solved, and more efficient packet processing is achieved.
Patent Information
- Application Number
- CN202111032587.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-03
- Publication Date
- 2025-03-21
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, packet parsing is less efficient through plug-in packages, mainly because the http call service needs to establish and release connections, which takes a long time.
Through the correspondence between the preset unified resource positioning system URL and the plug-in package-related data, the plug-in package-related data corresponding to the Internet of Things device is determined, and the packet resolution strategy is generated based on the class instances in the plug-in package configuration data, and the packet is directly parsed, avoiding the step of running the plug-in package as a service.
It improves the efficiency of packet analysis, reduces processing time, and improves the processing capability of massive IoT device data.
Smart Images

Figure CN115776529B_ABST
Abstract
Description
Background Art
[0002] At present, with the rapid development of IoT applications, the demand for access to IoT devices is increasing rapidly, and massive amounts of IoT device data need to be processed quickly, so the efficiency requirements for message parsing are also getting higher and higher.
[0003] In the prior art, the method of parsing messages through a plug-in package is generally: first run the plug-in package as a service, and then the IoT device calls the service through http (Hyper Text Transfer Protocol) to parse the message of the IoT device. However, calling the service through http requires operations such as establishing a connection and releasing a connection. Therefore, this method takes a certain amount of time, resulting in low efficiency of message parsing. Summary of the invention
[0004] In an exemplary embodiment of the present disclosure, a message parsing method and an electronic device are provided to improve the message parsing efficiency.
[0005] A first aspect of the present disclosure provides a message parsing method, the method comprising:
[0006] After receiving the message parsing request sent by the IoT device, using the preset correspondence between the uniform resource locator system URL and the plug-in package related data, determine the plug-in package related data corresponding to the URL of the IoT device, wherein the plug-in package related data includes the plug-in package configuration data;
[0007] Determining a message parsing strategy based on the class instance in the plug-in package configuration data;
[0008] The message in the message parsing request is parsed using the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message.
[0009] This embodiment, after receiving a message parsing request sent by an Internet of Things device, uses the correspondence between a preset Uniform Resource Locator System URL and plug-in package related data to determine the plug-in package related data corresponding to the URL of the Internet of Things device, wherein the plug-in package related data is plug-in package configuration data; then determines the message parsing strategy based on the class instance in the plug-in package configuration data; finally, parses the message in the message parsing request through the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message. Therefore, in this embodiment, a message parsing strategy is directly generated through the class instance in the plug-in package configuration data, and then the message in the message parsing request is parsed through the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message. In this embodiment, the message is directly parsed, and it does not need to be run as a service and then called, thereby improving the efficiency of message parsing.
[0010] In one embodiment, the plug-in package related data includes a plug-in package;
[0011] Before generating a parsing message parsing strategy based on the class instance in the plug-in package configuration data, the method further includes:
[0012] If it is determined that the plug-in package configuration data does not include the class instance, loading the plug-in package using a custom class loader corresponding to the plug-in package to obtain the class instance;
[0013] The obtained class instance is stored in the plug-in package configuration data.
[0014] In this embodiment, if it is determined that the plug-in package configuration data does not include the class instance, the plug-in package is loaded using the custom class loader corresponding to the plug-in package to obtain the class instance; and the obtained class instance is stored in the plug-in package configuration data. Thus, only when the plug-in package configuration data does not include the class instance does the custom class loader need to be used to load the plug-in package to obtain the class instance, thereby saving time and improving the efficiency of message parsing.
[0015] In one embodiment, the specified data in the plug-in package configuration data includes plug-in package environment variables;
[0016] The parsing of the message in the message parsing request by using the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message includes:
[0017] The plug-in package environment variable and the message are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message.
[0018] In this embodiment, the plug-in package environment variable and the message are used as parameters of the message parsing strategy to execute the message parsing strategy and obtain the parsed message, so that the message can be directly parsed to improve the message parsing efficiency.
[0019] In one embodiment, the specified data in the plug-in package configuration data includes plug-in package environment variables and plug-in package cache data;
[0020] The parsing of the message in the message parsing request by using the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message includes:
[0021] The plug-in package environment variable, the plug-in package cache data and the message are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message.
[0022] This embodiment uses the plug-in package environment variable, plug-in package cache data and the message as parameters of the message parsing strategy to execute the message parsing strategy and obtain the parsed message, thereby directly parsing the message to improve the message parsing efficiency.
[0023] In one embodiment, the plug-in package cache data is obtained when parsing a message of the Internet of Things device last time.
[0024] The plug-in package cache data in this embodiment is obtained when parsing the message of the IoT device last time. Therefore, the plug-in package cache data can be directly used to perform message parsing, thereby improving the efficiency of message parsing.
[0025] In one embodiment, the plug-in package environment variable is obtained by the following method:
[0026] If it is determined that the plug-in package configuration data does not include the plug-in package environment variable, obtaining the plug-in package environment variable from a database;
[0027] The acquired plug-in package environment variables are stored in the plug-in package configuration data.
[0028] In this embodiment, the plug-in package environment variables are obtained from the database, and the obtained plug-in package environment variables are stored in the plug-in configuration data, so that the plug-in package environment variables can be directly obtained the next time the IoT device performs parsing, thereby improving the efficiency of message parsing.
[0029] In one embodiment, after parsing the message in the message parsing request by using the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message, the method further includes:
[0030] The plug-in package cache data is stored in the plug-in package configuration data, so that the plug-in package cache data is used to parse the message of the Internet of Things device next time, wherein the plug-in package cache data is obtained when parsing the message of the Internet of Things device this time.
[0031] This embodiment stores the plug-in package cache data obtained during the message parsing this time into the plug-in package configuration data, so that the plug-in package cache data can be used for parsing the message of the IoT device next time, thereby improving the efficiency of message parsing.
[0032] A second aspect of the present disclosure provides an electronic device, including a storage unit and a processor, wherein:
[0033] The storage unit is configured to store the correspondence between the preset uniform resource locator system URL and the plug-in package related data and the plug-in package related data;
[0034] The processor is configured to:
[0035] After receiving the message parsing request sent by the IoT device, using the preset correspondence between the uniform resource locator system URL and the plug-in package related data, determine the plug-in package related data corresponding to the URL of the IoT device, wherein the plug-in package related data includes the plug-in package configuration data;
[0036] Determining a message parsing strategy based on the class instance in the plug-in package configuration data;
[0037] The message in the message parsing request is parsed using the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message.
[0038] In one embodiment, the plug-in package related data includes a plug-in package;
[0039] The processor is further configured to:
[0040] Before generating a parsing message parsing strategy based on the class instance in the plug-in package configuration data, if it is determined that the plug-in package configuration data does not include the class instance, the plug-in package is loaded using a custom class loader corresponding to the plug-in package to obtain the class instance;
[0041] The obtained class instance is stored in the plug-in package configuration data.
[0042] In one embodiment, the specified data in the plug-in package configuration data includes plug-in package environment variables;
[0043] The processor executes parsing the message in the message parsing request through the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message, and is specifically configured as follows:
[0044] The plug-in package environment variable and the message are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message.
[0045] In one embodiment, the specified data in the plug-in package configuration data includes plug-in package environment variables and plug-in package cache data;
[0046] The processor executes the parsing of the message in the message parsing request by using the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message, and is specifically configured as follows:
[0047] The plug-in package environment variable, the plug-in package cache data and the message are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message.
[0048] In one embodiment, the plug-in package cache data is obtained when parsing a message of the Internet of Things device last time.
[0049] In one embodiment, the processor is further configured to:
[0050] The plugin package environment variables are obtained by the following method:
[0051] If it is determined that the plug-in package configuration data does not include the plug-in package environment variable, obtaining the plug-in package environment variable from a database;
[0052] The acquired plug-in package environment variables are stored in the plug-in package configuration data.
[0053] In one embodiment, the processor is further configured to:
[0054] The message in the message parsing request is parsed by the message parsing strategy and the specified data in the plug-in package configuration data. After obtaining the parsed message, the plug-in package cache data is stored in the plug-in package configuration data, so that the plug-in package cache data can be used to parse the message of the Internet of Things device next time, wherein the plug-in package cache data is obtained when parsing the message of the Internet of Things device this time.
[0055] According to a third aspect provided by an embodiment of the present disclosure, a computer storage medium is provided, wherein the computer storage medium stores a computer program, and the computer program is used to execute the method as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0057] Figure 1 A schematic diagram of primary storage in a message parsing method according to an embodiment of the present disclosure;
[0058] Figure 2 A schematic diagram of secondary storage in a message parsing method according to an embodiment of the present disclosure;
[0059] Figure 3 A schematic diagram of a data storage strategy in a message parsing method according to an embodiment of the present disclosure;
[0060] Figure 4 This is one of the flowcharts of a message parsing method according to an embodiment of the present disclosure;
[0061] Figure 5A A schematic diagram of a process for obtaining a class instance in a message parsing method according to an embodiment of the present disclosure;
[0062] Figure 5B A schematic diagram of a process for obtaining plug-in package environment variables in a message parsing method according to an embodiment of the present disclosure;
[0063] Figure 6 The second flowchart of the message parsing method according to an embodiment of the present disclosure;
[0064] Figure 7 A message parsing device according to an embodiment of the present disclosure;
[0065] Figure 8 The figure is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0067] In the embodiments of the present disclosure, the term "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0068] The application scenarios described in the embodiments of the present disclosure are intended to more clearly illustrate the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. It is known to those skilled in the art that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems. In the description of the present disclosure, unless otherwise specified, the meaning of "multiple" is two or more.
[0069] In the prior art, the method of parsing messages through a plug-in package is generally: first run the plug-in package as a service, and then the IoT device calls the service through http (Hyper Text Transfer Protocol) to parse the message of the IoT device. However, calling the service through http requires operations such as establishing a connection and releasing a connection. Therefore, this method takes a certain amount of time, resulting in low efficiency of message parsing.
[0070] Therefore, the present disclosure provides a message parsing method, which determines the plug-in package related data corresponding to the URL of the Internet of Things device by using the correspondence between the preset Uniform Resource Locator System URL and the plug-in package related data after receiving the message parsing request sent by the Internet of Things device, wherein the plug-in package related data includes the plug-in package configuration data; then determines the message parsing strategy based on the class instance in the plug-in package configuration data; finally, parses the message in the message parsing request through the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message. Therefore, in this embodiment, the message parsing strategy is directly generated through the class instance in the plug-in package configuration data, and then the message in the message parsing request is parsed through the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message. In this embodiment, the message is directly parsed, and it does not need to be run as a service and then called, which improves the efficiency of message parsing. Below, the scheme of the present disclosure is described in detail in conjunction with the accompanying drawings.
[0071] Before introducing the message parsing method disclosed in the present invention in detail, the plug-in package and the storage method of the plug-in package configuration data in the present application are first introduced in detail. The storage method in the present application is a two-level storage method, including primary storage and secondary storage, where the primary storage is local memory and the secondary storage is Redis (Remote Dictionary Server). Figure 1 This is a schematic diagram of the primary storage, in which each plug-in package is allocated an independent space, with the plug-in package identifier as the index. In order to further improve the efficiency of message parsing, the correspondence between the preset uniform resource locator system URL and the plug-in package related data is also stored in the primary storage.
[0072] Figure 2 This is a schematic diagram of secondary storage. Each plug-in package corresponds to a secondary storage, including: a custom class loader corresponding to the plug-in package, and plug-in package configuration data corresponding to each IoT device, wherein the plug-in package configuration data includes class instances, plug-in package environment variables, and plug-in package cache data.
[0073] It should be noted that the storage in this embodiment pre-sets a storage strategy, which is divided into two types: storage duration and maximum storage quantity. Figure 3 The following are the storage strategies corresponding to each data.
[0074] The custom class loader uses both the save duration and the maximum save quantity as storage strategies, and determines the save duration and the maximum save quantity according to the number of plug-in packages and the support capability of the system. In this embodiment, the maximum save quantity of the custom class loader is set to 500. And the save duration of the custom class loader is set to 30. The save duration and the maximum save quantity can be set according to the specific actual situation, and this embodiment does not limit them here.
[0075] The plug-in package cache data uses the retention period as a storage strategy. The plug-in package cache data is generally the information obtained after logging in to the IoT platform that sends the message parsing request or the token data obtained. The retention period of the plug-in package cache data can be set according to the requirements of the IoT platform, and there is no limit on the maximum number of plug-in package cache data that can be saved.
[0076] Class instances and plugin package environment variables use the retention period as the storage strategy, and the retention period of class instances and plugin package environment variables is the same as that of custom class loaders. There is no limit on the maximum number of retentions.
[0077] The correspondence between the Uniform Resource Locator System URL and the plug-in package related data uses the retention period as the storage strategy, and the retention period is the same as the retention period of the custom class loader.
[0078] All the above data are refreshed in real time. When data is added or modified, the data in the primary storage and the data in the secondary storage are modified synchronously to ensure the accuracy of each data.
[0079] Data that exceeds the storage time will be cleared from the cache; if the amount of data saved by the custom class loader exceeds the maximum storage amount, the data that is used least frequently within the specified time period will be filtered out to ensure that the stored data is hot data and increase the cache hit rate.
[0080] The message parsing method disclosed in the present invention is described in detail below with reference to the accompanying drawings. Figure 4 The flowchart of the message parsing method disclosed in the present invention may include the following steps:
[0081] Step 401: upon receiving a message parsing request sent by an IoT device, using a preset correspondence between a Uniform Resource Locator URL and plug-in package related data, determine plug-in package related data corresponding to the URL of the IoT device, wherein the plug-in package related data includes plug-in package configuration data;
[0082] The corresponding relationship between the uniform resource locator URL and the plug-in package related data can be shown in Table 1:
[0083] Uniform Resource Locator URL Plugin Packages Plugin package configuration data URL1 Plug-in package A Plugin package configuration data A URL2 Plug-in package B Plugin package configuration data B URL3 Plug-in package C Plugin package configuration data C … … …
[0084] Table 1
[0085] For example, if the URL of the IoT device is URL1, it is determined that the corresponding plug-in package is plug-in package A and plug-in package configuration data A. Plug-in package A can be obtained from the primary storage, and plug-in package configuration data A corresponding to plug-in package A can be obtained from the secondary storage.
[0086] Step 402: Determine a message parsing strategy based on the class instance in the plug-in package configuration data;
[0087] Wherein, the class instance includes the corresponding message parsing strategy.
[0088] In order to ensure that the class instance can be obtained, in one embodiment, before executing step 402, Figure 5A As shown, if it is determined that the plug-in package configuration data does not include the class instance, the plug-in package is loaded using the custom class loader corresponding to the plug-in package to obtain the class instance; and the obtained class instance is stored in the plug-in package configuration data.
[0089] If the plug-in package does not have a corresponding custom class loader, a custom class loader corresponding to the plug-in package is created.
[0090] It should be noted that any method of creating a custom class loader in the prior art can be used, and this embodiment does not limit this.
[0091] Step 403: Parse the message in the message parsing request using the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message.
[0092] In one embodiment, the following two message parsing methods are included:
[0093] Mode 1: If the IoT device sends a message parsing request for the first time, the plug-in package configuration data includes plug-in package environment variables;
[0094] Step 403 may be implemented as follows: using the plug-in package environment variable and the message as parameters of the message parsing strategy to execute the message parsing strategy and obtain the parsed message.
[0095] The plugin package environment variable is obtained by the following method:
[0096] If it is determined that the plug-in package configuration data does not include the plug-in package environment variable, the plug-in package environment variable is obtained from a database; and the obtained plug-in package environment variable is stored in the plug-in package configuration data.
[0097] It should be noted that after the obtained plug-in package environment variables are stored in the plug-in package configuration data (secondary cache), the plug-in package environment variables are stored in the primary storage, so that the plug-in package environment variables can be directly obtained from the primary storage, thereby improving the efficiency of message parsing.
[0098] The priority of obtaining data from primary storage, secondary storage, and database is as follows: primary storage > secondary storage > database. Figure 5B As shown, the plug-in package environment variable is first obtained from the primary storage. If the plug-in package environment variable cannot be obtained in the primary storage, it is obtained from the secondary storage. If the plug-in package environment variable still cannot be obtained in the secondary storage, the plug-in package environment variable is obtained from the database and then stored in the secondary storage and the primary storage in sequence.
[0099] Mode 2: If the IoT device does not send a message parsing request for the first time, the plug-in package configuration data includes plug-in package environment variables and plug-in package cache data;
[0100] Step 403 can be implemented as follows: using the plug-in package environment variable, plug-in package cache data and the message as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message. The plug-in package cache data is obtained when the message of the IoT device was parsed last time.
[0101] It should be noted that: in order to ensure universality. The name of the class instance and the name of the message parsing strategy are passed as strings as parameters, and the message parsing strategy is executed by reflection execution. The parameters of the message parsing strategy and its return value are all in json format. The specific format is as follows:
[0102] Parameter format: {"plugin package environment variable":{},"plugin package cache data":{},"message":[]}.
[0103] The plugin package environment variables and plugin package cache data are JSONObject, which can contain multiple attribute values; the message is JSONArray, and multiple messages can be transmitted and processed together at one time.
[0104] Return value format: {"Plugin package cache data":{},"Parsed message":[]}.
[0105] In order to further improve the efficiency of message parsing, in one embodiment, after executing step 403, the plug-in package cache data is stored in the plug-in package configuration data, so that the plug-in package cache data can be used to parse the message of the Internet of Things device next time, wherein the plug-in package cache data is obtained when parsing the message of the Internet of Things device this time.
[0106] The obtained plug-in package cache data is stored in the memory according to the corresponding plug-in package and the IoT device. The specific storage strategy of the plug-in package cache data is to use the set time length returned by the plug-in package. For example, the plug-in package cache data format is:
[0107] Plugin package cache format: {"duration":"H10","data":{}}.
[0108] Among them, duration is the storage duration, and the corresponding value is in a fixed format. The first part represents the time unit: S is seconds; m is minutes; H is hours; D is days; M is months. The second part is a number representing the quantity. Among them, H10 means the storage duration is 10 hours.
[0109] In order to further understand the technical solution of the present disclosure, Figure 6 A detailed description may include the following steps:
[0110] Step 601: upon receiving a message parsing request sent by an IoT device, using a preset correspondence between a Uniform Resource Locator URL and plug-in package related data, determine plug-in package related data corresponding to the URL of the IoT device, wherein the plug-in package related data includes plug-in package configuration data;
[0111] Step 602: Determine whether the plug-in package configuration data includes the class instance, if yes, execute step 604, if no, execute step 603;
[0112] Step 603: using the custom class loader corresponding to the plug-in package to load the plug-in package to obtain the class instance; and storing the obtained class instance in the plug-in package configuration data;
[0113] Step 604: Determine a message parsing strategy based on the class instance in the plug-in package configuration data;
[0114] Step 605: Determine whether the plug-in package configuration data includes the plug-in package environment variable, if so, execute step 607, if not, execute step 606;
[0115] Step 606: Acquire the plug-in package environment variable from the database; and store the acquired plug-in package environment variable in the plug-in package configuration data;
[0116] Step 607: using the plug-in package environment variable, plug-in package cache data and the message as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message, wherein the plug-in package cache data is in the plug-in package configuration data.
[0117] Based on the same disclosed concept, the message parsing method described above in the present disclosure can also be implemented by a message parsing device. The effect of the message parsing device is similar to that of the aforementioned method, and will not be described in detail here.
[0118] Figure 7 The figure is a schematic diagram of the structure of a message parsing device according to an embodiment of the present disclosure.
[0119] like Figure 7 As shown, the message parsing device 700 of the present disclosure may include a plug-in package related data determination module 710 , a message parsing strategy determination module 720 and a message parsing module 730 .
[0120] The plug-in package related data determination module 710 is used to determine the plug-in package related data corresponding to the URL of the IoT device by using the preset correspondence between the Uniform Resource Locator System URL and the plug-in package related data after receiving the message parsing request sent by the IoT device, wherein the plug-in package related data includes the plug-in package configuration data;
[0121] A message parsing strategy determination module 720, configured to determine a message parsing strategy based on a class instance in the plug-in package configuration data;
[0122] The message parsing module 730 is used to parse the message in the message parsing request according to the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message.
[0123] In one embodiment, the apparatus further comprises:
[0124] The class instance acquisition module 740 is used to load the plug-in package using the custom class loader corresponding to the plug-in package to obtain the class instance before generating a parsing message parsing strategy based on the class instance in the plug-in package configuration data, if it is determined that the plug-in package configuration data does not include the class instance; and store the obtained class instance in the plug-in package configuration data.
[0125] In one embodiment, the specified data in the plug-in package configuration data includes plug-in package environment variables;
[0126] The message parsing module 730 is specifically used for:
[0127] The plug-in package environment variable and the message are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message.
[0128] In one embodiment, the specified data in the plug-in package configuration data includes plug-in package environment variables and plug-in package cache data;
[0129] The message parsing module 730 is specifically used for:
[0130] The plug-in package environment variable, the plug-in package cache data and the message are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message.
[0131] In one embodiment, the plug-in package cache data is obtained when parsing a message of the Internet of Things device last time.
[0132] In one embodiment, the apparatus further comprises:
[0133] The plug-in package environment variable determination module 750 is used to obtain the plug-in package environment variable by the following method:
[0134] If it is determined that the plug-in package configuration data does not include the plug-in package environment variable, obtaining the plug-in package environment variable from a database;
[0135] The acquired plug-in package environment variables are stored in the plug-in package configuration data.
[0136] In one embodiment, the apparatus further comprises:
[0137] The storage module 760 is used to parse the message in the message parsing request through the message parsing strategy and the specified data in the plug-in package configuration data, and after obtaining the parsed message, store the plug-in package cache data in the plug-in package configuration data, so that the plug-in package cache data can be used to parse the message of the IoT device next time, wherein the plug-in package cache data is obtained when parsing the message of the IoT device this time.
[0138] After introducing a message parsing method and an electronic device according to an exemplary embodiment of the present disclosure, next, an electronic device according to another exemplary embodiment of the present disclosure is introduced.
[0139] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0140] In some possible implementations, the electronic device according to the present disclosure may include at least one processor and at least one computer storage medium. The computer storage medium stores program code, and when the program code is executed by the processor, the processor executes the steps of the message parsing method according to various exemplary implementations of the present disclosure described above in this specification. For example, the processor may execute the following steps: Figure 4 Steps 401-403 shown in .
[0141] Refer to the following Figure 8 The electronic device 800 according to this embodiment of the present disclosure is described. Figure 8 The electronic device 800 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0142] like Figure 8 As shown, the electronic device 800 is in the form of a general electronic device. The components of the electronic device 800 may include but are not limited to: at least one processor 801, at least one computer storage medium 802, and a bus 803 connecting different system components (including the computer storage medium 802 and the processor 801).
[0143] Bus 803 represents one or more of several types of bus structures, including a computer storage media bus or computer storage media controller, a peripheral bus, a processor, or a local bus using any of a variety of bus architectures.
[0144] The computer storage medium 802 may include readable media in the form of volatile computer storage media, such as random access computer storage media (RAM) 821 and / or cache storage media 822 , and may further include read-only computer storage media (ROM) 823 .
[0145] The computer storage medium 802 may also include a program / utility 825 having a set (at least one) of program modules 824, such program modules 824 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0146] The electronic device 800 may also communicate with one or more external devices 804 (e.g., keyboards, pointing devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 800, and / or may communicate with any device (e.g., routers, modems, etc.) that enables the electronic device 800 to communicate with one or more other electronic devices. Such communication may be performed via an input / output (I / O) interface 805. Furthermore, the electronic device 800 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 806. As shown, the network adapter 806 communicates with other modules for the electronic device 800 via a bus 803. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0147] In some possible implementations, various aspects of a message parsing method provided by the present disclosure may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the message parsing method according to various exemplary implementations of the present disclosure described above in this specification.
[0148] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access computer storage medium (RAM), a read-only computer storage medium (ROM), an erasable programmable read-only computer storage medium (EPROM or flash memory), an optical fiber, a portable compact disk read-only computer storage medium (CD-ROM), an optical computer storage medium, a magnetic computer storage medium, or any suitable combination of the above.
[0149] The program product of the message parsing of the embodiment of the present disclosure may adopt a portable compact disk read-only computer storage medium (CD-ROM) and include program code, and can be run on an electronic device. However, the program product of the present disclosure is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0150] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0151] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0152] Program code for performing the disclosed operations may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user electronic device, partially on the user device, as a separate software package, partially on the user electronic device and partially on a remote electronic device, or entirely on a remote electronic device or server. In the case of a remote electronic device, the remote electronic device may be connected to the user electronic device via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external electronic device (e.g., via the Internet using an Internet service provider).
[0153] It should be noted that although several modules of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules to be embodied.
[0154] In addition, although the operations of the disclosed method are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0155] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk computer storage media, CD-ROM, optical computer storage media, etc.) containing computer-usable program codes.
[0156] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0157] These computer program instructions may also be stored in a computer-readable computer storage medium that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable computer storage medium produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0158] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0159] Obviously, those skilled in the art can make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is also intended to include these modifications and variations.
Claims
1. A message parsing method, characterized in that: The method comprises: After receiving the message parsing request sent by the IoT device, determine the plug-in package related data corresponding to the URL of the IoT device by using the preset correspondence between the uniform resource locator system URL and the plug-in package related data, wherein the plug-in package related data includes plug-in package configuration data, and the specified data in the plug-in package configuration data includes plug-in package environment variables and / or plug-in package cache data; Determining a message parsing strategy based on the class instance in the plug-in package configuration data; If the specified data in the plug-in package configuration data includes a plug-in package environment variable, the plug-in package environment variable and the message in the message parsing request are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message; or, If the specified data in the plug-in package configuration data includes plug-in package environment variables and plug-in package cache data, the plug-in package environment variables, the plug-in package cache data and the message are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message.
2. The method according to claim 1, characterized in that The plug-in package related data includes the plug-in package; Before generating a parsing message parsing strategy based on the class instance in the plug-in package configuration data, the method further includes: If it is determined that the plug-in package configuration data does not include the class instance, then using the custom class loader corresponding to the plug-in package to load the plug-in package to obtain the class instance; and, The obtained class instance is stored in the plug-in package configuration data.
3. The method according to claim 1, characterized in that The plug-in package cache data is obtained when the message of the Internet of Things device was parsed last time.
4. The method according to claim 1, characterized in that The plugin package environment variables are obtained by the following method: If it is determined that the plug-in package configuration data does not include the plug-in package environment variable, obtaining the plug-in package environment variable from a database; and, The acquired plug-in package environment variables are stored in the plug-in package configuration data.
5. The method according to claim 1, characterized in that After parsing the message in the message parsing request by using the message parsing strategy and the specified data in the plug-in package configuration data to obtain the parsed message, the method further includes: The plug-in package cache data is stored in the plug-in package configuration data, so that the plug-in package cache data is used to parse the message of the Internet of Things device next time, wherein the plug-in package cache data is obtained when parsing the message of the Internet of Things device this time.
6. An electronic device, characterized in that: The device comprises a storage unit and a processor, wherein: The storage unit is configured to store the correspondence between the preset uniform resource locator system URL and the plug-in package related data and the plug-in package related data; The processor is configured to: After receiving the message parsing request sent by the IoT device, determine the plug-in package related data corresponding to the URL of the IoT device by using the preset correspondence between the uniform resource locator system URL and the plug-in package related data, wherein the plug-in package related data includes plug-in package configuration data, and the specified data in the plug-in package configuration data includes plug-in package environment variables and / or plug-in package cache data; Determining a message parsing strategy based on the class instance in the plug-in package configuration data; If the specified data in the plug-in package configuration data includes a plug-in package environment variable, the plug-in package environment variable and the message in the message parsing request are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message; or, If the specified data in the plug-in package configuration data includes plug-in package environment variables and plug-in package cache data, the plug-in package environment variables, the plug-in package cache data and the message are used as parameters of the message parsing strategy to execute the message parsing strategy to obtain the parsed message.
7. The electronic device according to claim 6, characterized in that: The plug-in package related data includes the plug-in package; the processor is further configured to: Before generating a parsing message parsing strategy based on the class instance in the plug-in package configuration data, if it is determined that the plug-in package configuration data does not include the class instance, the plug-in package is loaded using a custom class loader corresponding to the plug-in package to obtain the class instance; and, The obtained class instance is stored in the plug-in package configuration data.
Citation Information
Patent Citations
Protocol analysis method and device
CN110417766A
Industrial control equipment topological graph determination method and device and electronic equipment
CN111130883A