Message bus method and system for efficient data forwarding
By dynamically generating and managing the message queue structure, combining the subscription tree and the Thrift communication protocol, the flexibility and efficiency of the traditional message bus system in the face of complex application environments is solved, and efficient and reliable message forwarding and processing is achieved.
Patent Information
- Application Number
- CN202410963830.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-11-19
AI Technical Summary
When traditional message bus systems face complex and changeable application environments, the static configuration mode is difficult to adapt to dynamically changing network topology and business needs, resulting in insufficient system flexibility, simplified message routing strategies, affecting data forwarding efficiency, and common messages The queue structure has become a performance bottleneck, lacking intelligent load balancing and traffic control, making it difficult to ensure the timeliness and reliability of messages.
A message bus method for efficient data forwarding is designed. By building a registration interface and subscription mechanism, the message queue structure is dynamically generated and managed, the subscription tree structure and Boolean logic combination function are used to match messages, and dynamic message routing is realized in combination with the Thrift communication protocol. Integrated load balancing and traffic control policies to ensure efficient forwarding and processing of messages.
It significantly improves the adaptability and efficiency of the system, realizes accurate matching and distribution of messages, ensures efficient routing and processing of messages, and improves the flexibility and reliability of the system, especially in the case of high concurrency and network instability.
Smart Images

Figure CN118981383A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of power station digitization, and in particular to a message bus method and system for efficient data forwarding. Background Art
[0002] With the rapid development of information technology, distributed systems and microservice architectures are becoming increasingly popular. As a key middleware technology, message bus plays a vital role in system integration, data exchange and event-driven architecture. Traditional message bus systems usually adopt fixed topology structures and static message routing strategies, which often face many challenges when processing large-scale, highly concurrent data streams. Especially in complex enterprise-level application scenarios, the timeliness, reliability and scalability of messages have become urgent issues to be solved. In recent years, with the rise of cloud computing and edge computing technologies, message bus systems are also evolving towards a more flexible, intelligent and efficient direction. However, how to achieve efficient message forwarding and dynamic adaptation while ensuring system stability is still an important issue in current technological development.
[0003] Existing message bus technologies have shown some obvious deficiencies when facing complex and ever-changing application environments. First, the traditional static configuration mode is difficult to adapt to dynamically changing network topologies and business requirements, resulting in insufficient system flexibility. Secondly, message routing strategies are often too simplistic and cannot be optimized for different types of messages and receiver characteristics, affecting the efficiency of data forwarding. In addition, when processing high-concurrency messages, the common message queue structure may become a performance bottleneck, resulting in message accumulation and increased latency. In terms of message distribution mechanisms, existing technologies often lack intelligent load balancing and flow control strategies, making it difficult to maintain stable performance when system load fluctuates. Finally, existing technologies also have room for improvement in message reliability transmission and exception handling, especially in the case of network instability or node failure, it is difficult to ensure accurate message delivery. Summary of the invention
[0004] In view of the problems existing in the existing message bus method, the present invention is proposed.
[0005] Therefore, the problem to be solved by the present invention is that the traditional static configuration mode is difficult to adapt to the dynamically changing network topology and business requirements, resulting in insufficient system flexibility.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, an embodiment of the present invention provides a message bus method for efficient data forwarding, which includes:
[0008] Construct a registration interface, formulate a subscription mechanism for the registration entity of the registration interface, and dynamically generate and manage a message queue structure based on registration and subscription information;
[0009] According to the message queue structure, a message distribution mechanism is formulated, and the message routing method is determined according to the result of the message distribution mechanism;
[0010] Messages are received and processed at the target node, achieving efficient data forwarding and message bus methods.
[0011] As a preferred solution of the message bus method for efficient data forwarding of the present invention, the subscription mechanism enables the registration entity to specify the message type, as shown in the following formula:
[0012]
[0013] Among them, M is the message feature vector, S is the subscription condition vector, B(M,S) is the Boolean logic combination function, F(M,S) is the comprehensive subscription function, C M is the message feature vector after dimension reduction;
[0014] The Boolean logic combination function is shown below:
[0015] B=(C1∧C2)∨(C3∧C4)
[0016] Among them, C i Indicates different message classification standards.
[0017] As a preferred solution of the message bus method for efficient data forwarding of the present invention, wherein: the subscription mechanism also includes a subscription tree structure;
[0018] The subscription tree structure is the concretization of the subscription mechanism at the system level. When a new message enters the system, the subscription tree structure starts from the root node, extracts and matches the key attributes of the message, and traverses the subscription tree structure in a predefined hierarchical order. At each node, the system evaluates whether the subscription conditions of the node match the message attributes. If the match is successful, the child nodes will continue to be traversed downward. If the match is not successful, the branch will be skipped. When a leaf node is reached, the system records all subscription entities associated with the node. After completing the traversal of the entire tree, all matching leaf nodes are aggregated to generate a list of entities interested in the message.
[0019] As a preferred solution of the message bus method for efficient data forwarding of the present invention, the dynamic generation and management of the message queue structure includes:
[0020] When an entity updates its subscription preferences, the corresponding nodes or branches in the subscription tree structure are updated to reflect the new subscription conditions, and the updated tree structure is traversed to identify the affected paths and leaf nodes;
[0021] For newly added subscription conditions, new leaf nodes are created at the corresponding positions of the subscription tree structure, and corresponding message queues are generated for them. For modified conditions, the properties of existing queues are adjusted. If some subscription conditions are deleted, the relevant tree nodes will be removed, and the corresponding queues will be merged or deleted. During the dynamic adjustment process, overlapping paths in the tree structure are analyzed to identify subscription combinations of shared queues.
[0022] As a preferred solution of the message bus method for efficient data forwarding of the present invention, wherein: the message distribution mechanism includes:
[0023] Extract the keyword set of the message and the keyword set of all nodes in the subscription tree structure to determine the subscription tree matching degree;
[0024] Obtain the load indicator set of the target node and determine the node load;
[0025] Get the current length and capacity of all queues at the target node to determine the congestion level;
[0026] Integrate and determine whether the message is a local node message.
[0027] As a preferred solution of the message bus method for efficient data forwarding of the present invention, the determination of node load emphasizes highly correlated matching while reducing the impact of low-correlation matching, as shown in the following formula:
[0028]
[0029] Where m is a message object; T is a subscription tree structure; K(m) is a keyword set of message m; and N(T) is a keyword set of all nodes in the subscription tree T.
[0030] As a preferred solution of the message bus method for efficient data forwarding of the present invention, wherein: the message processing includes:
[0031] When the message is a local node message, the message is stored in the queue of the specified registration information and processed differently according to different types; when a remote control message is received in the message queue, first determine which driver the message belongs to, and then determine whether the driver is registered in the platform. If it is registered in the platform, the message is stored in the message queue of the corresponding driver for cache, and the driver actively polls the queue through the Thrift communication interface to obtain the message. Otherwise, if the registration information is not found in the platform, an error is reported;
[0032] When an alarm message is received in the message queue, the message queue where the message is stored is searched according to the process registration information. If the search result returns False, an error is reported. For briefings under the alarm category, the briefing process does not need to be registered with the message bus platform system. By default, when a briefing message is received, the message is stored in the inherent briefing message queue.
[0033] When the message is a non-local node message, the destination node is determined according to the message OBID number. If there is a message cache queue of an existing destination node, it is directly added to the queue. For messages that do not have a corresponding destination node cache queue, a corresponding message cache queue is created and a special processing thread is used to monitor the cache queue of the existing destination node. If there is data, it is sent to the destination node server through the Thrift communication interface. The target node server processes the received message in the same way as the local node message.
[0034] In a second aspect, an embodiment of the present invention provides a message bus service system for efficient data forwarding, which includes:
[0035] A registration and subscription module is used to construct a registration interface, formulate a subscription mechanism for the registration entity of the registration interface, and dynamically generate and manage a message queue structure based on registration and subscription information;
[0036] A distribution processing module is used to formulate a message distribution mechanism according to the message queue structure, and determine the message routing method according to the result of the message distribution mechanism;
[0037] The message processing module is used to receive and process messages at the target node to implement efficient data forwarding and message bus methods.
[0038] In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the processor executes the computer program, it implements any step of the above-mentioned message bus method for efficient data forwarding.
[0039] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the above-mentioned message bus method for efficient data forwarding is implemented.
[0040] The beneficial effect of the present invention is that by designing and implementing a complete registration interface and a flexible subscription mechanism based on the Thrift communication protocol, dynamic registration and accurate message subscription of each component in the SCADA system are realized. The message queue is dynamically generated and managed using an efficient data structure, and a real-time update mechanism is introduced, which significantly improves the adaptability and efficiency of the system. The subscription tree structure and the message classification method based on PCA dimension reduction are innovatively introduced, combined with Boolean logic and cosine similarity calculation, to achieve accurate message matching and distribution. By dynamically adjusting the queue structure and optimizing resource use, the system achieves reasonable allocation of resources while maintaining efficient processing. In addition, the scheme also integrates a message distribution mechanism that considers many factors, including subscription matching, node load and queue congestion, to ensure efficient routing and processing of messages. For specific types of messages (such as remote control and alarm), targeted processing strategies are adopted to further improve the reliability and response speed of the system. In general, the scheme has achieved remarkable results in improving the message processing efficiency, system flexibility and reliability of the SCADA system, and provides an innovative solution for efficient data forwarding in large-scale distributed systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0042] Figure 1 Operational schematic diagram of the message bus approach for efficient data forwarding.
[0043] Figure 2 Local message processing flow diagram of the message bus method for efficient data forwarding.
[0044] Figure 3 Non-local message processing flow diagram of the message bus approach for efficient data forwarding. DETAILED DESCRIPTION
[0045] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0046] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0047] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0048] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0049] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0050] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0051] Example 1
[0052] Reference Figure 1 to Figure 3 , which is the first embodiment of the present invention, and which provides a message bus method for efficient data forwarding, comprising:
[0053] First, a complete set of registration interfaces is designed and implemented based on the Thrift communication protocol. This interface allows each process, driver and other components in the SCADA system to register their own information with the message bus service. During the registration process, each entity needs to provide key information such as a unique identifier, functional description, and processing capabilities. At the same time, a flexible subscription mechanism is built to enable the registered entity to accurately specify the message type it is interested in. The system maintains a dynamically updated registry to record all registered entities and their subscription preferences. Based on these registration and subscription information, the message bus service dynamically generates and manages the corresponding message queue structure. These queues use efficient data structures to adapt to the processing requirements of different types of messages.
[0054] In addition, a real-time update mechanism is implemented, allowing entities to dynamically modify their subscription settings at runtime, and the system can quickly adjust the corresponding queue structure. This flexible and efficient registration and subscription mechanism lays a solid foundation for the subsequent message distribution process, ensuring the accurate delivery and efficient processing of messages in the entire SCADA system.
[0055] Preferably, registered entities can precisely specify the message types they are interested in through an intuitive interface that allows entities to subscribe based on multiple criteria, including but not limited to the main category of the message (such as remote control, remote communication, telemetry, etc.), the urgency of the message, the source device or system of the message, the content keywords of the message, etc.
[0056] Specifically, the subscription mechanism is as follows:
[0057]
[0058] Among them, M is the message feature vector, S is the subscription condition vector, B(M,S) is the Boolean logic combination function, C(M) is the message classification function, and F(M,S) is the comprehensive subscription function.
[0059] More specifically, the Boolean logic combination function is shown below:
[0060] B=(C1∧C2)∨(C3∧C4)
[0061] Wherein, Ci represents different message classification standards.
[0062] The message classification function is reduced by PCA as shown below:
[0063] Y=XW
[0064] Among them, X is the original message feature matrix, W is the projection matrix, and Y is the feature matrix after dimensionality reduction.
[0065] For example, in a feasible embodiment, it is determined whether the message complies with the subscription of the registered entity as follows:
[0066] First, we use the Boolean logic combination function B(M,S) to determine the logical match between the message characteristics and the subscription conditions. If the return value is 0, it is directly considered that the message does not meet the subscription conditions; if the return value is 1, proceed to the next step.
[0067] The message features are further reduced to a low-dimensional space through the PCA dimensionality reduction function, and then the cosine similarity between the message feature vector and the subscription condition vector in the low-dimensional space is calculated.
[0068] The feature matching function is then used to evaluate the matching degree between the message features and the subscription conditions, and finally the comprehensive evaluation value is calculated through the subscription mechanism. If the value is greater than a preset threshold, the message is considered to meet the subscription conditions, otherwise it is considered not to meet the conditions.
[0069] More specifically, the cosine similarity is calculated as follows:
[0070] C M =C(M)
[0071]
[0072] Among them, M is the message feature vector, S is the subscription condition vector, and C(M) is the message classification function C M is the message feature vector after dimensionality reduction, and Similarity is the feature similarity after dimensionality reduction.
[0073] The comprehensive evaluation value is:
[0074] F(M,S)=B×Similarity
[0075] Among them, Similarity is the feature similarity after dimensionality reduction, and B is the output of the Boolean logic combination function.
[0076] Furthermore, the subscription mechanism is concretized at the system level, that is, a subscription tree structure is constructed. When a new message enters the system, the subscription tree structure starts from the root node, extracts and matches the key attributes of the message, and traverses the tree structure in a predefined hierarchical order. At each node, the system evaluates whether the subscription condition of the node matches the message attribute. If the match is successful, the child nodes will be traversed downward. If the match is not successful, the branch will be skipped. When a leaf node is reached, the system records all subscription entities associated with the node. After completing the traversal of the entire tree, all matching leaf nodes are aggregated to generate a list of entities interested in the message.
[0077] The message bus service dynamically generates and manages the message queue structure by maintaining a dynamically updated list of entities. This process begins when the entity is registered, and the system creates corresponding entries in the registry based on the information and subscription preferences provided by the entity. The system then analyzes this information and creates specialized message queues for each unique subscription combination. These queues use different data structures to adapt to the processing requirements of specific types of messages. When an entity updates its subscription preferences, the system adjusts the structure of the relevant queues or creates new queues in real time. In addition, the system also implements a dynamic merging and splitting mechanism for queues to balance processing efficiency and resource utilization. For frequently accessed queues, the system may keep copies in memory to speed up access. Through this dynamic and adaptive approach, the message bus service ensures that the message queue structure is always optimally matched to the current system needs and load conditions, thereby improving overall message processing efficiency and system responsiveness.
[0078] Preferably, when an entity updates its subscription preferences, the corresponding nodes or branches in the subscription tree are updated to reflect the new subscription conditions, and then the updated tree structure is traversed to identify the affected paths and leaf nodes, and based on these changes, the applicability of the existing queue structure is evaluated.
[0079] For newly added subscription conditions, a new leaf node is created at the corresponding position of the tree and a corresponding message queue is generated for it. For modified conditions, the properties of the existing queue are adjusted. If some subscription conditions are deleted, the relevant tree nodes will be removed and the corresponding queues will be merged or deleted. In addition, during the dynamic adjustment process, the overlapping paths in the tree structure are analyzed to identify subscription combinations that can share queues, thereby optimizing resource usage.
[0080] Furthermore, the Thrift interface is used to define message registration and subscription methods, allowing processes and drivers to dynamically register themselves and specify the message types they are interested in. Based on this registration information, the system creates a dedicated message queue in the storage object of the corresponding node for each registered entity. These queues use the generic templates defined by Thrift and can adapt to different types of message structures.
[0081] Furthermore, a message distribution mechanism is built. The message distribution mechanism integrates the subscription tree structure discussed earlier. When a new message enters the system through the Thrift interface, the trigger judgment logic first analyzes the metadata of the message. The type and target node of the message are quickly determined. For local messages, the system directly routes them to the corresponding queue in the storage object of this node. Non-local messages are forwarded to a dedicated cross-node message queue.
[0082] Preferably, the message distribution mechanism considers message priority, queue load, and optimized forwarding strategy for cross-node messages, first extracts the keyword set of the message and the keyword set of all nodes in the subscription tree, and calculates the subscription tree matching degree.
[0083] Specifically, the subscription number matching degree is calculated based on the traditional Jaccard similarity, emphasizing highly relevant matches while reducing the impact of low-relevance matches, as shown in the following formula:
[0084]
[0085] Where m is a message object; T is a subscription tree structure; K(m) is a keyword set of message m; and N(T) is a keyword set of all nodes in the subscription tree T.
[0086] Further, a load index set of the target node is obtained, and the node load is calculated according to the load index set and the corresponding weight. Specifically, the node load is calculated by comprehensively considering multiple load indicators using a weighted sum method, as shown in the following formula:
[0087]
[0088] Where n is the number of load indicators, w i is the weight of the i-th indicator, l i is the current value of the ith indicator, and max(L) is the maximum possible value of the load.
[0089] Furthermore, the current length and capacity of all queues of the target node are obtained, and the congestion degree of the queue of the target node is calculated. Specifically, the average congestion degree of multiple queues is calculated to fully reflect the overall load status of the node, as shown in the following formula:
[0090]
[0091] Where k is the number of queues, q j is the current length of the jth queue, c j is the capacity of the jth queue.
[0092] Finally, the result of the following formula is compared with the set threshold. If it is greater than the threshold, the message object is routed to the local node and becomes a local node message:
[0093]
[0094] Where m is the message object; T is the subscription tree structure; α is the subscription matching weight coefficient, S is the subscription tree matching function, which calculates the matching degree between message m and subscription tree T; β is the load balancing factor; L is the node load evaluation function, γ is the queue congestion penalty coefficient; Q is the target node queue congestion function, and δ is the smoothing factor to prevent the denominator from being zero.
[0095] When the message object is determined to be local, the message is stored in the queue of the specified registration information.
[0096] For remote control messages, when a remote control message is received in the message queue, first determine which driver the message belongs to, and then determine whether the driver is registered in the platform. If it is registered in the platform, store the message in the message queue of the corresponding driver for cache, and the driver actively polls the queue through the Thrift communication interface to obtain the message. Otherwise, if no registration information is found in the platform, an error is reported.
[0097] For alarm messages, similar to the remote control message processing mentioned above, the process needs to register itself to the platform when it is running. The alarm information searches the message queue where the message is stored based on the process registration information. If the search result returns False, an error is reported. For briefings under the alarm category, the briefing process does not need to be registered with the message bus platform system. By default, when a briefing message is received, the message is stored in the inherent briefing message queue.
[0098] For the forwarding control of non-local node messages, the destination node is determined according to the OBID number of the message object. For messages that already have a destination node cache queue, they are directly added to the queue. For messages that do not have a corresponding destination node cache queue, the corresponding message cache queue is created. The sendInfoClient program contains a special processing thread to monitor the cache queue of the existing destination node. If there is data, it is sent to the destination node server through the Thrift communication interface. The destination node server processes the received message in the same way as the local node message.
[0099] Furthermore, this embodiment also provides a message bus service system for efficient data forwarding, including:
[0100] A registration and subscription module is used to construct a registration interface, formulate a subscription mechanism for the registration entity of the registration interface, and dynamically generate and manage a message queue structure based on registration and subscription information;
[0101] A distribution processing module is used to formulate a message distribution mechanism according to the message queue structure, and determine the message routing method according to the result of the message distribution mechanism;
[0102] The message processing module is used to receive and process messages at the target node to implement efficient data forwarding and message bus methods.
[0103] This embodiment also provides a computer device, which is suitable for the case of a message bus method for efficient data forwarding, and includes a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the message bus method for efficient data forwarding proposed in the above embodiment.
[0104] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0105] This embodiment further provides a storage medium on which a computer program is stored. When the program is executed by a processor, the message bus method for realizing efficient data forwarding as proposed in the above embodiment is implemented.
[0106] The storage medium proposed in this embodiment and the data storage method proposed in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be found in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0107] Example 2
[0108] This is the second embodiment of the present invention. This embodiment provides a message bus method for efficient data forwarding. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
[0109] The new energy integrated monitoring system is used as the experimental object.
[0110] Operating environment: Ubuntu 16.04 operating system, virtual machine.
[0111] 1. Use the messageBusServer software program
[0112] 1) Start the FLXDB real-time library program;
[0113] 2) Set the communication mode: Thrift;
[0114] 3) Set communication parameters: client and server IP addresses and ports;
[0115] 4) Start the messageBusServer message bus service program.
[0116] 2. Use the sendInfoClient software program
[0117] 1) Set the communication mode: Thrift;
[0118] 2) Set communication parameters: client and server IP addresses and ports;
[0119] 3) Start the messageBusServer message bus service program.
[0120] After the program is enabled, use the host computer program to simulate sending a local node remote control message. Through the messageBusServer program process log output monitoring, it can be seen that the message bus obtains the message and stores it in the corresponding message queue. The message is parsed and processed according to the above processing logic, and the parsing results are distributed to the local for further processing.
[0121] The host computer program is used again to simulate sending a non-local node alarm message. The messageBusServer program process log observation service process stores the message in the non-local message queue, and after secondary processing, the message is handed over to the sendInfoClient software program for processing.
[0122] After receiving the alarm message, the sendInfoClient software program quickly forwards the message to the designated node server included in the message body in the multi-task thread pool to complete the message forwarding task.
[0123] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A message bus method for efficient data forwarding, Features: include, Construct a registration interface, formulate a subscription mechanism for the registration entity of the registration interface, and dynamically generate and manage a message queue structure based on registration and subscription information; According to the message queue structure, a message distribution mechanism is formulated, and the message routing method is determined according to the result of the message distribution mechanism; Messages are received and processed at the target node, achieving efficient data forwarding and message bus methods.
2. The message bus method for efficient data forwarding as claimed in claim 1, Features: The subscription mechanism enables the registering entity to specify the message type, as shown below: Among them, M is the message feature vector, S is the subscription condition vector, B(M,S) is the Boolean logic combination function, F(M,S) is the comprehensive subscription function, C M is the message feature vector after dimension reduction; The Boolean logic combination function is shown below: Among them, C i Indicates different message classification standards.
3. The message bus method for efficient data forwarding as claimed in claim 2, Features: The subscription mechanism also includes a subscription tree structure; The subscription tree structure is the concretization of the subscription mechanism at the system level. When a new message enters the system, the subscription tree structure starts from the root node, extracts and matches the key attributes of the message, and traverses the subscription tree structure in a predefined hierarchical order. At each node, the system evaluates whether the subscription conditions of the node match the message attributes. If the match is successful, the child nodes will continue to be traversed downward. If the match is not successful, the branch will be skipped. When a leaf node is reached, the system records all subscription entities associated with the node. After completing the traversal of the entire tree, all matching leaf nodes are aggregated to generate a list of entities interested in the message.
4. The message bus method for efficient data forwarding as claimed in claim 3, Features: The dynamic generation and management of the message queue structure includes: When an entity updates its subscription preferences, the corresponding nodes or branches in the subscription tree structure are updated to reflect the new subscription conditions, and the updated tree structure is traversed to identify the affected paths and leaf nodes; For newly added subscription conditions, new leaf nodes are created at the corresponding positions of the subscription tree structure, and corresponding message queues are generated for them. For modified conditions, the properties of existing queues are adjusted. If some subscription conditions are deleted, the relevant tree nodes will be removed, and the corresponding queues will be merged or deleted. During the dynamic adjustment process, overlapping paths in the tree structure are analyzed to identify subscription combinations of shared queues.
5. The message bus method for efficient data forwarding as claimed in claim 4, Features: The message distribution mechanism includes: Extract the keyword set of the message and the keyword set of all nodes in the subscription tree structure to determine the subscription tree matching degree; Obtain the load indicator set of the target node and determine the node load; Get the current length and capacity of all queues at the target node to determine the congestion level; Integrate and determine whether the message is a local node message.
6. The message bus method for efficient data forwarding as claimed in claim 5, Features: The determination of node load emphasizes highly correlated matches while reducing the impact of low-correlation matches, as shown in the following formula: Where m is a message object; T is a subscription tree structure; K(m) is a keyword set of message m; and N(T) is a keyword set of all nodes in the subscription tree T.
7. The message bus method for efficient data forwarding as claimed in claim 6, Features: The processing message comprises: When the message is a local node message, the message is stored in the queue of the specified registration information and processed differently according to different types; when a remote control message is received in the message queue, first determine which driver the message belongs to, and then determine whether the driver is registered in the platform. If it is registered in the platform, the message is stored in the message queue of the corresponding driver for cache, and the driver actively polls the queue through the Thrift communication interface to obtain the message. Otherwise, if the registration information is not found in the platform, an error is reported; When an alarm message is received in the message queue, the message queue where the message is stored is searched according to the process registration information. If the search result returns False, an error is reported. For briefings under the alarm category, the briefing process does not need to be registered with the message bus platform system. By default, when a briefing message is received, the message is stored in the inherent briefing message queue. When the message is a non-local node message, the destination node is determined according to the message OBID number. If there is a message cache queue of an existing destination node, it is directly added to the queue. For messages that do not have a corresponding destination node cache queue, a corresponding message cache queue is created and a special processing thread is used to monitor the cache queue of the existing destination node. If there is data, it is sent to the destination node server through the Thrift communication interface. The target node server processes the received message in the same way as the local node message.
8. A message bus service system for efficient data forwarding, based on the message bus method for efficient data forwarding according to any one of claims 1 to 7, Features: include, A registration and subscription module is used to construct a registration interface, formulate a subscription mechanism for the registration entity of the registration interface, and dynamically generate and manage a message queue structure based on registration and subscription information; A distribution processing module is used to formulate a message distribution mechanism according to the message queue structure, and determine the message routing method according to the result of the message distribution mechanism; The message processing module is used to receive and process messages at the target node to implement efficient data forwarding and message bus methods.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. Features: When the processor executes the computer program, the steps of the message bus method for efficient data forwarding according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, Features: When the computer program is executed by a processor, the steps of the message bus method for efficient data forwarding according to any one of claims 1 to 7 are implemented.
