CN115118772A - Message communication system and method - Google Patents

Message communication system and method Download PDF

Info

Publication number
CN115118772A
CN115118772A CN202210705802.7A CN202210705802A CN115118772A CN 115118772 A CN115118772 A CN 115118772A CN 202210705802 A CN202210705802 A CN 202210705802A CN 115118772 A CN115118772 A CN 115118772A
Authority
CN
China
Prior art keywords
node
message
target
bus
session
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210705802.7A
Other languages
Chinese (zh)
Inventor
卞晓瑜
肖鸣林
涂佳伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yida Technology Shanghai Co ltd
Original Assignee
Yida Technology Shanghai Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yida Technology Shanghai Co ltd filed Critical Yida Technology Shanghai Co ltd
Priority to CN202210705802.7A priority Critical patent/CN115118772A/en
Publication of CN115118772A publication Critical patent/CN115118772A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Abstract

The application discloses a system and a method for message communication, wherein the method comprises the following steps: and responding to an instruction for sending the event message to the second node through the first node, executing local event work, constructing a routing four-tuple comprising a source node id, a source node session id and a target node id which are distributed to the first node by the message bus, and a target node session id which is distributed to the second node by the message bus, combining a result of executing the event work and the routing four-tuple to serve as a target message, and forwarding the target message to the second node by the message bus according to the target node id and the target node session id of the routing four-tuple. Therefore, the communication of each node is dominated by the message bus, so that each node can directly carry out message communication with the nodes of the target session only by routing through the message bus, the number of the layered nodes is greatly reduced, and the communication efficiency among the nodes is improved.

Description

Message communication system and method
Technical Field
The present application relates to the field of information communication, and more particularly, to a system and method for message communication.
Background
With the continuous development of information technology, the communication of online information is spread throughout daily life, people continuously pursue high-performance communication equipment, in recent years, the configuration parameters on the communication equipment are higher and higher, the performance of the communication equipment is also continuously optimized, the information communication speed in the equipment is also continuously improved, the mode of information communication is also layered, and the high-quality experience of people on information communication is met.
The current message communication mode inside the device is shown in fig. 1, a communication system has a plurality of nodes, one of the two nodes is used as a service end node to perform port monitoring, and the other node is used as a client node to be connected to a port, so that full-duplex communication is established between the two nodes. Examples are that if the Studio node is used as a server node, the Engine node and the Assist node are connected to the Studio node as client nodes, the Assist node is used as a server node, and the PluginA node is connected to the Assist node as a client node.
However, when the communication system has a plurality of layers and a complex network topology, it may be necessary to communicate between two nodes through a plurality of nodes instead to achieve a simple function, which results in low communication efficiency.
Disclosure of Invention
In view of the above problems, the present application is provided to provide a system and a method for message communication to improve communication efficiency between nodes.
In order to achieve the above object, the following specific solutions are proposed:
a system for communicating messages, comprising: the system comprises a plurality of nodes and a message bus, wherein each node is in communication connection with the message bus, each node is provided with a node id corresponding to the node, each node stores the node id corresponding to each node and the bus id of the message bus, the node for sending the message is used as a first node, each node for receiving the message is used as a second node, the message bus distributes a source node session id to the node for sending the message, and the message bus distributes a target node session id corresponding to each node for receiving the message;
the first node is used for responding to an instruction of sending an event message to a single second node, executing event work of a local node, determining a result of the executed event work, constructing a routing quadruple including a source node id, a source node session id, a target node id and a target node session id by taking a node id of the local node as the source node id and a node id of the second node as the target node id, combining the result and the routing quadruple to be used as a first target message, and sending the first target message to the message bus;
the message bus is used for sending the first target message to the second node according to a routing four-tuple, a target node id and a target node session id in the first target message sent by the first node.
Optionally, before the first node sends the first target message to the message bus, the first node is further configured to:
and encrypting the first target message in a message body encryption mode to obtain an encrypted first target message, so that after the message bus sends the encrypted first target message to a second node, the second node decrypts the encrypted first target message in a message body decryption mode corresponding to the message body encryption.
Optionally, the allocating, by the message bus, a source node session id to a node that sends a message includes:
the message bus determines the id value of the latest distribution from the prestored id value distribution records;
the message bus adds 1 to the id value which is distributed last time, if the obtained result exceeds 4 byte integer, 1 is taken as the session id value of the source node to be distributed, and if the obtained result does not exceed 4 byte integer, the obtained result is taken as the session id value of the source node to be distributed;
the message bus judges whether the session id value of the source node to be distributed is matched with the id value in the pre-stored id value distribution record;
if yes, the message bus takes the session id value of the source node to be distributed as a new id value distributed last time, and the step that the message bus adds 1 to the id value distributed last time is returned to;
if not, the message bus takes the session id value of the source node to be distributed as the session id of the source node;
the message bus assigns the source node session id to the node that sent the message.
Optionally, the allocating, by the message bus, a target node session id corresponding to each node receiving the message includes:
the message bus determines the id value of the latest distribution from the pre-stored id value distribution record for each node receiving the message;
the message bus adds 1 to the id value which is distributed last time, if the obtained result exceeds 4 byte integer, 1 is taken as the session id value of the target node to be distributed, and if the obtained result does not exceed 4 byte integer, the obtained result is taken as the session id value of the target node to be distributed;
the message bus judges whether the session id value of the target node to be distributed is matched with the id value in the pre-stored id value distribution record;
if yes, the message bus takes the session id value of the target node to be distributed as a new id value distributed last time, and the step that the message bus adds 1 to the id value distributed last time is returned to;
if not, the message bus takes the target node session id value to be distributed as a target node session id;
the message bus assigns the target node session id to the node receiving the message.
Optionally, the event work is a human-computer interaction operation;
the first node, in response to an instruction to send an event message to only a single second node, performing an event job of a local node and determining a result of the performed event job, comprising:
the first node activates a human-computer interaction interface based on the instruction for executing the operation of human-computer interaction;
and the first node responds to the operation of the event executed by the user on the human-computer interaction interface and determines the result of the event work executed.
Optionally, the event message is a request-type event message;
the message bus is further configured to:
setting the message type of the first target message as a request type, and sending the first target message of the request type to the second node;
the second node is configured to receive an instruction for notifying execution of response event work from the message bus, execute the response event work of a local node, determine a response result of the executed response event work, interchange a value of a source node id and a value of a target node id in the routing quadruple, interchange a value of a source node session id and a value of a target node session id in the routing quadruple, obtain a new routing quadruple, combine the new routing quadruple and the response result as a response message, and send the response message to the message bus, so that the message bus sends the response message to the first node according to the routing quadruple, the target node id and the target node session id in the response message.
Optionally, the first node is further configured to:
responding to an instruction of sending an event message subscribing to a push type to at least two second nodes, executing push event work of a local node, determining that the result of the executed push event work is a push message, constructing a bus route quadruple including a source node id, the source node session id, a bus id of a message bus and a bus session id by taking a node id of the local node as the source node id and 0 as the bus session id, combining the push message and the bus route quadruple to be used as a second target message, and sending the second target message to the message bus;
the message bus is further configured to:
and setting the message type of the second target message as a push type, and sending the push message in the second target message of the push type to each second node which is subscribed with the push message of the first node in advance.
A message communication method is applied to a message bus, the message bus is in communication connection with a plurality of nodes, each node has a node id corresponding to the node, each node stores the node id corresponding to each node and the bus id of the message bus, a node sending a message is taken as a first node, each node receiving the message is taken as a second node, a source node session id is distributed to the node sending the message, and a target node session id corresponding to each node receiving the message is distributed to each node receiving the message, and the method comprises the following steps:
receiving a first target message sent by the first node, wherein the first target message is composed of a routing four-tuple and a first target message, the routing four-tuple is formed by using a node id of the first node as a source node id, using a node id of the second node as a target node id, and constructing the source node session id and the target node id, and the first target message is obtained by responding to an instruction that the first node sends an event message to a single second node;
and sending the first target message to the second node according to the target node id and the target node session id of the routing four-tuple in the first target message.
Optionally, the event message is a request-type event message;
the method further comprises the following steps:
setting the message type of the first target message as a request type, and sending the first target message of the request type to the second node so that the second node can return a response message, wherein the response message is composed of a result of the second node executing response event work of the second node and a new routing four-tuple, the new routing four-tuple is obtained by exchanging a source node id value and a target node id value and exchanging a source node session id value and a target node session id value in the routing four-tuple obtained by the first node;
and sending the response message to the first node according to a target node id and a target node session id in the routing four-tuple in the response message.
Optionally, the method further includes:
receiving a second target message sent by the first node, wherein the second target message is composed of a push message obtained by the first node responding to an instruction that the first node sends a subscription push type event message to at least two second nodes, executing the push event work of the first node, and a bus route quadruple, and the bus route quadruple is constructed by taking a node id of the first node as a source node id, taking 0 as a bus session id, and constructing the source node session id and a bus id of the message bus;
and setting the message type of the second target message as a push type, and sending the push message in the second target message of the push type to each second node which is subscribed with the push message of the first node in advance.
By means of the technical scheme, the method and the device execute event work of the local node through the response of the first node to the command of sending the event message to the second node, determine the result of the executed event work, construct a routing quadruple including a source node id, a source node session id, a target node id and a target node session id by taking the node id of the local node as the source node id and the node id of the second node as the target node id, combine the result and the routing quadruple as the first target message, send the first target message to the message bus, and the message bus sends the first target message to the second node according to the routing quadruple, the target node id and the target node session id in the first target message sent by the first node. Therefore, the communication of each node is dominated by the message bus in the communication system, so that each node can directly carry out message communication with the node of the target session only by message bus routing, the number of layered nodes is greatly reduced, and the communication efficiency among the nodes is improved.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a node communication diagram of a current message communication mode within a device;
FIG. 2 is a diagram of a system architecture for implementing messaging according to an embodiment of the present application;
fig. 3 is an optional signaling flow for implementing the message communication method according to the embodiment of the present application;
fig. 4 is an alternative signaling flow for implementing message communication of request type messages according to an embodiment of the present application;
fig. 5 is an alternative signaling flow for implementing message communication of a push type message according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is an alternative system architecture for implementing message communication according to an embodiment of the present application, and as shown in fig. 1, the system architecture may include:
the message bus comprises a message bus 10, a first node 20 and a plurality of second nodes 30, wherein the first node 20 can represent a node for sending a message, the second nodes 30 can represent nodes for receiving the message, all the nodes are in communication connection with the message bus 10, each node has a node id corresponding to the node, and each node can store the node id corresponding to each node and the bus id of the message bus 10.
Specifically, the node id of each node and the bus id of the message bus 10 may be set in advance at the time of creating the message communication system.
In which a plurality of node session ids are stored in the local memory of the message bus 10 to be allocated to the node that sends the message and each node that receives the message. The message bus 10 assigns a source node session id to the node that sends the message, and the message bus 10 assigns a target node session id corresponding to each node that receives the message.
Specifically, the process of allocating the source node session id to the node sending the message by the message bus 10 may include the following steps:
s11, the message bus 10 determines the last assigned id value from the pre-stored id value assignment record.
S12, the message bus 10 adds 1 to the id value assigned last time, and determines whether the obtained result exceeds 4-byte integer, if yes, then S13 is executed, and if no, then S14 is executed.
Specifically, the 4-byte integer may represent the maximum length of the bytes of the node session id value.
S13, message bus 10 takes 1 as the source node session id value to be assigned.
Specifically, when the node session id value exceeds the maximum length of bytes due to addition of 1, 1 may be used as the source node session id value to be allocated.
S14, the message bus 10 takes the obtained result as the session id value of the source node to be allocated.
S15, the message bus 10 judges whether the session id value of the source node to be distributed is matched with the id value in the pre-stored id value distribution record, if so, S16 is executed, and if not, S17 is executed.
It will be appreciated that since the message bus 10 assigns each node a different value of node session id, it is necessary to check at the time of assignment whether there is an assigned value of id.
S16, the message bus 10 takes the session id value of the source node to be distributed as the new id value distributed last time, and returns to execute S12.
S17, the message bus 10 takes the session id value of the source node to be distributed as the session id of the source node.
S18, message bus 10 assigns the source node session id to the message sending node.
The process of the message bus 10 assigning a target node session-id corresponding to each message-receiving node may include the steps of:
s21, the message bus 10 determines, for each node that receives a message, the most recently assigned id value from the pre-stored id value assignment record.
S22, the message bus 10 adds 1 to the id value which is distributed last time, judges whether the obtained result exceeds 4 byte integer, if yes, executes S23, if no, executes S24.
Specifically, a 4-byte integer may represent the maximum length of the node session id value bytes.
S23, message bus 10 takes 1 as the target node session id value to be assigned.
Specifically, when the node session id value exceeds the maximum length of bytes due to addition of 1, 1 may be used as the target node session id value to be allocated.
S24, the message bus 10 takes the obtained result as the session id value of the target node to be allocated.
S25, the message bus 10 judges whether the session id value of the target node to be distributed is matched with the id value in the pre-stored id value distribution record, if so, S16 is executed, and if not, S17 is executed.
It will be appreciated that since the message bus 10 assigns each node a different value of node session id, it is necessary to check at the time of assignment whether there is an assigned value of id.
S26, the message bus 10 takes the session id value of the target node to be distributed as the new id value distributed last time, and returns to execute S22.
S27, the message bus 10 takes the value of the target node session id to be distributed as the target node session id.
S28, message bus 10 assigns the target node session id to the node receiving the message.
The first node 20, in response to an instruction to send an event message to only a single second node 30, may perform an event job of a local node and determine a result of the performed event job, construct a routing quad including a source node id, a source node session id, a destination node id, and a destination node session id with a node id of the local node as the source node id and a node id of the second node 30 as the destination node id, combine the result and the routing quad as a first destination message, and send the first destination message to the message bus 10.
The message bus 10 may send the first target message to the second node 30 according to the target node id and the target node session id of the route quadruple in the first target message.
Based on the system architecture shown in fig. 1, fig. 2 shows an optional signaling flow for implementing a message communication method provided in an embodiment of the present application, and referring to fig. 2, the flow may include:
step S101, the first node 20, in response to the instruction to send the event message to only the single second node 30, performs the event work of the local node, and determines the result of the performed event work.
Specifically, the first node 20 executes the event job of the local node after receiving the instruction of notifying execution of the event job from the message bus 10, and the execution type of the event job may be divided into an execution type of independent completion and an execution type of interactive completion.
Step S102, the first node 20 uses the node id of the local node as the source node id, and uses the node id of the second node 30 as the target node id, and constructs a routing four-tuple including the source node id, the source node session id, the target node id, and the target node session id.
Wherein the node id of the second node 30 is determined by the first node 20 after obtaining the session id of the target node to be allocated to the second node 30, which is sent by the message bus 10.
Specifically, a source node id and a source node session id in the routing quadruple may be used as a unique identifier of a node that initiates a current session, and a target node id and a target node session id in the routing quadruple may be used as a unique identifier of a node that receives a message.
Step S103, the first node 20 combines the result and the route quadruple as a first target message.
Specifically, the route quadruplet may be parsed from a header of the first target message.
Step S104, the first node 20 sends the first target message to the message bus 10.
Step S105, the message bus 10 sends the first target message to the second node 30 according to the target node id and the target node session id of the route quadruple in the first target message.
It can be understood that the message bus 10 may perform inter-node routing, analyze the unique identifier of the node receiving the message in the routing quadruple obtained by the message header of the first target message, and after receiving the first target message, may send the first target message to the second node 30 by using the unique identifier of the node receiving the message in the routing quadruple.
In the message communication method provided by this embodiment, the first node 20 responds to an instruction for sending an event message to only a single second node 30, executes event work of a local node, and determines a result of the executed event work, a route quadruple including a source node id, a source node session id, a target node id, and a target node session id is constructed with the node id of the local node as the source node id and the node id of the second node 30 as the target node id, the result and the route quadruple are combined as a first target message, the first target message is sent to the message bus 10, and the message bus 10 sends the first target message to the second node 30 according to the route quadruple, the target node id, and the target node session id in the first target message sent by the first node 20. Therefore, the communication of each node is dominated by the message bus in the communication system, so that each node can directly carry out message communication with the node of the target session only by message bus routing, the number of layered nodes is greatly reduced, and the communication efficiency among the nodes is improved.
In some embodiments of the present application, in view of security of node communication, each node needs to encrypt a communication message after generating the communication message, and based on this, an embodiment of the present application provides a method for encrypting a communication message, where this embodiment may further add a process of encrypting a first target message before the first node 20 sends the first target message to the message bus 10, where the process may specifically include:
and encrypting the first target message in a message body encryption mode to obtain an encrypted first target message, so that after the message bus sends the encrypted first target message to a second node, the second node decrypts the encrypted first target message in a message body decryption mode corresponding to the message body encryption.
It can be understood that, in the process of sending a message to the message bus 10 by the first node 20, to ensure the security of message transmission, the message bus 10 needs to verify whether the transmitted message is originated by the first node 20, so after receiving the first target message sent by the message bus 10, the second node 30 may decrypt the first target message by means of message body decryption corresponding to the message body encryption manner, if decryption is successful, the message transmission process is secure, and if decryption is failed, the first target message is likely to be tampered, the second node 30 may delete the first target message that may be tampered, and feed back the message bus 10 to initiate an instruction to the first node 20 again.
According to the message communication method provided by the embodiment, the first node 20 encrypts the first target message when generating the first target message, so that the security of node communication is effectively ensured.
In some embodiments of the present application, the event task may be a human-machine interaction operation, and the process of the first node 20 executing the event task of the local node in response to an instruction to send an event message to only a single second node 30 and determining a result of the executed event task in the above-mentioned embodiments is described, and the process may include:
and S1, the first node 20 activates a human-computer interaction interface based on the instruction for executing the human-computer interaction operation.
For example, the first node 20 may be a ChromeNaticeMsg plug-in, and the node event works in a human-computer interaction manner, that is, after receiving a click of a user, the first node needs to acquire an element selected by the user, and when the ChromeNaticeMsg plug-in receives an instruction of notifying the message bus 10 of executing the event work, the ChromeNaticeMsg plug-in activates a human-computer interaction interface capable of receiving the click of the user.
S2, the first node 20 responds to the operation of the event executed by the user on the man-machine interaction interface, and determines the result of the executed event work.
For example, when the user clicks on a selection element on the human-computer interaction interface, the ChromeNaticeMsg plug-in determines the selected element as the result of the current event job.
Considering that the first node 20 and the second node 30 may initiate a session based on a request-type message and the second node 30 needs to respond to the session, based on this, when the event message is a request-type event message, the embodiment of the present application provides another method for message communication, which is described in conjunction with fig. 4 and may include:
in step S201, the first node 20 executes event work of the local node in response to an instruction to send an event message only to a single second node 30, and determines a result of the executed event work.
Step S202, the first node 20 uses the node id of the local node as the source node id, and uses the node id of the second node 30 as the target node id, and constructs a routing four-tuple including the source node id, the source node session id, the target node id, and the target node session id.
Step S203, the first node 20 combines the result and the routing quadruple as a first target message.
Step S204, the first node 20 sends the first target message to the message bus 10.
The steps S201 to S204 correspond to the steps S101 to S104 of the previous embodiment one to one, and the detailed description is omitted here for brevity.
Step S205, the message bus 10 sets the message type of the first target message as the request type.
Specifically, the setting of the message type of the first target message as the request type may be set based on an instruction in response to the first node transmitting the event message of the request type only to the single second node.
Step S206, the message bus 10 sends the first target message of the request type to the second node 30 according to the target node id and the target node session id of the route quadruple in the first target message.
Step S207, the second node 30 receives the instruction that the message bus 10 notifies to execute the response event job, executes the response event job of the local node, and determines the response result of the executed response event job.
Specifically, the instruction for notifying execution of the response event task, which is received by the second node 30, may be generated and sent by the message bus 10 based on the first target message, after receiving the instruction for notifying execution of the response event task by the message bus 10, the second node 30 executes the response event task of the local node, and the execution type of the response event task may be divided into an independently completed execution type and an interactively completed execution type.
Step S208, the second node 30 exchanges the value of the source node id and the value of the destination node id in the routing quadruple, and exchanges the value of the source node session id and the value of the destination node session id in the routing quadruple, so as to obtain a new routing quadruple.
It is understood that when the second node 30 needs to send a communication message to the first node 20, the second node 30 can act as a session initiator, the first node 20 can act as a message receiver, and then the value of the source node id and the value of the destination node id in the routing quadruple can be exchanged, and the value of the source node session id and the value of the destination node session id in the routing quadruple can be exchanged to obtain a new routing quadruple.
Step S209, the second node 30 combines the new routing quadruple with the response result as a response message.
Step S210, the second node 30 sends a response message to the message bus 10.
Step S211, the message bus 10 sends the response message to the first node 20 according to the route quadruplet, the target node id and the target node session id in the response message.
It is understood that the message bus 10 may perform inter-node routing, and the routing quadruple obtained by parsing the message header of the response message includes the unique identifier of the node receiving the message, and after receiving the response message, may route the unique identifier of the node receiving the message in the quadruple, and send the response message to the second node 30.
In the message communication method provided in this embodiment, the first target message of the request type is sent to the second node 30 through the message bus 10, after the second node 30 processes the obtained response result, the value of the source node id and the value of the target node id in the original routing quadruple are transferred, and the value of the source node session id and the value of the target node session id in the original routing quadruple are transferred to obtain a new routing quadruple, so that the response message is obtained and sent to the first node 20 through the message bus 10, thereby implementing the message communication of the event message of the request type.
In some embodiments of the present application, considering that the first node 20 may need to push messages to a plurality of different second nodes 30, the present application provides a method for push message communication, which is described with reference to fig. 5.
Step S301, the first node 20 responds to the instruction for sending the event message of the subscription push type to the at least two second nodes 30, executes the push event job of the local node, and determines that the result of the executed push event job is the push message.
Specifically, the first node 20 may execute the push event task of the local node after receiving the instruction triggered by the service.
Step S302, the first node 20 uses the node id of the local node as the source node id, and uses 0 as the bus session id, to construct a bus route quadruple including the source node id, the source node session id, the bus id of the message bus 10, and the bus session id.
It will be appreciated that since the first node 20 is not routed to a single second node 30, a bus routing quad is constructed whose target node is the message bus 10 and whose node session id is the session id of the message bus 10 for routing to the message bus 10.
Step S303, the first node 20 combines the push message and the bus route quadruplet as a second target message.
Specifically, the bus route quadruplet may be parsed from a header of the second targeted message.
Step S304, the first node 20 sends the second target message to the message bus 10.
Step S305, the message bus 10 sets the message type of the second target message as the push type based on the bus id of the message bus 10 of the routing quadruple in the second target message and the bus session id.
It is understood that, in the route quadruplet parsed from the second target message sent by the first node 20, the message bus 10 can identify a local id and a bus session id with a value of 0, which may indicate that the first node 20 needs to send a push message to at least two second nodes 30, so that the message bus 10 may set the message type of the second target message as the push type.
Further, the message bus 10 may decrypt the second target message encrypted by the message body in a message body decryption manner corresponding to the message body encryption manner, so as to obtain the decrypted second target message.
Step S306, the message bus 10 sends the push message in the second target message of the push type to each second node 30 that subscribes to the push message of the first node 10 in advance.
Specifically, before pushing the push message to each second node 30, the message bus 10 may encrypt the push message in a message body encryption manner, so that after receiving the encrypted push message, each second node 30 decrypts the push message in a message body decryption manner corresponding to the message body encryption manner, to obtain the push message.
It is understood that, due to the business requirement, the receiver of the push message may be a fixed node that is bound in advance, so when the fixed node initiates the push message as the first node 20, the message bus 10 may search for the receiver of the push message that is subscribed to the first node 20 in advance, and then send the push message to the second node 30 as the receiver, and other receivers (other second nodes 30).
In the message communication method provided by this embodiment, the route target is set as the message bus when the first node 20 creates the route quadruplet, so that the message bus 10 can obtain the information of the push message of the first node 20 when the route quadruplet is obtained by parsing, and the push message in the second target message is pushed to each second node 30, so that each node can directly perform message communication with the node of the target session only through the message bus route, thereby greatly reducing the number of hierarchical nodes and improving the communication efficiency between nodes.
Next, in some embodiments of the present application, a method of message communication is described from the perspective of the message bus 10 as a routing core.
Specifically, the method may include:
and S1, receiving the first target message sent by the first node 20.
Specifically, the first target message is composed of a result of the first node 20 performing an event job of the first node 20 in response to an instruction of the first node 20 to send an event message only to a single second node 30, and a route quadruple.
The routing quadruplet is constructed by using a node id of the first node 20 as a source node id, using a node id of the second node 30 as a target node id, and using a session id of the source node and the target node id.
S2, sending the first target message to the second node 30 according to the route quadruple, the target node id and the target node session id in the first target message.
The message communication method provided in this embodiment routes the first target message to the second node 30 by receiving the first target message sent by the first node 20 and according to the routing quadruple in the first target message created by the first node 20. Therefore, in the whole message communication process, two nodes are communicated in a message bus 10 routing mode, the number of layered nodes is greatly reduced, and the communication efficiency between the nodes is improved.
In some embodiments of the present application, when the event message is a request-type event message, the process of responding by the second node 30 may further be included on the basis that the message bus 10 sends the first target message to the second node 30, and specifically, the process may include:
s1, setting the message type of the first target message as a request type, and sending the first target message of the request type to the second node 30, so that the second node 30 returns a response message.
Specifically, the response message is composed of the result of the second node 30 performing the response event work of the second node 30, and the new route quadruple.
The new routing quadruple is obtained by interchanging a value of a source node id and a value of a target node id, and interchanging a value of a session id of the source node and a value of a session id of the target node in the routing quadruple acquired by the first node 20.
S2, sending the response message to the first node 20 according to the target node id and the target node session id in the route quadruple in the response message.
In the message communication method provided in this embodiment, when the second node 30 receives the first target message of the request type, the second node executes the work and determines the result of the work of the response event, and exchanges the id values corresponding to the session initiator and the session receiver in the original route quadruple, so that the message bus 10 can send the response message to the first node 20 serving as the new message receiver according to the information of the target node in the new route quadruple.
In some embodiments of the present application, in view of the fact that the first node 20 may need to push a message to a plurality of different second nodes 30, the present application provides a method for push message communication, which may specifically include:
and S1, receiving the second target message sent by the first node 20.
Specifically, the second target message is composed of a bus route quadruple, in which the first node 20 responds to an instruction that the first node 20 sends an event message of a subscription push type to at least two second nodes 30, and executes a push message obtained by a push event operation of the first node 20.
The bus route quadruplet is constructed by using a node id of the first node 20 as a source node id, using 0 as a bus session id, and the allocated source node session id and the bus id of the message bus.
S2, setting the message type of the second target message as a push type, and sending the push message in the second target message of the push type to each second node 30 that subscribes to the push message of the first node 20 in advance.
In the message communication method provided in this embodiment, by receiving the second target message sent by the first node 20, when the message bus 10 parses the second target message to obtain the route quadruple, the message bus can obtain the information of the push message of the first node 20, so as to push the push message in the second target message to each second node 30, so that each node can directly perform message communication with the node of the target session only through the message bus route, thereby greatly reducing the number of hierarchical nodes and improving the communication efficiency between nodes.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, the embodiments may be combined as needed, and the same and similar parts may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A system for communicating messages, comprising: the system comprises a plurality of nodes and a message bus, wherein each node is in communication connection with the message bus, each node is provided with a node id corresponding to the node, each node stores the node id corresponding to each node and the bus id of the message bus, the node for sending the message is used as a first node, each node for receiving the message is used as a second node, the message bus distributes a source node session id to the node for sending the message, and the message bus distributes a target node session id corresponding to each node for receiving the message;
the first node is used for responding to an instruction of sending an event message to a single second node, executing event work of a local node, determining a result of the executed event work, constructing a routing quadruple including a source node id, a source node session id, a target node id and a target node session id by taking a node id of the local node as the source node id and a node id of the second node as the target node id, combining the result and the routing quadruple to be used as a first target message, and sending the first target message to the message bus;
the message bus is used for sending the first target message to the second node according to a routing four-tuple, a target node id and a target node session id in the first target message sent by the first node.
2. The system of claim 1, wherein prior to the first node sending the first target message to the message bus, the first node is further configured to:
and encrypting the first target message in a message body encryption mode to obtain an encrypted first target message, so that after the message bus sends the encrypted first target message to a second node, the second node decrypts the encrypted first target message in a message body decryption mode corresponding to the message body encryption.
3. The system of claim 1, wherein the message bus assigns a source node session id to a node that sends a message, comprising:
the message bus determines the id value distributed last time from the prestored id value distribution record;
the message bus adds 1 to the id value which is distributed last time, if the obtained result exceeds 4 byte integer, 1 is taken as the session id value of the source node to be distributed, and if the obtained result does not exceed 4 byte integer, the obtained result is taken as the session id value of the source node to be distributed;
the message bus judges whether the session id value of the source node to be distributed is matched with the id value in the pre-stored id value distribution record;
if yes, the message bus takes the session id value of the source node to be distributed as a new id value distributed last time, and the step that the message bus adds 1 to the id value distributed last time is returned to;
if not, the message bus takes the session id value of the source node to be distributed as the session id of the source node;
the message bus assigns the source node session id to the node that sent the message.
4. The system of claim 1, wherein the message bus assigns a target node session-id to each node receiving a message corresponding to each node receiving a message, comprising:
the message bus determines the id value of the latest distribution from the pre-stored id value distribution record for each node receiving the message;
the message bus adds 1 to the id value which is distributed last time, if the obtained result exceeds 4 byte integer, 1 is taken as the session id value of the target node to be distributed, and if the obtained result does not exceed 4 byte integer, the obtained result is taken as the session id value of the target node to be distributed;
the message bus judges whether the session id value of the target node to be distributed is matched with the id value in the pre-stored id value distribution record;
if yes, the message bus takes the session id value of the target node to be distributed as a new id value distributed last time, and the step that the message bus adds 1 to the id value distributed last time is returned to;
if not, the message bus takes the target node session id value to be distributed as a target node session id;
the message bus assigns the target node session id to the node receiving the message.
5. The system of claim 1, wherein the event worker operates as a human-machine interaction;
the first node, in response to an instruction to send an event message to only a single second node, performing an event job of a local node and determining a result of the performed event job, comprising:
the first node activates a human-computer interaction interface based on the instruction for executing the operation of human-computer interaction;
and the first node responds to the operation of the event executed by the user on the human-computer interaction interface and determines the result of the event work executed.
6. The system of claim 1, wherein the event message is a request-type event message;
the message bus is further configured to:
setting the message type of the first target message as a request type, and sending the first target message of the request type to the second node;
the second node is configured to receive an instruction for notifying execution of response event work from the message bus, execute the response event work of a local node, determine a response result of the executed response event work, interchange a value of a source node id and a value of a target node id in the routing quadruple, interchange a value of a source node session id and a value of a target node session id in the routing quadruple, obtain a new routing quadruple, combine the new routing quadruple and the response result as a response message, and send the response message to the message bus, so that the message bus sends the response message to the first node according to the routing quadruple, the target node id and the target node session id in the response message.
7. The system of claim 1, wherein the first node is further configured to:
responding to an instruction of sending an event message subscribing to a push type to at least two second nodes, executing push event work of a local node, determining that the result of the executed push event work is a push message, constructing a bus route quadruple including a source node id, the source node session id, a bus id of a message bus and a bus session id by taking a node id of the local node as the source node id and 0 as the bus session id, combining the push message and the bus route quadruple to be used as a second target message, and sending the second target message to the message bus;
the message bus is further configured to:
and setting the message type of the second target message as a push type, and sending the push message in the second target message of the push type to each second node which is subscribed with the push message of the first node in advance.
8. A message communication method is applied to a message bus, the message bus is in communication connection with a plurality of nodes, each node has a node id corresponding to the node, each node stores the node id corresponding to each node and the bus id of the message bus, a node sending a message is taken as a first node, each node receiving the message is taken as a second node, a source node session id is distributed to the node sending the message, and a target node session id corresponding to each node receiving the message is distributed to each node receiving the message, the method comprises the following steps:
receiving a first target message sent by the first node, wherein the first target message is composed of a routing four-tuple and a first target message, the routing four-tuple is formed by using a node id of the first node as a source node id, using a node id of the second node as a target node id, and constructing the source node session id and the target node id, and the first target message is obtained by responding to an instruction that the first node sends an event message to a single second node;
and sending the first target message to the second node according to the target node id and the target node session id of the routing four-tuple in the first target message.
9. The method of claim 8, wherein the event message is a request-type event message;
the method further comprises the following steps:
setting the message type of the first target message as a request type, and sending the first target message of the request type to the second node so that the second node can return a response message, wherein the response message is composed of a result of the second node executing response event work of the second node and a new routing four-tuple, the new routing four-tuple is obtained by exchanging a source node id value and a target node id value and exchanging a source node session id value and a target node session id value in the routing four-tuple obtained by the first node;
and sending the response message to the first node according to a target node id and a target node session id in the routing four-tuple in the response message.
10. The method of claim 8, further comprising:
receiving a second target message sent by the first node, wherein the second target message is composed of a push message obtained by the first node responding to an instruction that the first node sends a subscription push type event message to at least two second nodes, executing the push event work of the first node, and a bus route quadruple, and the bus route quadruple is constructed by taking a node id of the first node as a source node id, taking 0 as a bus session id, and constructing the source node session id and a bus id of the message bus;
and setting the message type of the second target message as a push type, and sending the push message in the second target message of the push type to each second node which is subscribed with the push message of the first node in advance.
CN202210705802.7A 2022-06-21 2022-06-21 Message communication system and method Pending CN115118772A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210705802.7A CN115118772A (en) 2022-06-21 2022-06-21 Message communication system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210705802.7A CN115118772A (en) 2022-06-21 2022-06-21 Message communication system and method

Publications (1)

Publication Number Publication Date
CN115118772A true CN115118772A (en) 2022-09-27

Family

ID=83328934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210705802.7A Pending CN115118772A (en) 2022-06-21 2022-06-21 Message communication system and method

Country Status (1)

Country Link
CN (1) CN115118772A (en)

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008071234A1 (en) * 2006-12-14 2008-06-19 Telefonaktiebolaget Lm Ericsson (Publ) Method and apparatus for use in a communications network
CN104137520A (en) * 2014-01-10 2014-11-05 华为技术有限公司 Message pushing method and device
CN105406982A (en) * 2015-10-20 2016-03-16 北京电子工程总体研究所 CAN bus double redundancy heat backup method
US20160119468A1 (en) * 2014-10-27 2016-04-28 Vonage Network Llc Method and system for rapid internet protocol (ip) communication session setup using interactive push notifications
US20180124030A1 (en) * 2016-11-01 2018-05-03 Denso International America, Inc. Need Based Controller Area Network Bus Authentication
CN109510748A (en) * 2018-12-29 2019-03-22 北京润科通用技术有限公司 Node and node exchange method and system
CN110851061A (en) * 2019-10-08 2020-02-28 西安图唯谷创新科技有限公司 Method for controlling terminal by ring type mouse
CN111355774A (en) * 2019-08-01 2020-06-30 杭州海康威视数字技术股份有限公司 Service communication method, device and system based on P2P
CN112527525A (en) * 2020-12-11 2021-03-19 广州伊智信息科技有限公司 Distributed event bus processing method based on message queue, terminal and medium
CN112751748A (en) * 2020-12-28 2021-05-04 百果园技术(新加坡)有限公司 Session message management method, device, server and readable storage medium
WO2021087947A1 (en) * 2019-11-08 2021-05-14 Zte Corporation A method for influencing data traffic routing in a core network
CN113259476A (en) * 2021-06-10 2021-08-13 深圳市腾讯信息技术有限公司 Message pushing method and system
CN113826353A (en) * 2019-05-16 2021-12-21 思科技术公司 Decentralized internet security protocol key agreement
CN113938522A (en) * 2021-10-12 2022-01-14 中国联合网络通信集团有限公司 Event message transmission method, system, device and computer storage medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008071234A1 (en) * 2006-12-14 2008-06-19 Telefonaktiebolaget Lm Ericsson (Publ) Method and apparatus for use in a communications network
CN104137520A (en) * 2014-01-10 2014-11-05 华为技术有限公司 Message pushing method and device
US20160119468A1 (en) * 2014-10-27 2016-04-28 Vonage Network Llc Method and system for rapid internet protocol (ip) communication session setup using interactive push notifications
CN105406982A (en) * 2015-10-20 2016-03-16 北京电子工程总体研究所 CAN bus double redundancy heat backup method
US20180124030A1 (en) * 2016-11-01 2018-05-03 Denso International America, Inc. Need Based Controller Area Network Bus Authentication
CN109510748A (en) * 2018-12-29 2019-03-22 北京润科通用技术有限公司 Node and node exchange method and system
CN113826353A (en) * 2019-05-16 2021-12-21 思科技术公司 Decentralized internet security protocol key agreement
CN111355774A (en) * 2019-08-01 2020-06-30 杭州海康威视数字技术股份有限公司 Service communication method, device and system based on P2P
CN110851061A (en) * 2019-10-08 2020-02-28 西安图唯谷创新科技有限公司 Method for controlling terminal by ring type mouse
WO2021087947A1 (en) * 2019-11-08 2021-05-14 Zte Corporation A method for influencing data traffic routing in a core network
CN112527525A (en) * 2020-12-11 2021-03-19 广州伊智信息科技有限公司 Distributed event bus processing method based on message queue, terminal and medium
CN112751748A (en) * 2020-12-28 2021-05-04 百果园技术(新加坡)有限公司 Session message management method, device, server and readable storage medium
CN113259476A (en) * 2021-06-10 2021-08-13 深圳市腾讯信息技术有限公司 Message pushing method and system
CN113938522A (en) * 2021-10-12 2022-01-14 中国联合网络通信集团有限公司 Event message transmission method, system, device and computer storage medium

Similar Documents

Publication Publication Date Title
JP6737948B2 (en) Cyber security management system, method and apparatus
US5479514A (en) Method and apparatus for encrypted communication in data networks
JP3901806B2 (en) Information management system and secondary server
US9083684B2 (en) Communication node, key synchronization method, and key synchronization system
WO2019128753A1 (en) Quantum key mobile service method with low delay
CN109379772B (en) Network channel switching method, device, equipment and storage medium
JP2000299698A (en) Data communication equipment
WO2015188440A1 (en) Resource subscription processing method and device
JP2008310270A (en) Cryptographic equipment and cryptography operation method
CN115632779B (en) Quantum encryption communication method and system based on power distribution network
JP2016051921A (en) Communication system
JP2016063233A (en) Communication control device
US20050208940A1 (en) Network service system using a temporary use identifier
CN114938312B (en) Data transmission method and device
CN111342952A (en) Safe and efficient quantum key service method and system
CN101326755A (en) Digital object title and transmission information
WO2000033509A1 (en) Apparatus and method for limiting unauthorized access to a network multicast
CN115118772A (en) Message communication system and method
Soroush et al. Providing transparent security services to sensor networks
JP2004214758A (en) Mobile station, slave station, communication system, communication program, and computer-readable recording medium for recording the communication program
CN113938883A (en) Data encryption sending method and device based on intermediate node
JP2023520496A (en) Privacy communication methods between nodes and network nodes
CN111224777A (en) SDN network multicast member information encryption method, system, terminal and storage medium
CN115190168B (en) Edge server management system and server cluster
KR101888952B1 (en) Client and operation method of client

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination