An embedded communication middleware, a communication system and a control method
Patent Information
- Application Number
- CN202510418200.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2026-10-16
AI Technical Summary
[0003]订阅发布机制是一种常用的消息通信机制,广泛应用于分布式系统和消息中间件,极大的有利于系统解耦和增加系统扩展性,但目前常见的消息中间件均为分布式中间件,不设置主控节点,对于一些需要进行权限控制和数据过滤的场景不适用
[0034] Embedded communication middleware with access control and data filtering functions enables access control over the subscription and publish process, significantly reducing the number of multicast and broadcast calls within the system. It has a significant advantage in systems that require both subscription and publish flexibility and need to reduce data volume or prevent data mis-sending.
Smart Images

Figure CN122933733A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of communication technology, and specifically relates to an embedded communication middleware, communication system and control method. Background Technology
[0002] Embedded communication middleware is a type of communication software designed for embedded systems. It resides within various types of embedded systems and is responsible for communication of control commands, status data, and other information between upper-layer applications and external devices and systems. It provides various types of communication services, supports software and hardware integration, supports data interaction between various software within the embedded system, reduces the spatial / temporal coupling between software and hardware, and enables applications to quickly achieve correct porting, interoperability, and interaction.
[0003] The publish-subscribe mechanism is a commonly used message communication mechanism, widely used in distributed systems and message middleware. It greatly benefits system decoupling and increases system scalability. However, most common message middleware is distributed middleware and does not have a master node, making it unsuitable for scenarios that require access control and data filtering. Summary of the Invention
[0004] Purpose of the invention: Based on the problems in the background technology, and based on the publish-subscribe mechanism, an embedded communication middleware, communication system and control method are designed. Through the dynamic self-discovery process based on the master node and the corresponding permission control and data filtering, the publish-subscribe capability and the master node management capability are combined.
[0005] Technical solution
[0006] An embedded communication middleware is disclosed, which can be configured with four node identities: master node, backup node, backup master node, and ordinary node; each node identity establishes a subscription-publish relationship within the node; and maintains and performs communication within the node.
[0007] Ordinary nodes send Type II heartbeats and receive Type I heartbeats;
[0008] The master node sends a type I heartbeat and receives type II heartbeats from itself and other nodes;
[0009] The backup node sends Type II heartbeats and receives Type I heartbeats.
[0010] The standby master node sends a type I heartbeat and receives a type I heartbeat from the master node, as well as type II heartbeats from itself and other nodes.
[0011] Furthermore, when the standby node detects a failure of the master node, it is upgraded to a standby master node; when the standby master node detects that the master node has recovered, it is downgraded to a standby node.
[0012] Furthermore, one type of heartbeat includes: master node ID or backup change master node ID, and a heartbeat information summary table;
[0013] The heartbeat information table includes a total number of nodes and a node information table;
[0014] Each node information table includes: node ID, number of subscribed topics, channel type, channel number, set of subscribed topic IDs, and number of controlled topics.
[0015] Furthermore, the second type of heartbeat includes: the number of topics a node subscribes to and the set of subscribed topic IDs;
[0016] The subscription topic ID set contains all the subscription topic IDs of the node.
[0017] A communication system comprising at least three of the aforementioned embedded communication middleware;
[0018] At least one of the embedded communication middleware is configured as the master node;
[0019] At least one of the embedded communication middleware is configured as a backup control node;
[0020] The remaining embedded communication middleware is configured as a regular node.
[0021] A communication system control method, for the system, includes the following steps:
[0022] Step 1: Each embedded communication middleware confirms its own node identity after the system is powered on;
[0023] Step 2: The master node or standby master node generates an initial Type I heartbeat that only includes its own ID, and then generates its own Type II heartbeat;
[0024] Step 3: The master node or standby master node broadcasts a type of heartbeat;
[0025] Step 4: After receiving a Type I heartbeat, both the regular node and the backup node generate and send a Type II heartbeat.
[0026] Step 5: The master node or standby master node collects its own Type II heartbeats and the Type II heartbeats of other nodes, confirms the node ID corresponding to the Type II heartbeat, adds the node ID and corresponding information of the Type II heartbeat to the node information table to update the Type I heartbeat, compresses the updated Type I heartbeat, and returns to Step 3.
[0027] Furthermore, the second type of heartbeat is generated based on the topic ID subscribed to in this period and at this node.
[0028] Furthermore, in step four, if the standby node fails to receive a certain type of heartbeat for a certain period of time, it is upgraded to a standby master node; when it receives a certain type of heartbeat, it is downgraded to a standby control node.
[0029] Furthermore, in step five, during the update of the first type of heartbeat, the master node or the backup master node is also used to configure the online permissions of other nodes. When a node is prohibited from going online, after receiving all the second type of heartbeats, the disabled node is identified, and the addition of the disabled node's subscription information to the node information table of the first type of heartbeat is stopped.
[0030] The master node or backup master node is also used to configure the topic subscription permissions of other nodes. When a node is restricted from subscribing to a topic, after receiving a type II heartbeat from the corresponding node, it stops adding the restricted subscription topic to the node information table of type I heartbeat and increases the number of controlled topics.
[0031] Furthermore, one type of heartbeat compression process is as follows: the master node or standby master node ID is compressed into a heartbeat compression packet;
[0032] Iterate through all nodes and push the following onto each node: node ID; number of subscribed topics; network channel type; network channel ID; number of subscribed topics and topic IDs; and number of controlled topics.
[0033] In summary, the beneficial effects of the present invention are as follows:
[0034] Embedded communication middleware with access control and data filtering functions enables access control over the subscription and publish process, significantly reducing the number of multicast and broadcast calls within the system. It has a significant advantage in systems that require both subscription and publish flexibility and need to reduce data volume or prevent data mis-sending.
[0035] The technology mentioned in this patent has been tested in multiple embedded systems with good results, meeting the data communication needs between various devices and protecting critical data security while providing better application portability and scalability. Attached Figure Description
[0036] Figure 1 This is a simplified diagram of the hydraulic control system of the ground-based joint test rig;
[0037] Figure 2 This is a schematic diagram of a communication system;
[0038] Figure 3 This is a flowchart illustrating a control method for a communication system. Detailed Implementation
[0039] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0040] In this application, the terms "upper," "lower," "left," "right," "front," "rear," "top," "bottom," "inner," "outer," "middle," "vertical," "horizontal," "lateral," and "longitudinal" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are primarily for the purpose of better describing this application and its embodiments, and are not intended to limit the indicated device, element, or component to having a specific orientation, or to be constructed and operated in a specific orientation.
[0041] Furthermore, the terms "installation," "setup," "equipped with," "connection," "linking," and "socketing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral structure; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium, or an internal connection between two devices, components, or parts. Those skilled in the art can understand the specific meaning of these terms in this application based on the specific circumstances.
[0042] Based on data distribution services, this invention includes the following:
[0043] The embedded communication middleware can be configured as four types of node identities: master node, backup node, backup master node, and ordinary node.
[0044] I. Dynamic self-discovery based on the master node
[0045] 1. Four node identities were designed:
[0046] The four node identities are: master node, backup node, backup-to-master node, and ordinary node.
[0047] The functions of each node are as follows:
[0048] a) Master node:
[0049] Send a Type I heartbeat; generate its own Type II heartbeat; receive Type II heartbeats from itself and other nodes, establish a publish-subscribe relationship within the node, and dynamically update the master node's heartbeat; perform communication permission control and data filtering process control; maintain and conduct communication within the node;
[0050] b) Backup control node:
[0051] Generate its own Type II heartbeat; send Type II heartbeats; monitor the master node, and when the master node fails, upgrade to a backup master node; receive and record the master node's heartbeats, establish a publish-subscribe relationship within this node; maintain and perform communication within this node;
[0052] c) Standby master node:
[0053] Send a first-class heartbeat (initially the master node heartbeat recorded when acting as a backup node); monitor the master node, and downgrade to a backup node when the master node recovers; generate its own second-class heartbeat; receive heartbeats from itself and other nodes, establish a publish-subscribe relationship within this node, and dynamically update the master node heartbeat; perform communication permission control and data filtering process control; maintain and conduct communication within this node.
[0054] d) Ordinary nodes:
[0055] Send Type II heartbeats; receive heartbeats from the master node and the backup master node, and establish a publish-subscribe relationship within this node; maintain and perform communication within this node;
[0056] 2. Two heartbeat patterns were designed:
[0057] a) Type I heartbeat:
[0058] One type of heartbeat includes the master node ID and a heartbeat information table. The heartbeat information table contains a total number of node information tables. Each node information table contains: node ID, number of subscribed topics, channel type, channel number, set of subscribed topic IDs, and number of controlled topics. One type of heartbeat is issued by the master node and the backup master node.
[0059] typedef struct node information table
[0060] {
[0061] Node ID;
[0062] Number of topics subscribed;
[0063] Channel type;
[0064] Channel number;
[0065] Subscribe to a set of topic IDs [maximum number of topics to subscribe to];
[0066] Number of controlled topics;
[0067] };
[0068] typedef struct Class Heartbeat
[0069] {
[0070] Master node ID / Backup transformer master node ID;
[0071] Node information table [Total number of nodes];
[0072] };
[0073] b) Type II heartbeat:
[0074] Type II heartbeats consist of two parts: the number of topics a node has subscribed to and a set of topic IDs. The set of topic IDs contains all the topic IDs that a node has subscribed to. Type II heartbeats are sent by backup nodes and regular nodes.
[0075] typedef struct Type II Heartbeat
[0076] {
[0077] Number of topics subscribed;
[0078] Subscribed topic ID [Maximum number of subscribed topics];
[0079] };
[0080] 3. A dynamic self-discovery process was designed:
[0081] a) Identity verification process
[0082] An identity verification framework was designed to verify the identity of nodes after the system is powered on. For example, when using an FC network, a certain FC node is designated as the primary node and another as the backup node based on the network feedback information when it goes online. When using Ethernet, a certain IP address is designated as the primary node and another as the backup IP address. When using a hybrid network, corresponding mapping relationships can be defined.
[0083] b) A type of heartbeat broadcasting process:
[0084] 1. A type of heartbeat generation
[0085] During the initialization phase, the master or backup transformer master node will generate a heartbeat containing only the master or backup transformer master node ID.
[0086] The master or backup node periodically collects the topic ID data it subscribes to and generates the corresponding type II heartbeat.
[0087] Upon receiving a Type II heartbeat from itself or via the network, the master or standby master node, knowing the network address of the Type II heartbeat sender, finds the node ID corresponding to the Type II heartbeat according to the mapping algorithm (set in the initial stage of system adaptation). Based on the node ID, it can find the storage location of the Type II heartbeat in the Type I heartbeat table, and filter the information according to the corresponding access control (see access control method). Then, it adds the corresponding information to the master table. At this point, for Type I heartbeats:
[0088] The master node ID / standby master node ID in a heartbeat is known to itself;
[0089] The node ID, number of subscribed topics, channel type, channel number, and set of subscribed topic IDs in the node information table of the first type of heartbeat are derived from the node ID, number of subscribed topics, channel type, channel number, and set of subscribed topic IDs in the received second type of heartbeat.
[0090] In a type of heartbeat, the number of controlled topics in the corresponding node ID information table comes from the value generated after processing by the master node / standby master node.
[0091] 2. A type of heartbeat compression
[0092] To reduce transmission bandwidth, a specific compression algorithm was designed to compress a type of heartbeat:
[0093] a) Push in the master node ID of the main control or backup transformer;
[0094] b) Traverse all nodes (summarize the number of nodes) and push the following onto the nodes: node ID; number of subscribed topics; network channel type; network channel ID; number of subscribed topics and topic IDs; number of controlled topics.
[0095] Through this compression process, the maximum number of subscribed topic IDs was reduced to the number of subscribed topic IDs.
[0096] 3. A type of heartbeat multicast
[0097] The master node or backup master node will use all multicast channels to periodically multicast a type of heartbeat.
[0098] c) Type II heartbeat transmission process:
[0099] 1. Type II heartbeat generation
[0100] Ordinary nodes or backup nodes will periodically collect the topic IDs subscribed to by this node and generate corresponding Type II heartbeats;
[0101] 2. Type II heartbeat transmission
[0102] Before receiving a Type I heartbeat, ordinary nodes or backup nodes do not know the information of the master node and do not send a Type II heartbeat.
[0103] Upon receiving a Type I heartbeat, the ordinary node, having learned the network information of the master node or the backup transformer master node, sends a Type II heartbeat to the corresponding master node or the backup transformer master node according to a periodic schedule.
[0104] d) Primary / backup switchover logic
[0105] Based on the identity verification process and the type I and type II heartbeat sending process, a master-slave switchover logic was established. The master node, backup node, and ordinary nodes are determined by the identity verification process, and the backup node becomes the master node in a temporary state.
[0106] 1. The backup node switches to the primary node and becomes the backup primary node.
[0107] If a standby node does not receive a heartbeat of type I within a certain period, it will be upgraded to a standby master node. All nodes in the system will send a heartbeat of type I and temporarily act as the master node.
[0108] 2. The backup node is switched from primary to backup, becoming a backup control node.
[0109] Once the standby master node starts receiving heartbeats from the master node, it is downgraded and restored to a standby master node.
[0110] e) The complete dynamic self-discovery process:
[0111] Based on the above identity verification, type I heartbeat sending, type II heartbeat sending, and primary / standby switchover processes, a complete dynamic self-discovery process has been established:
[0112] 1. The master node or backup master node periodically broadcasts a type of heartbeat to the outside world;
[0113] 2. After receiving a Type I heartbeat, the backup node and the ordinary node periodically report Type II heartbeat information;
[0114] 3. Upon receiving Type II heartbeat information, the master node or standby master node processes it and adds the processed information to the Type I heartbeat.
[0115] 4. After receiving a heartbeat, the standby node and the ordinary node check whether their own subscription information has been added. If they have been added, they can establish a subscription and publication relationship between the node and other nodes in the domain, so as to carry out data subscription and publication normally and go online successfully.
[0116] II. Access Control and Data Filtering Based on Dynamic Self-Discovery Process
[0117] 1. An access control method was designed.
[0118] It provides a configuration interface to the upper layer, allowing the master control node and the standby transformer master node to configure node online permissions;
[0119] Based on the dynamic self-discovery process, after the master control node and the standby master node are configured with node online permissions, if a node is disabled from going online, after receiving the second type heartbeat from other ordinary nodes, the disabled node will be identified by its node ID and the corresponding subscription information will be stopped from being added to the node information table in the first type heartbeat, thereby achieving permission control over the node.
[0120] 2. A data filtering method was designed.
[0121] It provides a configuration interface to the upper layer, allowing the master node and the standby transformer master node to configure node topic subscription permissions;
[0122] After the master node and the standby master node are configured with node topic subscription permissions, if a node is restricted from subscribing to a certain topic, the data will be processed after receiving the second type heartbeat of the corresponding node. The corresponding topic will be removed, and only the remaining subscription topic information will be added to the first type heartbeat, along with the corresponding number of controlled topics.
[0123] III. Key Points of the Invention
[0124] In summary, the key points of this invention are:
[0125] A) Dynamic self-discovery based on the master node
[0126] This invention designs a dynamic self-discovery mode for implementing a subscription and publish process based on a master node.
[0127] B) Access control and data filtering based on dynamic self-discovery process
[0128] This invention is based on a dynamic self-discovery mode and incorporates access control and data filtering functions during the process.
[0129] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An embedded communication middleware, characterized in that: The embedded communication middleware can be configured with four node identities: master node, backup node, backup master node, and ordinary node; each node identity establishes a subscription-publish relationship within the node; and maintains and performs communication within the node. Ordinary nodes send Type II heartbeats and receive Type I heartbeats; The master node sends a type I heartbeat and receives type II heartbeats from itself and other nodes; The backup node sends Type II heartbeats and receives Type I heartbeats. The standby master node sends a type I heartbeat and receives a type I heartbeat from the master node, as well as type II heartbeats from itself and other nodes.
2. The embedded communication middleware according to claim 1, characterized in that: When the standby node detects that the master node has failed, it is promoted to the standby master node; when the master node detects that the master node has recovered, it is downgraded to the standby node.
3. The embedded communication middleware according to claim 1, characterized in that: One type of heartbeat includes: master node ID or backup changer master node ID, and a heartbeat information summary table; The heartbeat information table includes a total number of nodes and a node information table; Each node information table includes: node ID, number of subscribed topics, channel type, channel number, set of subscribed topic IDs, and number of controlled topics.
4. The embedded communication middleware according to claim 1, characterized in that: The second type of heartbeat includes: the number of topics subscribed to by the node and the set of subscribed topic IDs; The subscription topic ID set contains all the subscription topic IDs of the node.
5. A communication system, characterized in that: The communication system includes at least three embedded communication middleware components as described in any one of claims 1-4; At least one of the embedded communication middleware is configured as the master node; At least one of the embedded communication middleware is configured as a backup control node; The remaining embedded communication middleware is configured as a regular node.
6. A communication system control method for controlling the system of claim 5, characterized in that: Includes the following steps: Step 1: Each embedded communication middleware confirms its own node identity after the system is powered on; Step 2: The master node or standby master node generates an initial Type I heartbeat that only includes its own ID, and then generates its own Type II heartbeat; Step 3: The master node or standby master node broadcasts a type of heartbeat; Step 4: After receiving a Type I heartbeat, both the regular node and the backup node generate and send a Type II heartbeat. Step 5: The master node or standby master node collects its own Type II heartbeats and the Type II heartbeats of other nodes, confirms the node ID corresponding to the Type II heartbeat, adds the node ID and corresponding information of the Type II heartbeat to the node information table to update the Type I heartbeat, compresses the updated Type I heartbeat, and returns to Step 3.
7. The method according to claim 6, characterized in that: Type II heartbeats are generated based on the topic IDs subscribed to in this period and at this node.
8. The method according to claim 7, characterized in that: In step four, if the standby node fails to receive a certain type of heartbeat for a certain period of time, it is upgraded to a standby master node; when it receives a certain type of heartbeat, it is downgraded to a standby control node.
9. The method according to claim 8, characterized in that: In step five, during the update of the first type of heartbeat, the master node or the backup master node is also used to configure the online permissions of other nodes. When a node is prohibited from going online, after receiving all the second type of heartbeats, the disabled node is identified and the addition of the disabled node's subscription information to the node information table of the first type of heartbeat is stopped. The master node or backup master node is also used to configure the topic subscription permissions of other nodes. When a node is restricted from subscribing to a topic, after receiving a type II heartbeat from the corresponding node, it stops adding the restricted subscription topic to the node information table of type I heartbeat and increases the number of controlled topics.
10. The method according to claim 9, characterized in that: The heartbeat compression process is as follows: The master node or standby master node ID is compressed into the heartbeat compression package; Iterate through all nodes and push the following onto each node: node ID; number of subscribed topics; network channel type; network channel ID; number of subscribed topics and topic IDs; and number of controlled topics.