Message processing method and device, electronic equipment, storage medium and program product

By deploying a rule engine device in communication technology to push the latest message processing rule code to the server, the problem of the server needing to frequently update the code is solved, hot deployment is achieved, the rule change process is simplified and the cost is reduced.

CN118694655APending Publication Date: 2024-09-24KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410558949.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-07
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

In the field of communication technology, when a server needs to communicate with multiple terminals, changes in message processing rules require rewriting the code and putting it online, which is a cumbersome and costly process.

Method used

The latest message processing rule code is pushed to the first device through the device where the rule engine is deployed, so that the first device can automatically update and use the latest rules for message processing without the need to rewrite the code on the first device side to achieve hot deployment.

Benefits of technology

It simplifies the process of changing message processing rules, reduces costs, and improves the flexibility and stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118694655A
    Figure CN118694655A
Patent Text Reader

Abstract

The embodiment of the invention discloses a message processing method and device, electronic equipment, a storage medium and a program product. The method comprises the following steps: receiving a latest message processing rule code of a rule engine sent by second equipment deployed with the rule engine; receiving a to-be-processed data stream sent by a third device; determining a to-be-processed message based on the to-be-processed data stream; and processing the to-be-processed message based on the message processing rule code. In the embodiment of the invention, the change of the message processing rule is realized more simply, and the cost is lower.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communication technology, and in particular to a message processing method, device, electronic device, storage medium and program product. Background Art

[0002] In the field of communication technology, some devices may need to communicate with multiple devices. For example, a server may need to communicate with multiple terminals. The server often has codes that represent message processing rules, and the server can process messages from any terminal based on these codes. It should be pointed out that once the message processing rules change, the code needs to be rewritten and put online on the server, which is very cumbersome and costly to implement. Summary of the invention

[0003] In order to solve the above technical problems, the present disclosure is proposed. The embodiments of the present disclosure provide a message processing method, device, electronic device, storage medium and program product.

[0004] According to one aspect of an embodiment of the present disclosure, a message processing method is provided, which is applied to a first device, and the method includes:

[0005] Receiving the latest message processing rule code of the rule engine sent by a second device on which the rule engine is deployed;

[0006] receiving a data stream to be processed sent by a third device;

[0007] Determining a message to be processed based on the data stream to be processed;

[0008] Based on the message processing rule code, the message to be processed is processed.

[0009] According to another aspect of an embodiment of the present disclosure, a message processing method is provided, which is applied to a second device deployed with a rule engine, and the method includes:

[0010] Receiving an input operation from a user on a visual interface corresponding to the rule engine;

[0011] Based on the input operation, updating the message processing rule code of the rule engine;

[0012] Send the latest message processing rule code of the rule engine to the first device; wherein the first device is used to receive the data stream to be processed sent by the third device, determine the message to be processed based on the data stream to be processed, and process the message to be processed based on the message processing rule code sent by the second device.

[0013] According to another aspect of an embodiment of the present disclosure, a message processing apparatus is provided, which is applied to a first device, and the apparatus includes:

[0014] A first receiving module, configured to receive the latest message processing rule code of the rule engine sent by a second device on which the rule engine is deployed;

[0015] A second receiving module, used for receiving a data stream to be processed sent by a third device;

[0016] A first determining module, configured to determine a message to be processed based on the data stream to be processed;

[0017] A processing module is used to process the message to be processed based on the message processing rule code.

[0018] According to another aspect of an embodiment of the present disclosure, a message processing apparatus is provided, which is applied to a second device deployed with a rule engine, and the apparatus includes:

[0019] A third receiving module is used to receive a user's input operation on the visual interface corresponding to the rule engine;

[0020] An updating module, used for updating the message processing rule code of the rule engine based on the input operation;

[0021] A sending module is used to send the latest message processing rule code of the rule engine to the first device; wherein the first device is used to receive the data stream to be processed sent by the third device, determine the message to be processed based on the data stream to be processed, and process the message to be processed based on the message processing rule code sent by the second device.

[0022] According to another aspect of the embodiments of the present disclosure, there is provided an electronic device, including:

[0023] A memory for storing a computer program product;

[0024] The processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, the message processing method is implemented.

[0025] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, characterized in that when the computer program instructions are executed by a processor, the above-mentioned message processing method is implemented.

[0026] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, including computer program instructions, and the computer program instructions implement the above message processing method when executed by a processor.

[0027] In the embodiments of the present disclosure, the message processing rule code based on which the first device processes the message to be processed comes from the second device on which a rule engine is deployed. In this way, if the message processing rule needs to be changed, it is only necessary to update the message processing rule code of the rule engine on the second device side, and the second device will automatically push the latest message processing rule code of the rule engine to the first device, so that the first device uses the latest message processing rule to process the message. There is no need to rewrite the code and deploy it online on the first device side, so that the effect of hot deployment can be achieved, and changes in message processing rules are simpler to implement and at a lower cost.

[0028] The technical solution of the present disclosure is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The above and other purposes, features and advantages of the present disclosure will become more apparent by describing the embodiments of the present disclosure in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. In the drawings, the same reference numerals generally represent the same components or steps.

[0030] Figure 1 is a schematic diagram of a system architecture in some exemplary embodiments of the present disclosure.

[0031] Figure 2 It is a flowchart of a message processing method provided by an exemplary embodiment of the present disclosure.

[0032] Figure 3 It is a partial schematic diagram of a visualization interface corresponding to a rule engine in some exemplary embodiments of the present disclosure.

[0033] Figure 4 is a unified modeling language class diagram of messages to be processed in some exemplary embodiments of the present disclosure.

[0034] Figure 5 It is a flowchart of a method for processing a message to be processed based on a message processing rule code provided by some exemplary embodiments of the present disclosure.

[0035] Figure 6 It is a flowchart of a method for generating a reply data stream provided by some exemplary embodiments of the present disclosure.

[0036] Figure 7 It is a flowchart of a method for processing a message to be processed based on a message processing rule code provided by other exemplary embodiments of the present disclosure.

[0037] Figure 8-1It is a flowchart of a method for running a message processing rule code provided by some exemplary embodiments of the present disclosure.

[0038] Figure 8-2 It is a partial schematic diagram of the correspondence between pre-set objects and method identifiers in some exemplary embodiments of the present disclosure.

[0039] Fig. 9 It is a flowchart of a message processing method provided by some other exemplary embodiments of the present disclosure.

[0040] Figure 10-1 It is a schematic diagram of the structure of the message processing rule code of the rule engine in some exemplary embodiments of the present disclosure.

[0041] Figure 10-2 Schematic diagram of the flow splitting process at the decision flow in some exemplary embodiments of the present disclosure.

[0042] Figure 10-3 FIG. 4 is a schematic diagram of two stages involved in processing a data stream to be processed in some exemplary embodiments of the present disclosure.

[0043] Fig.11 It is a structural diagram of a message processing device provided by some exemplary embodiments of the present disclosure.

[0044] Fig.12 is a schematic diagram of modules used for the execution of message processing rule codes in some exemplary embodiments of the present disclosure.

[0045] Fig.13 is a structural diagram of a message processing device provided by some other exemplary embodiments of the present disclosure

[0046] Fig.14 is a structural diagram of an electronic device provided by some exemplary embodiments of the present disclosure. DETAILED DESCRIPTION

[0047] The exemplary embodiments according to the present disclosure will be described in detail below with reference to the accompanying drawings. The described embodiments are only some embodiments of the present disclosure, not all embodiments, and the present disclosure is not limited to the exemplary embodiments described here.

[0048] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.

[0049] Those skilled in the art will appreciate that the terms "first", "second", etc. in the embodiments of the present disclosure are only used to distinguish different steps, devices, or modules, etc., and do not represent specific technical meanings and necessary logical sequences. "Multiple" may refer to two or more, and "at least one" may refer to one, two, or more.

[0050] It should also be understood that any component, data or structure mentioned in the embodiments of the present disclosure can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0051] The term "and / or" in this disclosure is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " in this disclosure generally indicates that the associated objects before and after are in an "or" relationship.

[0052] It should also be understood that the description of the various embodiments in the present disclosure focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0053] The disclosed embodiments can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, servers, etc. include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.

[0054] Electronic devices such as terminal devices, computer systems, servers, etc. can be described in the general context of computer system executable instructions (such as program modules) executed by computer systems. Generally, program modules may include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in a distributed cloud computing environment, where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.

[0055] Exemplary Overview

[0056] Figure 1 is a schematic diagram of a system architecture in some exemplary embodiments of the present disclosure, which includes a first device, a second device, and a third device.

[0057] The first device may be a device that needs to communicate with multiple devices. Optionally, the first device may be a server, such as a high-performance server built on Netty. It is understandable that Netty is a network programming framework that provides an easy-to-use application programming interface (API) and supports high-performance, high-reliability, and high-scalability network application development. Netty provides a powerful asynchronous event-driven model and thread model that can easily handle a large number of concurrent connections and data transmission, and provides a series of codecs, processors, filters and other components.

[0058] The second device may be a device deployed with a rule engine. It is understood that the rule engine is a component embedded in the application, an intermediate service layer abstracted from "frequent and common" business changes, which separates the decision logic from the application code, and uses predefined high-level syntax or visual tools to write business rules and automatically optimize execution.

[0059] The third device may be any device among a plurality of devices that need to communicate with the first device. Optionally, the third device may be a mobile terminal, a vehicle-mounted device, and the like.

[0060] In one example, the first device is a cloud server, and the third device is a vehicle-mounted device. The specific communication scenario between the first device and the third device is: the vehicle-mounted device collects video of the driver in the vehicle and transmits the collected video to the cloud server; the cloud server analyzes the video to determine the driver's status, such as whether the driver is playing with a mobile phone, whether the driver is tired, etc., and based on the determined status, transmits data back to the vehicle-mounted device; the vehicle-mounted device outputs prompt information based on the returned data, such as prompt information for prompting the driver to stop playing with the mobile phone, prompt information for prompting the driver to stop and rest, etc.

[0061] In the embodiments of the present disclosure, the second device can send the latest message processing rule code of the rule engine to the first device regularly or irregularly, and correspondingly, the first device can receive the message processing rule code from the second device regularly or irregularly. After the first device receives the data stream to be processed sent by the third device and determines the message to be processed based on the data stream to be processed, the first device can process the message to be processed based on the message processing rule code from the second device. In this way, if you want to change the message processing rules, you only need to update the message processing rule code of the rule engine on the second device side, and the second device will automatically push the latest message processing rule code of the rule engine to the first device, so that the first device uses the latest message processing rules for message processing, without the need to rewrite the code and deploy it online on the first device side, so that the effect of hot deployment can be achieved, and changes in message processing rules are simpler to implement and cost-effective.

[0062] Exemplary Methods

[0063] Figure 2 It is a flowchart of a message processing method provided by some exemplary embodiments of the present disclosure. Figure 2 The method shown can be applied to a first device. Figure 2 The method shown may include step 210 , step 220 , step 230 , and step 240 .

[0064] Step 210: Receive the latest message processing rule code of the rule engine sent by the second device on which the rule engine is deployed.

[0065] Optionally, the message processing rule code of the rule engine may refer to: a code carrying the message processing rule specified by the rule engine. The message processing rule specified by the rule engine may include but is not limited to encoding rules, decoding rules, and the like.

[0066] It should be noted that the rule engine can have a corresponding visual interface. The partial schematic diagram of the visual interface can be seen in Figure 3 Users can operate on the visual interface according to actual needs to update the message processing rule code of the rule engine.

[0067] Optionally, a long connection may be established between the first device and the second device, for example, a HyperText Transfer Protocol (HTTP) long connection. The second device may send the latest message processing rule code of the rule engine to the first device regularly or irregularly through the long connection. Correspondingly, the first device may receive the latest message processing rule code of the rule engine regularly or irregularly through the long connection. The first device may store the latest message processing rule code of the rule engine.

[0068] Of course, a long connection may not be established between the first device and the second device. Instead, when the latest message processing rule code of the rule engine needs to be transmitted, a short connection is established between the first device and the second device, and the message processing rule code is transmitted through the short connection.

[0069] It should be noted that, unless otherwise specified, the message processing rule codes that appear separately below refer to the latest message processing rule codes of the rule engine.

[0070] Step 220: Receive a data stream to be processed sent by a third device.

[0071] Optionally, the third device may send the video of the driver in the vehicle to the first device in the form of a data stream, and accordingly, the first device may receive the data stream to be processed from the third device. The data stream to be processed may specifically be a byte stream.

[0072] Step 230: Determine the message to be processed based on the data stream to be processed.

[0073] Optionally, the data stream to be processed may include multiple identification bits for auxiliary segmentation. In one example, each of these identification bits may be 0x7e. Based on these identification bits, the data stream to be processed may be segmented into multiple parts. Next, the multiple parts obtained by segmentation may be subjected to escape restoration processing, and each of the multiple parts after the escape restoration processing may be used as a message to be processed.

[0074] Optionally, the message to be processed may include a message header and a message body. In one example, a Unified Modeling Language (UML) class diagram of the message to be processed can be found in Figure 4 , Figure 4 The messageHeader in can correspond to the message header, Figure 4 The message Body in can correspond to the message body.

[0075] Step 240: Process the message to be processed based on the message processing rule code.

[0076] Optionally, the message to be processed may be processed according to the message processing rules carried by the message processing rule code. During the processing, decoding may be performed according to the decoding rules in the message processing rules, and / or encoding may be performed according to the encoding rules in the message processing rules.

[0077] In the embodiments of the present disclosure, the message processing rule code based on which the first device processes the message to be processed comes from the second device on which a rule engine is deployed. In this way, if the message processing rule needs to be changed, it is only necessary to update the message processing rule code of the rule engine on the second device side, and the second device will automatically push the latest message processing rule code of the rule engine to the first device, so that the first device uses the latest message processing rule to process the message. There is no need to rewrite the code and deploy it online on the first device side, so that the effect of hot deployment can be achieved, and changes in message processing rules are simpler to implement and at a lower cost.

[0078] Figure 5 It is a flowchart of a method for processing a message to be processed based on a message processing rule code provided by some exemplary embodiments of the present disclosure. Figure 5 The method shown may include step 510, step 520, step 530 and step 540. Optionally, the combination of step 510 to step 540 may be used as an optional implementation of step 240 of the present disclosure.

[0079] Step 510: decode the message header in the message to be processed according to a preset message header decoding rule to obtain a first decoding result.

[0080] Optionally, a preset message header decoding rule may be stored in a first preset storage area of ​​the first device. The first preset storage area may be a non-lost storage area upon power failure. The preset message header decoding rule may be a rule for message header decoding shared by all messages. According to the preset message header decoding rule, the message header in the message to be processed may be decoded to parse the message header in the message to be processed into an entity class, thereby obtaining a first decoding result. The first decoding result may include a messageID for identifying the type of a message body in the message to be processed.

[0081] In one example, if the messageID in the first decoding result is 1, it is used to identify that the type of the message body in the message to be processed is a connection initiation type; if the messageID in the first decoding result is 2, it is used to identify that the type of the message body in the message to be processed is a video sending type.

[0082] In some embodiments, the first decoding result may also include information indicating whether the message body in the message to be processed is encrypted.

[0083] Step 520: Based on the message processing rule code and the first decoding result, the message body in the message to be processed is decoded to obtain a second decoding result.

[0084] Optionally, the message processing rule code can be regarded as an executable program, and for ease of description, the program may be referred to as a target program in the following. The first decoding result and the message body in the message to be processed may be provided as input data to the target program, and the target program may be run accordingly to clarify the specific meaning of each byte in the message body in the message to be processed, thereby obtaining a second decoding result including these specific meanings.

[0085] In some embodiments, the first decoding result includes encrypted information representing a message body in the message to be processed. The message body in the message to be processed can be decrypted to obtain plaintext of the message body in the message to be processed, and the first decoding result and the plaintext of the message body in the message to be processed can be provided to the target program as input data to obtain a second decoding result through the execution of the target program.

[0086] Step 530, generating a reply data stream based on the first decoding result, the second decoding result, the preset message header encoding rule, and the message processing rule code.

[0087] In some optional embodiments of the present disclosure, Figure 6 As shown, step 530 may include step 5301, step 5303, step 5305, step 5307 and step 5309.

[0088] Step 5301, determine the reply message header based on the first decoding result.

[0089] Optionally, a correspondence between the messageID in the decoding phase and the messageID in the encoding phase can be preset. According to the preset correspondence, the messageID corresponding to the messageID in the first decoding result can be determined, and then a reply message header including the determined messageID can be obtained.

[0090] In some embodiments, the reply message header may include not only the determined messageID but also a message serial number, message package encapsulation items, etc.

[0091] Step 5303: encode the reply message header according to the preset message header encoding rule to obtain a first encoding result.

[0092] Optionally, a preset message header encoding rule may be stored in a second preset storage area of ​​the first device. The second preset storage area may be a power-off non-lost storage area. The preset message header encoding rule may be a rule for message header encoding shared by all messages. According to the preset message header encoding rule, the encoding of the reply message header may be achieved by performing a reverse process of decoding the message header in the message to be processed as described above to obtain a first encoding result. The meaning of the first encoding result and the information carried by the reply message header may be consistent, and the difference mainly lies in the form or format of the information.

[0093] Step 5305: Determine the reply message body based on the second decoding result.

[0094] Optionally, if it is determined based on the second decoding result that the driver in the vehicle is not playing with the mobile phone and is not tired, a reply message body including information indicating that no prompt is needed can be generated. If it is determined based on the second decoding result that the driver in the vehicle is playing with the mobile phone and / or is tired, a reply message body including information indicating that a prompt is needed and a prompt method can be generated. The prompt method may include but is not limited to a voice prompt method, a light prompt method, a vibration prompt method, etc.

[0095] Step 5307, based on the message processing rule code, encode the reply message body to obtain a second encoding result.

[0096] Optionally, the reply message body can be provided as input data to the target program, and the target program can run accordingly to achieve encoding of the reply message body by performing the reverse process of decoding the message body in the message to be processed above, thereby obtaining a second encoding result. The second encoding result and the meaning of the information carried by the reply message body can be consistent, and the difference mainly lies in the form or format of the information.

[0097] Step 5309: Generate a reply data stream based on the first encoding result and the second encoding result.

[0098] Optionally, the second encoding result may be an instance class. In step 5309, the second encoding result may be converted into a byte stream form, and the conversion result may be combined with the first encoding result to generate a reply data stream.

[0099] In some embodiments, after the conversion result is combined with the first encoding result, a verification algorithm may be used to calculate a corresponding verification code for the combined result, and the combined result may be escaped, and the combined result and the verification code after the escape process may be combined to generate a reply data stream.

[0100] Figure 6In the illustrated implementation mode, based on the first decoding result, the reply message header can be reasonably determined, and by using the preset message header encoding rule, the encoding of the reply message header can be efficiently and reliably implemented to obtain the first encoding result. Based on the second decoding result, the reply message body can be reasonably determined, and by using the message processing rule code, the encoding of the reply message body can be efficiently and reliably implemented to obtain the second encoding result. Combining the first encoding result and the second encoding result, a reply data stream can be obtained and returned to the third device, so that the communication between the first device and the third device can be effectively realized. In addition, if the encoding rule of the reply message body is to be changed, it is only necessary to update the message processing rule code of the rule engine on the second device side accordingly, and the second device will automatically push the latest message processing rule code of the rule engine to the first device, so that the first device uses the latest encoding rule for encoding processing. Therefore, the change of the decoding rule and the encoding rule is very simple to implement and low cost.

[0101] Step 540: Send a reply data stream to the third device.

[0102] As described above, the first device can determine the pending message based on the pending data stream from the third device. The third device can determine the pending message in a similar manner based on the reply data stream from the first device, and further process the pending message. For example, if the reply message body in step 5305 includes information and a prompt method for characterizing the need for prompting, and the prompt method is a voice prompt method, then based on the determined pending message, the third device can output a prompt voice to prompt the driver to drive safely, stop and rest, etc.

[0103] Figure 5 In the illustrated embodiment, the decoding of the message header in the message to be processed can be implemented using a preset message header decoding rule, and the decoding of the message body in the message to be processed can be implemented using a message processing rule code and a first decoding result of the message header in the message to be processed. Based on the first decoding result, the second decoding result of the message body in the message to be processed, the preset message header encoding rule, and the message processing rule code, a reply data stream can be efficiently and reliably generated and returned to the third device, so that the communication between the first device and the third device can be effectively achieved. In addition, if the decoding rule of the message body in the message to be processed and the encoding rule of the reply message body are to be changed, it is only necessary to update the message processing rule code of the rule engine on the second device side accordingly, and the second device will automatically push the latest message processing rule code of the rule engine to the first device, so that the first device uses the latest decoding rule and encoding rule for decoding and encoding processing. Therefore, the change of the decoding rule and encoding rule is very simple to implement and low cost.

[0104] Figure 7It is a flowchart of a method for processing a message to be processed based on a message processing rule code provided by other exemplary embodiments of the present disclosure. Figure 7 The method shown may include step 710, step 720 and step 730. Optionally, the combination of step 710 to step 730 may be used as an optional implementation of step 240 of the present disclosure.

[0105] Step 710: Determine a target communication protocol between the first device and the third device.

[0106] Optionally, the target communication protocol between the first device and the third device may refer to: a protocol followed by both the first device and the third device during communication.

[0107] Step 720: Filter the code portion corresponding to the target communication protocol from the message processing rule code.

[0108] Optionally, the message processing rule code may include code portions corresponding to a plurality of communication protocols; wherein the code portion corresponding to any communication protocol may refer to: a code portion carrying message processing rules applicable to the communication protocol. In step 720, the message processing rule code may be traversed to filter out the code portion corresponding to the target communication protocol.

[0109] Step 730: Process the message to be processed based on the code portion corresponding to the target communication protocol.

[0110] In some optional implementations of the present disclosure, step 730 may include:

[0111] Decoding the message header in the message to be processed according to a preset message header decoding rule to obtain a first decoding result;

[0112] Decoding a message body in the message to be processed based on the code portion corresponding to the target communication protocol and the first decoding result to obtain a second decoding result;

[0113] Generate a reply data stream based on the first decoding result, the second decoding result, a preset message header encoding rule, and a code portion corresponding to the target communication protocol;

[0114] A reply data stream is sent to the third device.

[0115] It should be noted that the specific implementation process of the above implementation method of step 730 can refer to the above Figure 6 The relevant introduction of the illustrated implementation manner will not be repeated here.

[0116] Figure 7In the illustrated embodiment, a suitable code portion can be selected from the message processing rule code for processing the message to be processed according to the target communication protocol between the first device and the third device. In this way, for different messages to be processed supporting different communication protocols, the first device can achieve good processing effects when processing the messages to be processed.

[0117] Figure 8-1 It is a flowchart of a method for running a message processing rule code provided by some exemplary embodiments of the present disclosure. Figure 8-1 The method shown may include step 810 , step 820 , step 830 , step 840 , and step 850 . Figure 8-1 The method shown can be applicable to the case where the first device is deployed with at least one tool class for assisting the running of the message processing rule code of the rule engine, and an object corresponding to each of the at least one tool class. Optionally, the objects corresponding to each of the at least one tool class can be Spring Beans, that is, Java objects managed by the Spring container; wherein Java is a programming language. The objects corresponding to each of the at least one tool class can have a unique object identifier. The object identifier can be a Beanid.

[0118] Step 810, in the process of processing the message to be processed based on the message processing rule code, determining the target object identifier.

[0119] Optionally, during the running of the target program, the object identifier of the object corresponding to the tool class currently required to be called may be determined, and the object identifier is the target object identifier in step 810 .

[0120] Step 820: Determine a target object having a target object identifier.

[0121] Optionally, objects corresponding to at least one tool class may be traversed to determine a target object having a target object identifier.

[0122] Step 830: Determine the target method identifier corresponding to the target object.

[0123] Optionally, the correspondence between the object and the method identifier can be preset, and the method identifier can be a method name. In an example, a partial schematic diagram of the preset correspondence can be seen in Figure 8-2 , Figure 8-2 The sliceAndSkip and readUnsignedShort in the method can be used as a method identifier respectively. According to the preset corresponding relationship, the target method identifier corresponding to the target object can be determined.

[0124] Step 840, searching for methods with target annotations in at least one tool class; wherein the target annotation refers to an annotation used to indicate that the call of the rule engine is allowed and includes a target method identifier.

[0125] Optionally, each tool class in the at least one tool class may include a plurality of methods. In step 840, the at least one tool class may be traversed to search for methods with target annotations from the at least one tool class.

[0126] In an example, the target method is identified as sliceAndSkip, and the target annotation may be in the following form: @ExposeAction(value = "sliceAndSkip", parameters = {"byteBuf", "length"}); wherein @ExposeAction is used to indicate that the call of the rule engine is allowed, and parameters are method-related parameters.

[0127] Step 850, calling the method with the target annotation to assist the running of the message processing rule code.

[0128] In step 850, the execution of the message processing rule code can be assisted by calling the method with the target annotation. For example, by calling the method with the target annotation, it can be made clear whether to treat the message to be processed as a signed message or to treat the message to be processed as an unsigned message. For another example, by calling the method with the target annotation, it can be made clear which byte to start reading when reading bytes in the message to be processed. In one example, the first two bytes can be omitted and reading can start from the third byte.

[0129] Figure 8-1 In the illustrated embodiment, at least one tool class can be created on the first device, and at least one tool class can be loaded as a Spring Bean. For at least one tool class, the method that the rule engine may need to call can be annotated with the annotation of the rule engine. In addition, the correspondence between the object and the method identifier can be preset. During the running of the message processing rule code, by determining the target object identifier, the target object, the target method identifier in turn, and searching for the method with the target annotation, the call to the method with the target annotation can be achieved. In this way, the link for calling the method in the tool class can be opened, thereby assisting the running of the message processing rule code, which is conducive to ensuring the processing effect of the message to be processed.

[0130] Fig. 9 It is a flowchart of a message processing method provided by some other exemplary embodiments of the present disclosure. Fig. 9 The method shown can be applied to a second device deployed with a rule engine. Fig. 9 The method shown may include step 910 , step 920 , and step 930 .

[0131] Step 910: receiving user input operations on the visual interface corresponding to the rule engine.

[0132] Optionally, the input operation may include but is not limited to a touch input operation, a voice input operation, a keyboard input operation, a mouse input operation, etc.

[0133] Step 920: Based on the input operation, the message processing rule code of the rule engine is updated.

[0134] Optionally, in response to an input operation, part of the code of the message processing rule of the rule engine may be deleted, part of the code may be added, part of the code may be modified, etc., thereby implementing an update of the message processing rule code of the rule engine.

[0135] Step 930, sending the latest message processing rule code of the rule engine to the first device; wherein the first device is used to receive the data stream to be processed sent by the third device, determine the message to be processed based on the data stream to be processed, and process the message to be processed based on the message processing rule code sent by the second device.

[0136] Optionally, the second device may send the latest message processing rule code of the rule engine to the first device regularly or irregularly. For example, the second device may send the message processing rule code to the first device every 10 seconds. For another example, the second device may send the message processing rule code to the first device each time the message processing rule code is updated.

[0137] In the embodiments of the present disclosure, the message processing rule code based on which the first device processes the message to be processed comes from the second device on which a rule engine is deployed. In this way, if the message processing rule needs to be changed, it is only necessary to update the message processing rule code of the rule engine on the second device side, and the second device will automatically push the latest message processing rule code of the rule engine to the first device, so that the first device uses the latest message processing rule to process the message. There is no need to rewrite the code and deploy it online on the first device side, so that the effect of hot deployment can be achieved, and changes in message processing rules are simpler to implement and at a lower cost.

[0138] In some optional examples, the second device may be deployed with a rule engine, and the structure of the message processing rule code of the rule engine may be: knowledge package—decision flow—decision set, which is a tree structure from top to bottom.

[0139] For encoding and decoding logic, a unique knowledge package identifier can be used. For example, Figure 10-1The message-codec in the message-codec can be used to identify the knowledge package.

[0140] Different decision flows can be used to distinguish different communication protocols. For example, Figure 10-1 JT808 and JT1078 may be a communication protocol respectively, and JT808 and JT1078 may have their own corresponding decision flows.

[0141] For different messages supporting the same communication protocol, they can be split in the decision flow to be distributed to the corresponding message decision center for processing. For example, Figure 10-2 The terminal general response, platform general response, terminal registration, terminal registration response, location information report, etc. in the message decision set can be respectively regarded as a message decision set. Optionally, encoding, decoding, etc. can be performed in the message decision set.

[0142] The second device can send the latest message processing rule code of the rule engine to the first device regularly or irregularly, and accordingly, the first device can receive the message processing rule code from the second device regularly or irregularly. The first device can also receive the data stream to be processed sent by the third device. The processing method of the first device for the data stream to be processed can be referred to Figure 10-3 .Depend on Figure 10-3 It can be seen that the processing of the data flow to be processed may involve two stages, namely, the pipeline inbound message processing stage and the pipeline outbound message processing stage.

[0143] The Pipeline inbound message processing stage can be processed as follows:

[0144] (1) Segment, escape and restore the data stream to be processed to obtain the message to be processed (corresponding to Figure 10-3 Steps 1 and 2 in the above example);

[0145] (2) Parse the message header in the message to be processed into entity classes (corresponding to Figure 10-3 Enter step 3 in the above);

[0146] (3) If the message body in the message to be processed is encrypted, decrypt the message body in the message to be processed (corresponding to Figure 10-3 Enter step 4 in the above);

[0147] (4) The parsing result of the message header in the message to be processed (corresponding to the first decoding result above) and the plain text of the message body in the message to be processed are handed over to the message processing rule code to parse the message body in the message to be processed (corresponding to Figure 10-3 Step 5 in the above);

[0148] (5) The authentication processor authenticates the message to be processed. If the authentication fails, the message to be processed is discarded (corresponding to Figure 10-3 Enter step 6 in the above);

[0149] (6) Perform corresponding business processing according to the message type (through the messageID mentioned above) to determine the reply message body (corresponding to Figure 10-3 Enter step 7 in the above);

[0150] (7) Maintaining sessions based on heartbeat information (corresponding to Figure 10-3 Step 8 in the input), which can be specifically used to maintain a long connection between the first device and the third device.

[0151] The outbound message processing stage of the Pipeline can be processed as follows:

[0152] (1) If the authentication of the message to be processed is successful, the session is initialized and the device is reconnected (corresponding to Figure 10-3 Step 1 in the output);

[0153] (2) Based on the message processing rule code, encode the reply message body (corresponding to Figure 10-3 Step 2 in the output);

[0154] (3) Determine whether the reply message body is encrypted based on the reply message header (corresponding to Figure 10-3 Step 3 in the above example);

[0155] (4) Encode the reply message header (corresponding to Figure 10-3 Step 4 in the figure);

[0156] (5) Calculate the padding check code, perform escape processing, and add a flag bit for auxiliary segmentation to obtain the reply data stream (corresponding to Figure 10-3 Step 5 in the figure).

[0157] In this way, communication between the first device and the third device can be achieved. In addition, if the decoding rules and encoding rules are to be changed, the message processing rule code of the rule engine only needs to be updated on the second device side, and the second device will automatically push the latest message processing rule code of the rule engine to the first device, so that the first device uses the latest decoding rules and encoding rules for decoding and encoding processing. Therefore, the change of decoding rules and encoding rules is very simple to implement and low cost.

[0158] It should be noted that in the related art, if the message processing rules are to be changed, the R&D personnel need to modify the background code at the first device and deploy it online after testing. In comparison, the embodiment of the present disclosure only requires the operation personnel to operate on the visual interface corresponding to the rule engine to update the message processing rule code, and submit the rule engine after a simple test. There is no need to redeploy the background code at the first device and go online, which can achieve the effect of hot deployment, so it can respond to changes quickly and improve system stability. At the same time, during the research and development stage, it can free R&D personnel from inefficient and repetitive encoding and decoding work, allowing R&D personnel to focus more on the processing of business logic.

[0159] Exemplary Devices

[0160] Fig.11 It is a structural diagram of a message processing device provided by some exemplary embodiments of the present disclosure. Fig.11 The device shown is applied to a first device, Fig.11 The device shown includes:

[0161] The first receiving module 1110 is used to receive the latest message processing rule code of the rule engine sent by the second device on which the rule engine is deployed;

[0162] The second receiving module 1120 is used to receive a data stream to be processed sent by a third device;

[0163] A first determining module 1130, configured to determine a message to be processed based on a data stream to be processed;

[0164] The processing module 1140 is used to process the message to be processed based on the message processing rule code.

[0165] In some optional examples, the processing module 1140 includes:

[0166] A first decoding submodule, configured to decode a message header in a message to be processed according to a preset message header decoding rule to obtain a first decoding result;

[0167] A second decoding submodule is used to decode the message body in the message to be processed based on the message processing rule code and the first decoding result to obtain a second decoding result;

[0168] A generating submodule, used for generating a reply data stream based on the first decoding result, the second decoding result, a preset message header encoding rule, and a message processing rule code;

[0169] The sending submodule is used to send a reply data stream to the third device.

[0170] In some optional examples, submodules are generated, including:

[0171] A first determining unit, configured to determine a reply message header based on the first decoding result;

[0172] A first encoding unit, used to encode the reply message header according to a preset message header encoding rule to obtain a first encoding result;

[0173] A second determining unit, configured to determine a reply message body based on the second decoding result;

[0174] A second encoding unit, used to encode the reply message body based on the message processing rule code to obtain a second encoding result;

[0175] The generating unit is used to generate a reply data stream based on the first encoding result and the second encoding result.

[0176] In some optional examples, the processing module 1140 includes:

[0177] A determination submodule, used to determine a target communication protocol between the first device and the third device;

[0178] A screening submodule, used to screen the code portion corresponding to the target communication protocol from the message processing rule code;

[0179] The processing submodule is used to process the message to be processed based on the code part corresponding to the target communication protocol.

[0180] In some optional examples, the first device is deployed with at least one tool class for assisting the running of the message processing rule code of the rule engine, and an object corresponding to each of the at least one tool class;

[0181] like Fig.12 As shown, the device provided by the embodiment of the present disclosure also includes:

[0182] The second determination module 1210 is used to determine the target object identifier in the process of processing the message to be processed based on the message processing rule code;

[0183] The third determination module 1220 is used to determine the target object having the target object identifier;

[0184] A fourth determination module 1230 is used to determine a target method identifier corresponding to the target object;

[0185] A search module 1240 is used to search for a method with a target annotation in at least one tool class; wherein the target annotation refers to an annotation used to indicate that the rule engine is allowed to be called and includes a target method identifier;

[0186] The calling module 1250 is used to call the method with the target annotation to assist the running of the message processing rule code.

[0187] Fig.13 It is a structural diagram of a message processing device provided by some other exemplary embodiments of the present disclosure. Fig.13 The apparatus shown is applied to a second device deployed with a rule engine, Fig.13 The device shown includes:

[0188] The third receiving module 1310 is used to receive the user's input operation on the visual interface corresponding to the rule engine;

[0189] An updating module 1320, used to update the message processing rule code of the rule engine based on the input operation;

[0190] The sending module 1330 is used to send the latest message processing rule code of the rule engine to the second device; wherein the first device is used to receive the data stream to be processed sent by the third device, determine the message to be processed based on the data stream to be processed, and process the message to be processed based on the message processing rule code sent by the second device.

[0191] In the device of the present disclosure, the various optional embodiments, optional implementation methods and optional examples disclosed above can be flexibly selected and combined as needed to achieve corresponding functions and effects, and the present disclosure does not list them one by one.

[0192] Exemplary Electronic Devices

[0193] Below, reference Fig.14 The electronic device according to the embodiment of the present disclosure is described. The electronic device may be any one or both of the first device and the second device, or a stand-alone device independent of them, and the stand-alone device may communicate with the first device and the second device to receive the collected input signals from them.

[0194] Fig.14 A block diagram of an electronic device 1400 according to an embodiment of the present disclosure is illustrated.

[0195] like Fig.14 As shown, electronic device 1400 includes one or more processors 1410 and memory 1420 .

[0196] The processor 1410 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 1400 to perform desired functions.

[0197] The memory 1420 may store one or more computer program products, and the memory 1420 may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program products may be stored on the computer-readable storage medium, and the processor 1410 may run the computer program product to implement the contract-based data processing method and / or other desired functions of the various embodiments of the present disclosure described above. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.

[0198] In one example, the electronic device 1400 may further include: an input device 1430 and an output device 1440 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0199] For example, when the electronic device 1400 is the first device or the second device, the input device 1430 may be a microphone or a microphone array. When the electronic device 1400 is a stand-alone device, the input device 1430 may be a communication network connector for receiving collected input signals from the first device and the second device.

[0200] In addition, the input device 1430 may also include, for example, a keyboard, a mouse, and the like.

[0201] The output device 1440 can output various information to the outside, and can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto.

[0202] Of course, to simplify, Fig.14 Only some of the components related to the present disclosure in the electronic device 1400 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 1400 may also include any other appropriate components.

[0203] Exemplary computer program products and computer-readable storage media

[0204] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the method according to various embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of this specification.

[0205] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the disclosed embodiments, 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 computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0206] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, causes the processor to execute the steps of the method according to various embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.

[0207] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0208] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.

[0209] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0210] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.

[0211] The method and apparatus of the present disclosure may be implemented in many ways. For example, the method and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure may also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.

[0212] It should also be noted that in the apparatus, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.

[0213] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0214] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A message processing method, characterized in that: Applied to a first device, the method includes: Receiving the latest message processing rule code of the rule engine sent by a second device on which the rule engine is deployed; receiving a data stream to be processed sent by a third device; Determining a message to be processed based on the data stream to be processed; Based on the message processing rule code, the message to be processed is processed.

2. The method according to claim 1, characterized in that The processing of the to-be-processed message based on the message processing rule code includes: Decoding the message header in the message to be processed according to a preset message header decoding rule to obtain a first decoding result; Based on the message processing rule code and the first decoding result, decoding the message body in the message to be processed to obtain a second decoding result; Generate a reply data stream based on the first decoding result, the second decoding result, a preset message header encoding rule, and the message processing rule code; The reply data stream is sent to the third device.

3. The method according to claim 2, characterized in that The generating of a reply data stream based on the first decoding result, the second decoding result, a preset message header encoding rule, and the message processing rule code, and generating a reply message corresponding to the message to be processed, includes: Determine a reply message header based on the first decoding result; Encode the reply message header according to a preset message header encoding rule to obtain a first encoding result; Determine a reply message body based on the second decoding result; Based on the message processing rule code, encode the reply message body to obtain a second encoding result; A reply data stream is generated based on the first encoding result and the second encoding result.

4. The method according to claim 1, characterized in that The processing of the to-be-processed message based on the message processing rule code includes: determining a target communication protocol between the first device and the third device; Filtering the code portion corresponding to the target communication protocol from the message processing rule code; The message to be processed is processed based on the code portion corresponding to the target communication protocol.

5. The method according to any one of claims 1 to 4, characterized in that: The first device is deployed with at least one tool class for assisting the running of the message processing rule code of the rule engine, and objects corresponding to each of the at least one tool class; The method further comprises: In the process of processing the message to be processed based on the message processing rule code, determining a target object identifier; determining a target object having the target object identifier; Determining a target method identifier corresponding to the target object; In the at least one tool class, searching for a method with a target annotation; wherein the target annotation refers to: an annotation used to indicate that the rule engine is allowed to be called and includes the target method identifier; The method with the target annotation is called to assist in running the message processing rule code.

6. A message processing method, characterized in that: Applied to a second device deployed with a rule engine, the method includes: Receiving an input operation from a user on a visual interface corresponding to the rule engine; Based on the input operation, updating the message processing rule code of the rule engine; Send the latest message processing rule code of the rule engine to the first device; wherein the first device is used to receive the data stream to be processed sent by the third device, determine the message to be processed based on the data stream to be processed, and process the message to be processed based on the message processing rule code sent by the second device.

7. A message processing device, characterized in that: Applied to a first device, the apparatus comprises: A first receiving module, configured to receive the latest message processing rule code of the rule engine sent by a second device on which the rule engine is deployed; A second receiving module, used for receiving a data stream to be processed sent by a third device; A first determining module, configured to determine a message to be processed based on the data stream to be processed; A processing module is used to process the message to be processed based on the message processing rule code.

8. A message processing device, characterized in that: Applied to a second device deployed with a rule engine, the apparatus comprises: A third receiving module is used to receive a user's input operation on the visual interface corresponding to the rule engine; An updating module, used for updating the message processing rule code of the rule engine based on the input operation; A sending module is used to send the latest message processing rule code of the rule engine to the first device; wherein the first device is used to receive the data stream to be processed sent by the third device, determine the message to be processed based on the data stream to be processed, and process the message to be processed based on the message processing rule code sent by the second device.

9. An electronic device, characterized in that: include: A memory for storing a computer program product; A processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, the message processing method according to any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the message processing method according to any one of claims 1 to 6 is implemented.

11. A computer program product comprising computer program instructions, characterized in that When the computer program instructions are executed by a processor, the message processing method described in any one of 1 to 6 above is implemented.