A message routing method, apparatus, device, and storage medium
By introducing a protocol plugin management module and configurable rule condition processing into the IoT system, the decoupling of the communication protocol between the IoT terminal and the cloud and the flexibility of rule operation are realized. This solves the problems of high adaptation cost of the communication protocol between the IoT terminal and the cloud and insufficient flexibility of rule scenarios, and improves the adaptability and flexibility of rule configuration.
Patent Information
- Application Number
- CN202611296594.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-11-17
AI Technical Summary
The cost of adapting communication protocols between IoT terminals and the cloud is high, and the lack of flexibility in rule-based scenarios makes it difficult to adapt to changing business scenarios.
The protocol plugin management module identifies and loads plugins that conform to preset specifications when the system starts up, thereby decoupling protocol adaptation. It also uses a configuration-based mode to determine rule conditions and execution operations, thereby decoupling rule triggering from action execution.
It improves the compatibility of IoT terminals with cloud communication protocols, reduces the development cost and deployment cycle of new protocol access, and enhances the flexibility and adaptability of rule configuration.
Smart Images

Figure CN123123100A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet of Things (IoT) technology, and in particular to a message routing method, apparatus, device, and storage medium. Background Technology
[0002] In the field of IoT technology, various IoT terminals need to interact with the cloud through different communication protocols, such as MQTT, HTTP, and CoAP. These IoT devices employ a wide variety of communication protocols, and each new protocol requires the development of new adaptation code, resulting in high development costs and long development cycles. Furthermore, existing adaptation code is usually coupled with the platform's core code; adding a new protocol necessitates modifications and redeployment of the core system. New protocols are difficult to implement independently, and protocol expansion is constrained by the version iteration cycle of the core system.
[0003] In addition, the IoT platform is also equipped with a rule scenario function, which analyzes the messages sent by IoT terminals in real time and triggers corresponding rule operations when the preset rule conditions are met. However, the rule conditions and rule operations in the above rule scenario function are usually implemented in a hard-coded way, lacking flexible configuration and dynamic expansion capabilities, and are difficult to adapt to changing business scenarios.
[0004] Therefore, in the field of IoT technology, how to provide a message routing method with high protocol adaptability and flexible rule configuration is a technical problem to be solved in this field. Summary of the Invention
[0005] The main objective of this invention is to provide a message routing method, apparatus, device, and storage medium. Specifically, it aims to provide a message routing method with high protocol adaptability and flexible rule configuration.
[0006] To achieve the above objectives, the present invention provides a message routing method, the method comprising: Receive N communication messages sent by at least one IoT terminal, where N is a positive integer greater than 1; For each communication message, the communication message is converted into a corresponding standard message through the protocol plugin corresponding to the communication protocol of the communication message; the protocol plugin is a plugin that conforms to a preset specification and is loaded and initialized from a preset plugin directory when the system starts. For each of the N standard messages, determine the rule conditions that match the standard message; In response to the rule condition, perform the rule operation associated with the rule condition.
[0007] Optionally, the protocol plugin is identified and loaded through the following steps: When the system starts up, it scans the plugin directory and identifies plugins whose description information conforms to the preset specifications as protocol plugins. Each protocol plugin is loaded and initialized. After successful loading, the protocol plugin provides message extraction and encapsulation services for its corresponding communication protocol. For each communication message, the process of converting the communication message into a corresponding standard message using a protocol plugin corresponding to the communication protocol of the communication message includes: For each of the N communication messages, the message content of the communication message is extracted based on the protocol plugin corresponding to the communication protocol of the communication message; The message content is encapsulated into a standard message with a unified format. The message content includes a message timestamp, device identifier, message type, message payload, and protocol identifier. The protocol identifier is used to indicate the communication protocol corresponding to the communication message from which the standard message originates. Based on the message content, the communication message is converted into a corresponding standard message.
[0008] Optionally, determining the rule conditions that match each of the N standard messages includes: The N standard messages are transmitted to a preset message queue, and the standard messages in the message queue are sorted in order of transmission time from earliest to latest. According to the order of the N standard messages in the message queue, the rule conditions that match each standard message are determined in turn; For each standard message, extract the message content of the standard message; The message content is matched with the configuration content of each preset rule condition; Based on the matching result between the message content and the configuration content of each rule condition, the rule conditions that match the standard message are determined; The configuration content of each rule condition includes a matching field and a conditional expression; the matching of the message content with the preset configuration content of each rule condition includes: For each rule condition, the message content is retrieved according to the matching field included in the configuration content. The matching field includes at least one of device identifier, message type, message payload, and message timestamp. Determine whether the message content satisfies the constraints defined by the conditional expression, wherein the conditional expression supports at least one conditional operation among numerical comparison, string matching, and device event matching; If the conditions are met, then the standard message is determined to match the rule conditions.
[0009] Optionally, the step of performing a rule operation associated with the rule condition in response to the rule condition includes: For each of the N standard messages, if the rule conditions matching the standard message characterize the data bridging route, obtain the data bridging configuration associated with the standard message; Based on the data bridging configuration, the target executor is determined from the preset registered executors; Invoke the target executor to transmit the standard message externally; or; For each of the N standard messages, if the matching rule conditions of the standard message correspond to multiple candidate target devices, the real-time status information of each candidate target device is obtained. The real-time status information includes the current load rate, online status and average response latency. Based on the message priority carried by the standard message, a target device is selected from the multiple candidate target devices according to a preset weighted scoring rule; When the target device is offline, the standard message is written into the shadow message cache corresponding to the target device. The shadow message cache saves messages to be delivered in order of generation time from earliest to latest. After the target device comes back online, the standard messages in the shadow message cache are resent in order of their generation time from earliest to latest.
[0010] Optionally, the step of performing a rule operation associated with the rule condition in response to the rule condition further includes at least one of the following: For each of the N standard messages, if the rule condition matching the standard message represents an alarm notification, an alarm message is generated based on the message content of the standard message. Send the alarm message to an external device, and / or control the IoT terminal to send the alarm message; For each of the N standard messages, if the rule condition of the standard message matching represents reverse control, a control command is sent to the IoT terminal.
[0011] Optionally, performing the rule operation associated with the rule condition includes: An execution identifier is generated based on the message identifier of the standard message and the operation identifier of the rule operation; the message identifier is the identifier assigned during the conversion of the standard message; Query the preset idempotent deduplication table; if the idempotent deduplication table does not contain the execution identifier, execute the rule operation and write the execution identifier into the idempotent deduplication table; if the idempotent deduplication table already contains the execution identifier, skip the execution of this rule operation. After executing the rule operation associated with the rule condition, the method further includes: The execution results of each rule operation are recorded uniformly, including execution status, execution time, and error information; If the execution result fails, a retry mechanism is triggered according to a preset retry strategy, or an exception log is recorded.
[0012] Optionally, the method further includes: The newly configured rule conditions and rule operations are loaded into the shadow rule table, and the shadow rule table is validated. After successful verification, the shadow rule table is atomically switched to the effective rule table, which is used to determine the rule conditions that match the standard message; in the event of verification failure or switching failure, the effective rule table remains unchanged. The validation of the shadow rule table includes: For each newly configured rule condition in the shadow rule table, its matching field and condition expression are compared with each existing rule condition in the effective rule table to determine whether there is any overlap in matching range and / or conflict in action. In cases of overlap or conflict, generate a conflict hint containing the corresponding rule conditions and conflict type.
[0013] Furthermore, to achieve the above objectives, the present invention also provides a message routing apparatus, the apparatus comprising: The receiving module is used to receive N communication messages sent by at least one IoT terminal, where N is a positive integer greater than 1; The conversion module is used to convert each communication message into a corresponding standard message by using the protocol plugin corresponding to the communication protocol of the communication message; the protocol plugin is a plugin that is identified from a preset plugin directory and loaded and initialized when the system starts up, conforming to a preset specification. The determination module is used to determine the rule conditions that match each of the N standard messages. An execution module is used to execute rule operations associated with the rule conditions in response to the rule conditions.
[0014] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution: The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the message routing method proposed in any of the embodiments of this application.
[0015] To address the aforementioned technical problems, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the message routing methods proposed in the embodiments of this application.
[0016] To address the aforementioned technical problems, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of any of the message routing methods proposed in this application.
[0017] This application provides a message routing method, apparatus, device, and storage medium. The method includes: receiving N communication messages sent by at least one IoT terminal, where N is a positive integer greater than 1; for each communication message, converting the communication message into a corresponding standard message through a protocol plugin corresponding to the communication protocol of the communication message, wherein the protocol plugin is a plugin identified from a preset plugin directory that conforms to a preset specification and is loaded and initialized when the system starts; for each standard message, determining the rule conditions that match the standard message; and in response to the rule conditions, executing the rule operation associated with the rule conditions. In this application, the loading of protocol plugins does not depend on the modification and redistribution of the platform's core code: when the system starts, it scans the plugin directory, identifies and loads and initializes protocol plugins that conform to the preset specification. When it is necessary to support a new communication protocol, it is only necessary to put the protocol plugin that conforms to the specification into the plugin directory. This achieves complete decoupling between the device access layer and the protocol implementation layer, improves the adaptability of communication protocols between IoT terminals and the cloud, and reduces the development cost and deployment cycle of new protocol access. Furthermore, by determining the rule conditions that match the standard message, and then executing the rule operations associated with the rule conditions based on the rule conditions, this application achieves complete decoupling between rule triggering and action execution by adopting a configuration-based mode of "triggering conditions + execution actions," thereby improving the flexibility of rule configuration. Attached Figure Description
[0018] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the message routing method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the application architecture of the message routing method provided in the embodiments of this application; Figure 3This is a flowchart of the offline resending process for shadow message caching provided in an embodiment of this application; Figure 4 This is a flowchart of the idempotent deduplication judgment provided in the embodiments of this application; Figure 5 This is a flowchart of shadow rule table verification and atomic switching provided in an embodiment of this application; Figure 6 This is a schematic diagram of the application process of the message routing method provided in the embodiments of this application; Figure 7 This is a schematic diagram of the structure of the message routing device provided in the embodiments of this application; Figure 8 This is a basic structural block diagram of a computer device provided in an embodiment of this application. Detailed Implementation
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0021] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0022] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating the message routing method provided in this application embodiment. The message routing method provided in this application embodiment is applied to a message routing device, and the method includes the following steps: Step 101: Receive N communication messages sent by at least one IoT terminal, where N is a positive integer greater than 1.
[0023] The aforementioned IoT terminals include, but are not limited to, sensor devices, smart hardware devices, medical devices, and industrial equipment. These IoT terminals interact with the platform through different communication protocols.
[0024] In this step, at least N communication messages are received from at least one IoT terminal. It should be understood that the above N communication messages can be multiple messages sent by the same IoT terminal, messages sent by multiple different IoT terminals, or batch messages reported by the same IoT terminal at one time; no specific limitation is made here.
[0025] Step 102: For each communication message, the communication message is converted into a corresponding standard message through the protocol plugin corresponding to the communication protocol of the communication message; the protocol plugin is a plugin that conforms to the preset specification and is loaded and initialized from the preset plugin directory when the system starts.
[0026] It should be understood that, since different communication protocols have different message formats, encoding methods, and data encapsulation structures, in order to achieve unified processing of messages from different protocols, it is necessary to convert communication messages from different communication protocols into standard messages of a unified format.
[0027] In this embodiment, the communication protocols supported by the platform are provided in the form of protocol plugins. Specifically, upon system startup, a preset plugin directory is automatically scanned, and plugins whose descriptions conform to preset specifications are identified as protocol plugins. Each protocol plugin is then loaded and initialized. After successful loading, each protocol plugin provides message extraction and encapsulation services for its corresponding communication protocol. Therefore, the conversion in step 102 is completed by the protocol plugin corresponding to the communication protocol of each communication message: no modification to the platform's core code is required; simply adding newly developed, compliant protocol plugins to the plugin directory allows the platform to automatically load and support the corresponding communication protocol upon startup.
[0028] The aforementioned communication protocols include, but are not limited to, MQTT, EMQX, and HTTP protocols.
[0029] Step 103: For each of the N standard messages, determine the rule conditions that match the standard message.
[0030] It should be noted that the IoT platform is also equipped with a rule scenario function, where each rule scenario includes rule conditions and associated rule operations.
[0031] In this step, the matching rules for each standard message are determined. For specific implementation details, please refer to the following examples.
[0032] In other embodiments, if no rule condition matching a standard message is found, the standard message can be processed according to the default policy, such as being directly stored, discarded, or forwarded to the default channel.
[0033] Step 104: In response to the rule condition, execute the rule operation associated with the rule condition.
[0034] As mentioned above, each rule scenario includes rule conditions and associated rule operations.
[0035] In this step, after determining the rule conditions for matching the standard message, the rule operation associated with those rule conditions is triggered.
[0036] Optionally, each rule scenario is configured with an action list, and a rule condition can be associated with one or more rule operations. After a rule match is successful, all rule operations associated with that rule condition are executed sequentially according to the configured action execution order.
[0037] In some implementations, the execution results of rule operations are recorded uniformly, including success / failure status, execution time, and error messages. When execution fails, the platform can trigger a retry mechanism or record an exception log for maintenance personnel to troubleshoot.
[0038] In some implementations, when a rule condition is associated with multiple rule operations, the rule operations can be executed serially or in parallel.
[0039] In this embodiment, based on the communication protocol corresponding to each communication message, N communication messages are converted into N corresponding standard messages, thereby achieving complete decoupling between the device access layer and the protocol implementation layer and improving the compatibility of communication protocols between IoT terminals and the cloud. Furthermore, rule conditions matching the standard messages are determined, and then rule operations associated with the rule conditions are executed based on these conditions. This embodiment achieves complete decoupling between rule triggering and action execution by adopting a configurable "trigger condition + execution action" model, improving the flexibility of rule configuration.
[0040] Optionally, the protocol plugin is identified and loaded through the following steps: When the system starts up, it scans the plugin directory and identifies plugins whose description information conforms to the preset specifications as protocol plugins. Each protocol plugin is loaded and initialized. After successful loading, the protocol plugin provides message extraction and encapsulation services for its corresponding communication protocol. For each communication message, the process of converting the communication message into a corresponding standard message using a protocol plugin corresponding to the communication protocol of the communication message includes: For each of the N communication messages, the message content of the communication message is extracted based on the protocol plugin corresponding to the communication protocol of the communication message; The message content is encapsulated into a standard message with a unified format. The message content includes a message timestamp, device identifier, message type, message payload, and protocol identifier. The protocol identifier is used to indicate the communication protocol corresponding to the communication message from which the standard message originates. Based on the message content, the communication message is converted into a corresponding standard message.
[0041] In this embodiment, the message content of the communication message can be extracted based on the communication protocol corresponding to the communication message, and then the message content can be encapsulated and converted into the corresponding standard message based on the message content.
[0042] Communication protocols between various IoT devices can be achieved through Figure 2 The protocol plugin management module shown is compatible.
[0043] The protocol plugin management module includes a plugin configuration entity (PluginConfig), a plugin instance management service (PluginInstanceService), a plugin starter (PluginStartRunner), and a plugin state listener (PluginStateListener).
[0044] The plugin configuration entity stores basic information for each protocol plugin, including plugin name, plugin type, plugin status, and plugin configuration parameters.
[0045] The plugin instance management service manages running instances of loaded plugins and maintains the lifecycle status of these instances. Each plugin instance records runtime information such as the host information, port, and startup time. The plugin instance management service also supports distributed deployment and cluster management of plugins.
[0046] The plugin launcher is used to automatically scan the plugin directory when the system starts, identify protocol plugins that conform to the specifications, and complete the automatic loading and initialization of the plugins.
[0047] The plugin state listener is used to monitor runtime state changes of plugin instances and trigger corresponding processing logic when the state changes.
[0048] Specifically, taking the MQTT protocol plugin as an example, its workflow is as follows: After the MQTT protocol plugin is loaded and started, it begins listening to the message topic of the specified MQTT Broker. When an IoT terminal reports a communication message via the MQTT protocol, the MQTT protocol plugin receives the communication message, extracts the device identifier, message type, and device data payload, and encapsulates them into a standard message of a unified format.
[0049] Taking the EMQX protocol plugin as an example, its workflow is as follows: The EMQX protocol plugin configures the connection authentication information of the EMQX Broker. When an IoT terminal sends a communication message through the EMQX Broker, the EMQX Broker calls back the platform's authentication interface to verify the device's identity. After successful authentication, the EMQX Broker forwards the communication message to the platform, where the EMQX protocol plugin is responsible for message format conversion and integration into the unified message processing flow.
[0050] Taking the HTTP protocol plugin as an example, its workflow is as follows: The HTTP protocol plugin starts the HTTP server endpoint, exposing a standard RESTful interface. IoT terminals directly report communication messages to the platform via HTTP POST requests. The HTTP protocol plugin is responsible for parsing, validating, and converting the request parameters, transforming the communication messages in the HTTP request into standard messages.
[0051] In this embodiment, the loading of protocol plugins does not depend on the modification and redistribution of the platform's core code: by scanning the plugin directory during system startup, protocol plugins that conform to preset specifications are identified and loaded and initialized. When new communication protocols need to be supported, only the protocol plugins that conform to the specifications need to be placed in the plugin directory, and the platform can automatically complete the loading at startup without modifying the platform's core code. This achieves complete decoupling between the device access layer and the protocol implementation layer, improves the adaptability of communication protocols between IoT terminals and the cloud, and reduces the development cost and deployment cycle of new protocol access.
[0052] Optionally, determining the rule conditions that match each of the N standard messages includes: The N standard messages are transmitted to a preset message queue, and the standard messages in the message queue are sorted in order of transmission time from earliest to latest. According to the order of the N standard messages in the message queue, the rule conditions that match each standard message are determined in turn; For each standard message, extract the message content of the standard message; The message content is matched with the configuration content of each preset rule condition; Based on the matching result between the message content and the configuration content of each rule condition, the rule conditions that match the standard message are determined; The configuration content of each rule condition includes a matching field and a conditional expression; the matching of the message content with the preset configuration content of each rule condition includes: For each rule condition, the message content is retrieved according to the matching field included in the configuration content. The matching field includes at least one of device identifier, message type, message payload, and message timestamp. Determine whether the message content satisfies the constraints defined by the conditional expression, wherein the conditional expression supports at least one conditional operation among numerical comparison, string matching, and device event matching; If the conditions are met, then the standard message is determined to match the rule conditions.
[0053] In this embodiment, after obtaining a standard message with a unified format, the standard message is not directly matched against rules. Instead, it is first transmitted to a preset message queue. The standard messages in the message queue are ordered in ascending order of transmission time.
[0054] In this embodiment, the message consumer (MessageConsumer) sequentially retrieves standard messages from the head of the message queue and performs rule matching processing on each standard message. Optionally, after retrieving a standard message from the message queue, the message consumer sends the standard message to... Figure 2 The rule scenario engine module shown is used to determine the rule conditions that match the standard message.
[0055] In this embodiment, N standard messages are transmitted to a preset message queue. Since the standard messages in the message queue are sorted in order of transmission time from earliest to latest, the orderliness of the messages is guaranteed. Therefore, rule matching is also performed in chronological order, which ensures the correct timing of rule triggering, realizes the orderly processing of standard messages and rule matching, and guarantees the correct timing of message processing and the overall stability of the IoT platform.
[0056] In an optional implementation, the message content of the standard message is first extracted, wherein the message content includes a message timestamp, device identifier, message type, message payload, and protocol identifier; the protocol identifier is used to indicate the communication protocol corresponding to the communication message from which the standard message originates.
[0057] It should be noted that the configuration of rule conditions includes matching fields and condition expressions. The matching fields specify the message content to be matched, including at least one of device identifier, message type, message payload, and message timestamp. The condition expression defines the constraints that the corresponding matching field must satisfy, and supports at least one of numerical comparison, string matching, and device event matching. During matching, for each rule condition, the message content is evaluated according to the matching fields included in its configuration, and it is determined whether the message content satisfies the constraints defined by the condition expression. If it does, the standard message is determined to match the rule condition.
[0058] In this embodiment, after extracting the message content of the standard message, the message content is matched against the configuration content of each preset rule condition. Optionally, the above matching logic supports multiple condition operations, including numerical comparison (greater than, less than, equal to, range), string matching (equal to, contain, regular expression matching), device event matching (online, offline, attribute change), etc.
[0059] Furthermore, based on the matching results between the message content and the configuration content of each rule condition, the rule conditions that match the standard message are determined.
[0060] In this embodiment, by matching standard messages with rule conditions, a flexible rule condition matching capability is achieved. Various combinations of trigger conditions can be freely configured through the management interface without any coding changes, thus adapting to the rule requirements of different business scenarios.
[0061] It should be understood that the matching function between standard messages and rule conditions can be achieved through... Figure 2 The rule-based scenario engine module implementation is shown.
[0062] The rule scene engine module includes a rule scene configuration entity (RuleScene), an alarm configuration entity (AlertConfig), and a rule scene message handler (RuleSceneMessageHandler).
[0063] The rule scenario configuration entity is used to store the configuration information for each rule, including the rule name, triggering conditions, list of associated actions, and rule status.
[0064] The alarm configuration entity is used to store the dedicated configuration of alarm rules, including alarm level, alarm notification method, alarm recipient, etc.
[0065] The rule scenario message processor is used to query all enabled rule scenarios and match the message content of the standard message with the configuration content of the rule conditions.
[0066] The workflow of the rule-based scenario engine module is as follows: The message consumer sends standard messages to the rules and scenarios engine module; The rule scenario engine module queries all enabled rules whose trigger conditions match the current message type; The binding actions of the matching rules are executed one by one, and each action is called through a unified action execution interface; The results of action execution are recorded and processed uniformly.
[0067] Optionally, the step of performing a rule operation associated with the rule condition in response to the rule condition includes: For each of the N standard messages, if the rule conditions matching the standard message characterize the data bridging route, obtain the data bridging configuration associated with the standard message; Based on the data bridging configuration, the target executor is determined from the preset registered executors; Invoke the target executor to transmit the standard message externally; or; For each of the N standard messages, if the matching rule conditions of the standard message correspond to multiple candidate target devices, the real-time status information of each candidate target device is obtained. The real-time status information includes the current load rate, online status and average response latency. Based on the message priority carried by the standard message, a target device is selected from the multiple candidate target devices according to a preset weighted scoring rule; When the target device is offline, the standard message is written into the shadow message cache corresponding to the target device. The shadow message cache saves messages to be delivered in order of generation time from earliest to latest. After the target device comes back online, the standard messages in the shadow message cache are resent in order of their generation time from earliest to latest.
[0068] In this embodiment, when the data bridging route is characterized by the rule conditions of standard message matching, the data bridging configuration associated with the standard message is obtained. The data bridging configuration includes the bridging name, bridging type, and configuration parameters, including the target URL, topic name, message queue address, authentication information, etc.
[0069] Furthermore, based on the data bridging configuration, the target executor is determined from the pre-defined registered executors. Specifically, the target executor is determined based on the bridging type in the data bridging configuration.
[0070] The registered executors include the HTTP Data Bridge Execute, Kafka Data Bridge Execute, MQTT Data Bridge Execute, RabbitMQ Data Bridge Execute, Redis Stream Data Bridge Execute, and RocketMQ Data Bridge Execute.
[0071] In this embodiment, after the target executor is determined, the target executor is invoked to pass in the standard message and data bridging configuration as parameters, and the target executor completes the message format conversion and external transmission.
[0072] The HTTP data bridge executor is used to convert standard messages into JSON format for HTTP requests, and sends POST requests to the configured target URL through an HTTP client, supporting custom request headers and timeout configurations.
[0073] The Kafka data bridge executor is used to serialize standard messages and send them to a specified Kafka Topic. It supports configuring parameters such as Kafka cluster address and message partitioning strategy.
[0074] The MQTT data bridge executor is used to encapsulate standard messages into MQTT message format and publish them to a specified topic on a specified MQTT Broker, supporting QoS configuration.
[0075] The RabbitMQ data bridge executor is used to send standard messages to a specified RabbitMQ exchange and routing key, and supports message persistence and priority configuration.
[0076] The Redis Stream data bridge executor is used to write standard messages to a specified Redis Stream, and supports message ID generation strategies and maximum stream length limits.
[0077] The RocketMQ data bridge executor is used to send standard messages to specified RocketMQ topics and tags, supporting both synchronous and asynchronous sending modes.
[0078] Please see Figure 3 ,like Figure 3 As shown, the steps for resending standard messages based on shadow message caching include: When the matching rules for standard messages correspond to multiple candidate target devices, the real-time status information of each candidate target device is obtained; the target device is selected from the multiple candidate target devices according to the preset weighted scoring rules, based on the message priority carried by the standard message; when the target device is offline, the standard message is written into the shadow message cache corresponding to the target device; after the target device comes back online, the standard messages in the shadow message cache are resent in order of generation time from earliest to latest.
[0079] In this embodiment, by determining the target executor corresponding to the standard message and invoking that target executor to transmit the standard message, data distribution with "one-time configuration, multi-channel routing" is achieved. When a new downstream channel type needs to be added, only a new executor needs to be developed, without modifying the core code of the data bridging engine.
[0080] Optionally, when the matching rule conditions of the standard message correspond to multiple candidate target devices, the message routing device further acquires the real-time status information of each candidate target device, including the current load rate, online status, and average response latency; and, in conjunction with the message priority carried by the standard message, selects a target device from the multiple candidate target devices according to a preset weighted scoring rule to deliver the standard message. In this embodiment, dynamic optimization of routing targets based on the real-time status of devices avoids message backlog or delivery timeouts caused by selecting devices with abnormal status or excessive load based on static configuration, thus improving the real-time performance and reliability of message routing.
[0081] Optionally, when a standard message needs to be delivered to a target device, but the target device is offline, the message routing device writes the standard message into the shadow message cache corresponding to the target device. The shadow message cache stores messages to be delivered in ascending order of their generation time. After the target device comes back online, the standard messages in the shadow message cache are resent sequentially in ascending order of their generation time until the shadow message cache is empty. In this embodiment, the shadow message cache ensures that messages are not lost during device offline periods and that orderly resending occurs after the device comes back online, guaranteeing eventual consistency in message delivery. This is particularly suitable for IoT scenarios where device connections are unstable.
[0082] It should be understood that the data bridging function can be achieved through... Figure 2 The data bridging engine module shown is implemented.
[0083] The data bridging engine module includes the data bridging configuration entity (DataBridge) and the unified bridging executor interface (DataBridgeExecute).
[0084] The data bridging configuration entity stores the configuration information for each data bridging rule, including the bridging name, bridging type, and the specific configuration parameters for each type.
[0085] The unified bridging executor interface defines the core execution contract for data bridging. This interface includes the following methods: - getType(): Returns the bridge type identifier corresponding to the current executor; - execute(message, dataBridge): Receives standard messages and data bridge configuration. First, it checks whether the bridge type matches. If the match is successful, it calls the specific execution method of the subclass. - execute0(message, config): The specific message sending logic implemented by each type of executor.
[0086] The workflow of the data bridging engine module is as follows: Retrieve the associated data bridging configuration (including bridging type and specific configuration parameters). Find the corresponding executor instance from the set of registered executors; Call the executor's execute method, and the executor will perform message format conversion and sending. The result (success / failure) is sent back to the rule scenario engine module for further processing (such as logging, triggering alarms, etc.).
[0087] In this embodiment, the rule scenario engine module also uniformly records the execution result of each rule operation, including the execution status, execution time, and error information. If the execution result indicates failure, a retry mechanism is triggered according to a preset retry strategy, or the execution result is written to an exception log for troubleshooting by operations and maintenance personnel. When a rule condition is associated with multiple rule operations, each rule operation is executed sequentially or in parallel according to the execution order configured in the action list. Thus, the execution result of the rule operation is fed back to the rule scenario engine module, forming a closed loop of message processing.
[0088] Optionally, the step of performing a rule operation associated with the rule condition in response to the rule condition further includes at least one of the following: For each of the N standard messages, if the rule condition matching the standard message represents an alarm notification, an alarm message is generated based on the message content of the standard message. Send the alarm message to an external device, and / or control the IoT terminal to send the alarm message; For each of the N standard messages, if the rule condition of the standard message matching represents reverse control, a control command is sent to the IoT terminal.
[0089] In this embodiment, if a rule condition matching a standard message indicates an alarm notification, the alarm action executor is invoked. The alarm action executor obtains the alarm configuration associated with the rule condition and then generates an alarm message based on the content of the standard message and the alarm configuration. The alarm configuration includes the alarm level, alarm notification method, and alarm recipient.
[0090] One optional implementation is to send alarm messages externally. Specific methods for sending alarm messages externally include, but are not limited to, SMS notifications and email notifications.
[0091] Another optional implementation involves controlling the IoT terminal to send an alarm message. The alarm action actuator, through the protocol plug-in management module, uses the communication protocol supported by the IoT terminal to send an alarm command to the IoT terminal, causing the IoT terminal to send an alarm message through its own alarm device.
[0092] Another alternative implementation is to send alarm messages to external devices while simultaneously controlling IoT terminals to send alarm messages.
[0093] In this embodiment, under the condition that the alarm notification is represented by the rule of matching standard messages, the alarm operation is executed, thereby realizing real-time monitoring of abnormal device status and flexible alarm notification, supporting multiple notification method combinations to meet the alarm needs in different scenarios.
[0094] In this embodiment, if a standard message matches a rule condition indicating reverse control, the device reverse control action executor is invoked. The device reverse control action executor sends a control command to the target device according to the rule configuration and the standard message content. The rule configuration includes the target device identifier, control command type, control command content, and communication protocol selection.
[0095] In this embodiment, an automated closed loop from device events to device control is achieved by controlling the IoT terminal in reverse. When the data reported by the device meets specific rule conditions, the platform automatically sends control commands to the device without manual intervention, realizing intelligent automation in the IoT scenario.
[0096] Optionally, performing the rule operation associated with the rule condition includes: An execution identifier is generated based on the message identifier of the standard message and the operation identifier of the rule operation; the message identifier is the identifier assigned during the conversion of the standard message; Query the preset idempotent deduplication table; if the idempotent deduplication table does not contain the execution identifier, execute the rule operation and write the execution identifier into the idempotent deduplication table; if the idempotent deduplication table already contains the execution identifier, skip the execution of this rule operation. After executing the rule operation associated with the rule condition, the method further includes: The execution results of each rule operation are recorded uniformly, including execution status, execution time, and error information; If the execution result fails, a retry mechanism is triggered according to a preset retry strategy, or an exception log is recorded.
[0097] Please see Figure 4 ,like Figure 4 As shown, the steps for performing rule operations based on an idempotent deduplication table include: Based on the message identifier of the standard message and the operation identifier of the rule operation, an execution identifier is generated; the preset idempotent deduplication table is queried; if the idempotent deduplication table does not contain the execution identifier, the rule operation is executed and the execution identifier is written to the idempotent deduplication table; if the idempotent deduplication table already contains the execution identifier, the execution of this rule operation is skipped.
[0098] In this embodiment, to prevent rule operations from being executed repeatedly when the retry mechanism is triggered, the message routing device also provides an idempotent deduplication table. Specifically, a globally unique message identifier is assigned during standard message conversion; before executing each rule operation, an execution identifier is generated based on the message identifier of the standard message and the operation identifier of the rule operation, and the idempotent deduplication table is queried; if the idempotent deduplication table does not contain the execution identifier, the rule operation is executed and the execution identifier is written to the idempotent deduplication table; if the idempotent deduplication table already contains the execution identifier, it indicates that the rule operation has already been executed for the standard message, and the current execution is skipped. Thus, even if the standard message is consumed repeatedly or the rule operation is retried, the rule operation is executed only once, achieving exactly-once execution semantics.
[0099] Optionally, the method further includes: The newly configured rule conditions and rule operations are loaded into the shadow rule table, and the shadow rule table is validated. After successful verification, the shadow rule table is atomically switched to the effective rule table, which is used to determine the rule conditions that match the standard message; in the event of verification failure or switching failure, the effective rule table remains unchanged. The validation of the shadow rule table includes: For each newly configured rule condition in the shadow rule table, its matching field and condition expression are compared with each existing rule condition in the effective rule table to determine whether there is any overlap in matching range and / or conflict in action. In cases of overlap or conflict, generate a conflict hint containing the corresponding rule conditions and conflict type.
[0100] Please see Figure 5 ,like Figure 5 As shown, the newly configured rule conditions and rule operations are loaded into the shadow rule table; the shadow rule table is validated; if the validation passes, the shadow rule table is atomically switched to the effective rule table; if the validation or switching fails, the effective rule table remains unchanged.
[0101] Optionally, the message routing device employs a double-buffering mechanism for updating rule conditions and rule operations. Specifically, newly configured rule conditions and rule operations are loaded into a shadow rule table, and the shadow rule table is validated. If the validation passes, the shadow rule table is atomically switched to the effective rule table, which is used to determine the rule conditions that match the standard message. If the validation or switching fails, the effective rule table remains unchanged. In this embodiment, the rule configuration update process is uninterrupted in message processing and has no gaps in effectiveness, improving platform availability.
[0102] Furthermore, the aforementioned verification of the shadow rule table includes: for each newly configured rule condition in the shadow rule table, comparing its matching fields and condition expressions with the existing rule conditions in the effective rule table to determine whether there is overlap in matching scope and / or conflict in actions. If overlap or conflict exists, a conflict message containing the corresponding rule conditions and conflict type is generated for configuration personnel to review. This embodiment moves the reliability verification of rule configuration to the release stage, avoiding interference between newly added rules and existing rules during runtime.
[0103] If there is no overlap in matching ranges and / or conflicting actions, the verification is deemed successful.
[0104] To further understand the overall solution provided by the embodiments of this application, please refer to [link / reference]. Figure 6 . Figure 6 This demonstrates the complete message processing flow where the protocol plugin management module, rule scenario engine module, and data bridging engine module work together: IoT terminals report communication messages to the IoT platform via communication protocols; The protocol plugin management module receives messages, extracts device identifiers and message content, and encapsulates them into standard messages. Standard messages enter the message queue and are distributed to the rule scenario engine module by the message consumer; The rule-based scenario engine module matches trigger conditions and executes the following rule operations when the rule conditions are met; The data bridging engine module is invoked to route standard messages to the configured downstream channels; Invoke the alarm action executor to generate alarm records and push notifications; Control commands are sent to IoT devices through the protocol plug-in management module; Resend standard messages based on shadow message caching; Operations are performed based on idempotent deduplication tables.
[0105] Further reference Figure 7 As a response to the above Figure 1 The implementation of the method shown in this application provides an embodiment of a message routing device 700, which is similar to... Figure 1 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0106] An embodiment of the present invention provides a message routing device 700 comprising: The receiving module 701 is used to receive N communication messages sent by at least one IoT terminal, where N is a positive integer greater than 1; The conversion module 702 is used to convert each communication message into a corresponding standard message by using the protocol plugin corresponding to the communication protocol of the communication message; the protocol plugin is a plugin that conforms to a preset specification and is loaded and initialized from a preset plugin directory when the system starts. The determining module 703 is used to determine the rule conditions that match the standard message for each of the N standard messages; The execution module 704 is configured to execute rule operations associated with the rule conditions in response to the rule conditions.
[0107] Optionally, the message routing device 700 is further configured to: When the system starts up, it scans the plugin directory and identifies plugins whose description information conforms to the preset specifications as protocol plugins. Each protocol plugin is loaded and initialized. After successful loading, the protocol plugin provides message extraction and encapsulation services for its corresponding communication protocol. For each of the N communication messages, the message content of the communication message is extracted based on the protocol plugin corresponding to the communication protocol of the communication message; The message content is encapsulated into a standard message with a unified format. The message content includes a message timestamp, device identifier, message type, message payload, and protocol identifier. The protocol identifier is used to indicate the communication protocol corresponding to the communication message from which the standard message originates. Based on the message content, the communication message is converted into a corresponding standard message.
[0108] Optionally, the message routing device 700 is further configured to: The N standard messages are transmitted to a preset message queue, and the standard messages in the message queue are sorted in order of transmission time from earliest to latest. According to the order of the N standard messages in the message queue, the rule conditions that match each standard message are determined in turn; For each standard message, extract the message content of the standard message; The message content is matched with the configuration content of each preset rule condition; Based on the matching result between the message content and the configuration content of each rule condition, the rule conditions that match the standard message are determined; For each rule condition, the message content is retrieved according to the matching field included in the configuration content. The matching field includes at least one of device identifier, message type, message payload, and message timestamp. Determine whether the message content satisfies the constraints defined by the conditional expression, wherein the conditional expression supports at least one conditional operation among numerical comparison, string matching, and device event matching; If the conditions are met, then the standard message is determined to match the rule conditions.
[0109] Optionally, the message routing device 700 is further configured to: For each of the N standard messages, if the rule conditions matching the standard message characterize the data bridging route, obtain the data bridging configuration associated with the standard message; Based on the data bridging configuration, the target executor is determined from the preset registered executors; Invoke the target executor to transmit the standard message externally; or; For each of the N standard messages, if the matching rule conditions of the standard message correspond to multiple candidate target devices, the real-time status information of each candidate target device is obtained. The real-time status information includes the current load rate, online status and average response latency. Based on the message priority carried by the standard message, a target device is selected from the multiple candidate target devices according to a preset weighted scoring rule; When the target device is offline, the standard message is written into the shadow message cache corresponding to the target device. The shadow message cache saves messages to be delivered in order of generation time from earliest to latest. After the target device comes back online, the standard messages in the shadow message cache are resent in order of their generation time from earliest to latest.
[0110] Optionally, the message routing device 700 is further configured to perform at least one of the following: For each of the N standard messages, if the rule condition matching the standard message represents an alarm notification, an alarm message is generated based on the message content of the standard message. Send the alarm message to an external device, and / or control the IoT terminal to send the alarm message; For each of the N standard messages, if the rule condition of the standard message matching represents reverse control, a control command is sent to the IoT terminal.
[0111] Optionally, the message routing device 700 is further configured to: An execution identifier is generated based on the message identifier of the standard message and the operation identifier of the rule operation; the message identifier is the identifier assigned during the conversion of the standard message; Query the preset idempotent deduplication table; if the idempotent deduplication table does not contain the execution identifier, execute the rule operation and write the execution identifier into the idempotent deduplication table; if the idempotent deduplication table already contains the execution identifier, skip the execution of this rule operation. The execution results of each rule operation are recorded uniformly, including execution status, execution time, and error information; If the execution result fails, a retry mechanism is triggered according to a preset retry strategy, or an exception log is recorded.
[0112] Optionally, the message routing device 700 is further configured to: The newly configured rule conditions and rule operations are loaded into the shadow rule table, and the shadow rule table is validated. After successful verification, the shadow rule table is atomically switched to the effective rule table, which is used to determine the rule conditions that match the standard message; in the event of verification failure or switching failure, the effective rule table remains unchanged. For each newly configured rule condition in the shadow rule table, its matching field and condition expression are compared with each existing rule condition in the effective rule table to determine whether there is any overlap in matching range and / or conflict in action. In cases of overlap or conflict, generate a conflict hint containing the corresponding rule conditions and conflict type.
[0113] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 8 , Figure 8 This is a basic structural block diagram of the computer device in this embodiment.
[0114] The computer device 8 includes a memory 81, a processor 82, and a network interface 83 that are interconnected via a system bus. It should be noted that only the computer device 8 with components 81-83 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0115] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0116] The memory 81 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 81 may be an internal storage unit of the computer device 8, such as the hard disk or memory of the computer device 8. In other embodiments, the memory 81 may also be an external storage device of the computer device 8, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the computer device 8. Of course, the memory 81 may include both the internal storage unit and its external storage device of the computer device 8. In this embodiment, the memory 81 is typically used to store the operating platform and various application software installed on the computer device 8, such as the program code of message routing methods. In addition, the memory 81 can also be used to temporarily store various types of data that have been output or will be output.
[0117] In some embodiments, the processor 82 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 82 is typically used to control the overall operation of the computer device 8. In this embodiment, the processor 82 is used to run program code stored in the memory 81 or process data, for example, to run the program code of the message routing method.
[0118] The network interface 83 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 8 and other electronic devices.
[0119] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described message routing method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0120] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware online platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0121] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0122] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A message routing method, characterized in that, The method includes: Receive N communication messages sent by at least one IoT terminal, where N is a positive integer greater than 1; For each communication message, the communication message is converted into a corresponding standard message through the protocol plugin corresponding to the communication protocol of the communication message; the protocol plugin is a plugin that conforms to a preset specification and is loaded and initialized from a preset plugin directory when the system starts. For each of the N standard messages, determine the rule conditions that match the standard message; In response to the rule condition, perform the rule operation associated with the rule condition.
2. The method according to claim 1, characterized in that, The protocol plugin is identified and loaded through the following steps: When the system starts up, it scans the plugin directory and identifies plugins whose description information conforms to the preset specifications as protocol plugins. Each protocol plugin is loaded and initialized. After successful loading, the protocol plugin provides message extraction and encapsulation services for its corresponding communication protocol. For each communication message, the process of converting the communication message into a corresponding standard message using a protocol plugin corresponding to the communication protocol of the communication message includes: For each of the N communication messages, the message content of the communication message is extracted based on the protocol plugin corresponding to the communication protocol of the communication message; The message content is encapsulated into a standard message with a unified format. The message content includes a message timestamp, device identifier, message type, message payload, and protocol identifier. The protocol identifier is used to indicate the communication protocol corresponding to the communication message from which the standard message originates. Based on the message content, the communication message is converted into a corresponding standard message.
3. The method according to claim 1, characterized in that, For each of the N standard messages, determining the rule conditions that match the standard message includes: The N standard messages are transmitted to a preset message queue, and the standard messages in the message queue are sorted in order of transmission time from earliest to latest. According to the order of the N standard messages in the message queue, the rule conditions that match each standard message are determined in turn; For each standard message, extract the message content of the standard message; The message content is matched with the configuration content of each preset rule condition; Based on the matching result between the message content and the configuration content of each rule condition, the rule conditions that match the standard message are determined; The configuration content of each rule condition includes a matching field and a conditional expression; the matching of the message content with the preset configuration content of each rule condition includes: For each rule condition, the message content is retrieved according to the matching field included in the configuration content. The matching field includes at least one of device identifier, message type, message payload, and message timestamp. Determine whether the message content satisfies the constraints defined by the conditional expression, wherein the conditional expression supports at least one conditional operation among numerical comparison, string matching, and device event matching; If the conditions are met, then the standard message is determined to match the rule conditions.
4. The method according to claim 1, characterized in that, The step of executing a rule operation associated with the rule condition in response to the rule condition includes: For each of the N standard messages, if the rule conditions matching the standard message characterize the data bridging route, obtain the data bridging configuration associated with the standard message; Based on the data bridging configuration, the target executor is determined from the preset registered executors; Invoke the target executor to transmit the standard message externally; or; For each of the N standard messages, if the matching rule conditions of the standard message correspond to multiple candidate target devices, the real-time status information of each candidate target device is obtained. The real-time status information includes the current load rate, online status and average response latency. Based on the message priority carried by the standard message, a target device is selected from the multiple candidate target devices according to a preset weighted scoring rule; When the target device is offline, the standard message is written into the shadow message cache corresponding to the target device. The shadow message cache saves messages to be delivered in order of generation time from earliest to latest. After the target device comes back online, the standard messages in the shadow message cache are resent sequentially in order of their generation time from earliest to latest.
5. The method according to claim 1, characterized in that, The step of performing a rule operation associated with the rule condition in response to the rule condition further includes at least one of the following: For each of the N standard messages, if the rule condition matching the standard message represents an alarm notification, an alarm message is generated based on the message content of the standard message. Send the alarm message to an external device, and / or control the IoT terminal to send the alarm message; For each of the N standard messages, if the rule condition of the standard message matching represents reverse control, a control command is sent to the IoT terminal.
6. The method according to claim 1, characterized in that, The execution of the rule operation associated with the rule condition includes: An execution identifier is generated based on the message identifier of the standard message and the operation identifier of the rule operation; the message identifier is the identifier assigned during the conversion of the standard message; Query the preset idempotent deduplication table; if the idempotent deduplication table does not contain the execution identifier, execute the rule operation and write the execution identifier into the idempotent deduplication table; if the idempotent deduplication table already contains the execution identifier, skip the execution of this rule operation. After executing the rule operation associated with the rule condition, the method further includes: The execution results of each rule operation are recorded uniformly, including execution status, execution time, and error information; If the execution result fails, a retry mechanism is triggered according to a preset retry strategy, or an exception log is recorded.
7. The method according to claim 1, characterized in that, The method further includes: The newly configured rule conditions and rule operations are loaded into the shadow rule table, and the shadow rule table is validated. After successful verification, the shadow rule table is atomically switched to the effective rule table, which is used to determine the rule conditions that match the standard message; in the event of verification failure or switching failure, the effective rule table remains unchanged. The validation of the shadow rule table includes: For each newly configured rule condition in the shadow rule table, its matching field and condition expression are compared with each existing rule condition in the effective rule table to determine whether there is any overlap in matching range and / or conflict in action. In cases of overlap or conflict, generate a conflict hint containing the corresponding rule conditions and conflict type.
8. A message routing device, characterized in that, The device includes: The receiving module is used to receive N communication messages sent by at least one IoT terminal, where N is a positive integer greater than 1; The conversion module is used to convert each communication message into a corresponding standard message by using the protocol plugin corresponding to the communication protocol of the communication message; the protocol plugin is a plugin that conforms to a preset specification and is loaded and initialized from a preset plugin directory when the system starts. The determination module is used to determine the rule conditions that match each of the N standard messages. An execution module is used to execute rule operations associated with the rule conditions in response to the rule conditions.
9. A computer device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the message routing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the message routing method as described in any one of claims 1 to 7.
