CN115242805B - Distributed MQTT message transmission method, transmission system and storage medium based on gossip - Google Patents

Distributed MQTT message transmission method, transmission system and storage medium based on gossip Download PDF

Info

Publication number
CN115242805B
CN115242805B CN202210656795.6A CN202210656795A CN115242805B CN 115242805 B CN115242805 B CN 115242805B CN 202210656795 A CN202210656795 A CN 202210656795A CN 115242805 B CN115242805 B CN 115242805B
Authority
CN
China
Prior art keywords
mqtt
proxy node
mqtt proxy
client
message
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.)
Active
Application number
CN202210656795.6A
Other languages
Chinese (zh)
Other versions
CN115242805A (en
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.)
Beijing Wangju Yunlian Technology Co ltd
Original Assignee
Beijing Wangju Yunlian Technology 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 Beijing Wangju Yunlian Technology Co ltd filed Critical Beijing Wangju Yunlian Technology Co ltd
Priority to CN202210656795.6A priority Critical patent/CN115242805B/en
Publication of CN115242805A publication Critical patent/CN115242805A/en
Application granted granted Critical
Publication of CN115242805B publication Critical patent/CN115242805B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the application discloses a distributed MQTT message transmission method, an MQTT message transmission system and a storage medium based on gossip, which are used for applying a gossip algorithm to the message synchronization of distributed deployment MQTT proxy nodes, so that the problem of the distributed message synchronization can be solved, and the message synchronization efficiency can be improved. The method of the embodiment of the application comprises the following steps: synchronizing topology diagram information of each MQTT proxy node in the plurality of MQTT proxy nodes and relationship information of a publishing client and a subscribing client through a gossip algorithm; after synchronization is completed, if the target issuing client issues the first theme MQTT message through the first MQTT proxy node; sending a first subject MQTT message to a second MQTT proxy node through a first MQTT proxy node, wherein the plurality of MQTT proxy nodes comprise the first MQTT proxy node and the second MQTT proxy node; and transmitting the first theme MQTT message to the target subscription client through a second MQTT proxy node, wherein the second MQTT proxy node is an MQTT proxy node directly connected with the target subscription client.

Description

Distributed MQTT message transmission method, transmission system and storage medium based on gossip
Technical Field
The application relates to the technical field of Internet of things networks, in particular to a distributed MQTT message transmission method, a transmission system and a storage medium based on gossip.
Background
Many scenarios in the field of internet of things use centralized MQTT (Message Queuing Telemetry Transport, message queue telemetry transport protocol) messaging, which is less available, and when an MQTT proxy server fails, messaging is interrupted.
Disclosure of Invention
The embodiment of the application provides a distributed MQTT message transmission method, an MQTT message transmission system and a storage medium based on gossip, which are used for applying a gossip algorithm to the message synchronization of distributed deployment MQTT proxy nodes, so that the problem of the distributed message synchronization can be solved, and the message synchronization efficiency can be improved.
The first aspect of the present application provides a distributed MQTT messaging method based on gossip, where the method is applied to an MQTT messaging system, where the MQTT messaging system includes at least one publishing client, at least one subscribing client, and a plurality of MQTT proxy nodes, and the method may include:
Synchronizing topology diagram information of each MQTT proxy node in the plurality of MQTT proxy nodes and relationship information of a publishing client and a subscribing client through a gossip algorithm;
After synchronization is completed, if the target release client releases the first theme MQTT message through the first MQTT proxy node, the at least one release client comprises the target release client;
Sending the first subject MQTT message to a second MQTT proxy node via the first MQTT proxy node, the plurality of MQTT proxy nodes comprising the first MQTT proxy node and the second MQTT proxy node;
And transmitting the first theme MQTT message to a target subscription client through the second MQTT proxy node, wherein the at least one subscription client comprises the target subscription client, and the second MQTT proxy node is an MQTT proxy node directly connected with the target subscription client.
Optionally, synchronizing the topology map information of each MQTT proxy node in the plurality of MQTT proxy nodes by using a gossip algorithm may include:
Starting the first MQTT proxy node and the second MQTT proxy node;
establishing connection between the first MQTT proxy node and the second MQTT proxy node;
Synchronizing the topology map information of the first MQTT proxy node and the relationship information of the publishing client and the subscribing client to the second MQTT proxy node, synchronizing the topology map information of the second MQTT proxy node and the relationship information of the publishing client and the subscribing client to the first MQTT proxy node, and enabling the topology map information of the first MQTT proxy node and the second MQTT proxy node and the relationship information of the publishing client and the subscribing client to be consistent.
Optionally, the method may further include:
If the topology map information of the first MQTT proxy node is updated, synchronizing the updated topology map information of the first MQTT proxy node to the second MQTT proxy node; and/or the number of the groups of groups,
And if the topology map information of the second MQTT proxy node is updated, synchronizing the updated topology map information of the second MQTT proxy node to the first MQTT proxy node.
Optionally, the topology map information of each MQTT proxy node includes: topology information of each MQTT proxy node and subscription information of a subscription client connected with each MQTT proxy node.
Optionally, the sending, by the first MQTT proxy node, the first-topic MQTT message to the second MQTT proxy node may include:
determining a second MQTT proxy node connected with a target subscription client subscribing to the first theme message according to the first theme MQTT message;
And sending the first subject MQTT message to the second MQTT proxy node through the first MQTT proxy node.
Optionally, the sending, by the first MQTT proxy node, the first-topic MQTT message to the second MQTT proxy node may include:
sending the first subject MQTT message to a third MQTT proxy node via the first MQTT proxy node;
and sending the first subject MQTT message to the second MQTT proxy node through the third MQTT proxy node.
Optionally, the publishing client is connected with the subscribing client through the MQTT proxy nodes.
A second aspect of the application provides an MQTT messaging system, which may include:
At least one publishing client, at least one subscribing client, a plurality of MQTT proxy nodes;
the MQTT proxy nodes are used for synchronizing the topological graph information of each MQTT proxy node in the MQTT proxy nodes and the relation information of the publishing client and the subscribing client through a gossip algorithm;
The target release client is used for releasing the first theme MQTT message through the first MQTT proxy node after the synchronization is completed, and the at least one release client comprises the target release client;
the first MQTT proxy node is configured to send the first subject MQTT message to a second MQTT proxy node, where the plurality of MQTT proxy nodes includes the first MQTT proxy node and the second MQTT proxy node;
The second MQTT proxy node is configured to transmit, to a target subscription client, the first theme MQTT message through the second MQTT proxy node, where the at least one subscription client includes the target subscription client, and the second MQTT proxy node is an MQTT proxy node directly connected to the target subscription client.
A third aspect of the present application provides a terminal device, which may include:
A memory storing executable program code;
A processor coupled to the memory;
the processor is configured to correspondingly perform the method according to the first aspect of the present application.
A further aspect of an embodiment of the application provides a computer readable storage medium comprising instructions which, when run on a processor, cause the processor to perform the method of the first aspect of the application.
In yet another aspect, an embodiment of the application discloses a computer program product for causing a computer to perform the method according to the first aspect of the application when the computer program product is run on the computer.
In yet another aspect, an embodiment of the present application discloses an application publishing platform, which is configured to publish a computer program product, where the computer program product, when run on a computer, causes the computer to perform the method according to the first aspect of the present application.
From the above technical solutions, the embodiment of the present application has the following advantages:
In an embodiment of the present application, a distributed MQTT messaging method based on gossip, where the method is applied to an MQTT messaging system, where the MQTT messaging system includes at least one publishing client, at least one subscribing client, and a plurality of MQTT proxy nodes, the method may include: synchronizing topology diagram information of each MQTT proxy node in the plurality of MQTT proxy nodes and relationship information of a publishing client and a subscribing client through a gossip algorithm; after synchronization is completed, if the target release client releases the first theme MQTT message through the first MQTT proxy node, the at least one release client comprises the target release client; sending the first subject MQTT message to a second MQTT proxy node via the first MQTT proxy node, the plurality of MQTT proxy nodes comprising the first MQTT proxy node and the second MQTT proxy node; and transmitting the first theme MQTT message to a target subscription client through the second MQTT proxy node, wherein the at least one subscription client comprises the target subscription client, and the second MQTT proxy node is an MQTT proxy node directly connected with the target subscription client. The method is used for applying the gossip algorithm to the message synchronization of the distributed deployment MQTT proxy node, so that the problem of the distributed message synchronization can be solved, and the message synchronization efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings used in the description of the embodiments and the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings.
FIG. 1 is a schematic diagram of a prior art centralized MQTT messaging scheme based on publish/subscribe patterns;
FIG. 2 is a schematic diagram of a Gossip algorithm according to an embodiment of the present application;
FIG. 3 is a diagram of a system architecture to which embodiments of the present application are applied;
FIG. 4A is a diagram of one embodiment of a gossip-based distributed MQTT messaging method in an application embodiment;
FIG. 4B is a schematic illustration of a gossip diffusion process;
FIG. 5 is a schematic diagram of an MQTT messaging system in accordance with embodiments of the present application;
Fig. 6 is a schematic diagram of another embodiment of an electronic device according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a distributed MQTT message transmission method, an MQTT message transmission system and a storage medium based on gossip, which are used for applying a gossip algorithm to the message synchronization of distributed deployment MQTT proxy nodes, so that the problem of the distributed message synchronization can be solved, and the message synchronization efficiency can be improved.
In order that those skilled in the art will better understand the present application, reference will now be made to the accompanying drawings in which embodiments of the application are illustrated, it being apparent that the embodiments described are only some, but not all, of the embodiments of the application. Based on the embodiments of the present application, it should be understood that the present application is within the scope of protection.
MQTT (Message Queuing Telemetry Transport, message queue telemetry transport protocol) is a "lightweight" communication protocol based on publish/subscribe (publich/subscient) mode. The communication protocol was published 1999 by IBM based on TCP (Transmission Control Protocol )/IP (Internet Protocol, internetworking protocol). The biggest advantage of MQTT is that it can provide real-time reliable messaging services to connected remote devices with very little code and limited bandwidth. As an instant messaging protocol with low cost and low bandwidth occupation, the method has wider application in the aspects of Internet of things, small-sized equipment, mobile application and the like.
The prior art methods are basically the centralized MQTT message passing mode based on the publish/subscribe mode, and specifically as shown in fig. 1, are a schematic diagram of the centralized MQTT message passing mode based on the publish/subscribe mode in the prior art. In the illustration of fig. 1:
Pubish: publishing a topic a (topicA) on behalf of the client;
Subscribe: this topicA is subscribed to on behalf of the subscriber, and subsequent messages (messages) sent by this topicA are received by the subscriber;
MQTT Broker: and the agent is used for processing the data transmission task between the clients.
Description of principle: the connected devices in the MQTT protocol are called "clients" and communicate with servers called "proxies". The proxy handles data transfer tasks between clients. Whenever a client (referred to as a "publisher") wants to distribute information, it will publish to a particular topic, and the agent then sends this information to any client (referred to as a "subscriber") that subscribes to that topic. The publisher does not need any data about the number or location of subscribers. In turn, the subscriber does not need any data about the publisher. Any client may be a publisher, a subscriber, or both. The client typically does not know the other, only the agent that acts as an intermediary.
Many scenarios in the field of internet of things use centralized MQTT messaging, which has several disadvantages:
1. The availability is low, and when the MQTT proxy server fails, message transmission is interrupted;
2. when the physical distance between the MQTT proxy server and the subscriber is far, the message transmission is time-consuming;
3. Centralized deployment is less secure and once broken, the data will be compromised.
The application provides a distributed MQTT message transmission mode based on a Gossip algorithm. The most difficult of the distributed deployment architecture is how to guarantee that multiple nodes (hosts) are configured identically, because data cannot exist on a single node (host), otherwise single point failure may occur. The Gossip algorithm is a data consistency algorithm in that each node is peer-to-peer, i.e., there is no role score. Each node in the Gossip algorithm will tell the other nodes about data changes. The method is as follows: "at most, six people can know any stranger in the world", namely "six degree separation theory", so that the information with changed data can be quickly spread over the whole cluster, and the propagation speed of the information is exponential.
Fig. 2 is a schematic diagram of the Gossip algorithm according to an embodiment of the present application. The Gossip diffusion execution flow is as follows:
the seed node periodically disseminates messages;
The infected node randomly selects N adjacent nodes to disseminate messages;
the node only receives the message and does not feed back the result;
Each time a message is disseminated, selecting nodes which are not transmitted yet for dissemination;
nodes receiving the message do not return disseminations: a→b, then B is not sent to a again when it spreads.
As shown in fig. 3, a system architecture diagram to which embodiments of the present application are applied. Wherein, MQTT: representing a message queue telemetry transport protocol; broker: representing a proxy server, which may be a gateway box in reality; topic: the information representing the subject message, which may be a sensor in a real environment; pubish: representing a release topic; subscribe: representing a subscription topic.
As shown in fig. 4A, an embodiment of a distributed MQTT messaging method based on gossip in an application embodiment is shown, where the method is applied to an MQTT messaging system, where the MQTT messaging system includes at least one publishing client, at least one subscribing client, and a plurality of MQTT proxy nodes, where the method embodiment may include:
401. synchronizing topology diagram information of each MQTT proxy node in the plurality of MQTT proxy nodes and relationship information of a publishing client and a subscribing client through a gossip algorithm;
Optionally, synchronizing the topology map information of each MQTT proxy node in the plurality of MQTT proxy nodes by using a gossip algorithm may include: starting the first MQTT proxy node and the second MQTT proxy node; establishing connection between the first MQTT proxy node and the second MQTT proxy node; synchronizing the topology map information of the first MQTT proxy node and the relationship information of the publishing client and the subscribing client to the second MQTT proxy node, synchronizing the topology map information of the second MQTT proxy node and the relationship information of the publishing client and the subscribing client to the first MQTT proxy node, and enabling the topology map information of the first MQTT proxy node and the second MQTT proxy node and the relationship information of the publishing client and the subscribing client to be consistent.
Optionally, the method may further include:
If the topology map information of the first MQTT proxy node is updated, synchronizing the updated topology map information of the first MQTT proxy node to the second MQTT proxy node; and/or the number of the groups of groups,
And if the topology map information of the second MQTT proxy node is updated, synchronizing the updated topology map information of the second MQTT proxy node to the first MQTT proxy node.
Optionally, the topology map information of each MQTT proxy node includes: topology information of each MQTT proxy node, and at least one of publishing information of a publishing client connected with each MQTT proxy node and subscribing information of a subscribing client.
Optionally, the at least one publishing client is connected to the at least one subscribing client through the plurality of MQTT proxy nodes.
Optionally, the number of the target release clients is more than one, and then the number of the first MQTT proxy nodes connected with the target release clients is also more than one; the number of target subscription clients is more than one, so is more than one corresponding to the second MQTT proxy node connected to the target subscription client.
The node in the distributed network is started, and the network is connected, so that the node does not know the whole network structure information and the topic subscription relationship between the client and the subscriber, and the node can find adjacent brooker to synchronize the topology information and the subscription relationship, which is described in detail below.
Taking the topological structure synchronization of an A MQTT proxy node (called A node for short) and a B MQTT proxy node (called B node for short) as an example, the gossip diffusion process is illustrated, and as shown in fig. 4B, a schematic diagram of the gossip diffusion process is illustrated.
T1: node a starts, denoted by 0= [ a ];
t2: node B is started, represented by 0= [ B ];
T3: the node A establishes connection with the node B, and at the moment, the node A stores topology diagram information which takes the node A as a center: "0= [ a ], 1= [ B ]", topology map information of the node B: "0= [ B ], 1= [ a ]";
T4: assuming that the node B synchronizes the topology map information to the node A, the node A compares the topology map information with the self topology map after receiving the topology map information, updates the local map (the node B and the node A are connected by using 1-0 in the figure 4B), and if the information has variation, the node B connected with the node A needs to synchronize the latest information;
T5: the A node synchronizes the local mapping diagram to the B node, and the B node stores new link information: 1-0, node B information is changed and needs to be synchronized outwards, and node A is found to be connected with the node B, and then is synchronized to node A;
t6: the topological graph information of the A node and the B node is consistent with the relation information of the publishing client and the subscribing client, and the synchronization is completed.
402. After synchronization is completed, if the target release client releases the first theme MQTT message through the first MQTT proxy node, the at least one release client comprises the target release client.
403. And sending the first subject MQTT message to a second MQTT proxy node through the first MQTT proxy node, wherein the plurality of MQTT proxy nodes comprise the first MQTT proxy node and the second MQTT proxy node.
Optionally, the sending, by the first MQTT proxy node, the first-topic MQTT message to the second MQTT proxy node may include: determining a second MQTT proxy node connected with a target subscription client subscribing to the first theme message according to the first theme MQTT message; and sending the first subject MQTT message to the second MQTT proxy node through the first MQTT proxy node.
Optionally, the sending, by the first MQTT proxy node, the first-topic MQTT message to the second MQTT proxy node may include: sending the first subject MQTT message to a third MQTT proxy node via the first MQTT proxy node; and sending the first subject MQTT message to the second MQTT proxy node through the third MQTT proxy node, wherein the number of the third MQTT proxy nodes is at least one.
It will be appreciated that the number of third MQTT proxy nodes is at least one, i.e. the third MQTT proxy node may comprise at least one MQTT proxy node. The first MQTT proxy node may send the first theme MQTT message directly to the second MQTT proxy node, or may send the first theme MQTT message through the third MQTT proxy node, which is not limited herein.
404. And transmitting the first theme MQTT message to a target subscription client through the second MQTT proxy node, wherein the at least one subscription client comprises the target subscription client, and the second MQTT proxy node is an MQTT proxy node directly connected with the target subscription client.
For example, after all node topology information, relationships between publishing clients and subscribing clients, and the like in the entire network are synchronized through the first step of process, the publisher publishes a message X in one topic that is published: message, the node where the subscriber is located can be quickly found by the access node to Message X: message delivery passed over and ended.
Referring to fig. 3, the client (publisher) in fig. 3 is a target publishing client, MQTT Broker1 is a first MQTT proxy node, subscribers 1 and 2 are target subscribing clients, MQTT Broker3 is a second MQTT proxy node for subscriber 1, and MQTT Broker4 is a second MQTT proxy node for subscriber 2.
In an embodiment of the present application, a distributed MQTT messaging method based on gossip, where the method is applied to an MQTT messaging system, where the MQTT messaging system includes at least one publishing client, at least one subscribing client, and a plurality of MQTT proxy nodes, the method may include: synchronizing topology graph information of each MQTT proxy node in the plurality of MQTT proxy nodes through a gossip algorithm; after synchronization is completed, if the target release client releases the first theme MQTT message through the first MQTT proxy node, the at least one release client comprises the target release client; sending the first subject MQTT message to a second MQTT proxy node via the first MQTT proxy node, the plurality of MQTT proxy nodes comprising the first MQTT proxy node and the second MQTT proxy node; and transmitting the first theme MQTT message to a target subscription client through the second MQTT proxy node, wherein the at least one subscription client comprises the target subscription client, and the second MQTT proxy node is an MQTT proxy node directly connected with the target subscription client. The method is used for applying the gossip algorithm to the message synchronization of the distributed deployment MQTT proxy node, so that the problem of the distributed message synchronization can be solved, and the message synchronization efficiency can be improved.
The application provides a gossip propagation and diffusion mode which is applied to the message synchronization of distributed deployment MQTT proxy nodes, so that the problem of distributed message synchronization can be solved, the message synchronization efficiency can be improved, and the following advantages are summarized:
High availability: any addition and reduction of MQTT proxy nodes (MQTT brooker) are allowed in the network, and single node machine downtime or faults do not affect message transmission;
high efficiency: because the nodes of the gossip algorithm only accept the message without replying the message, and the virus type diffusion is adopted, the message synchronization is exponential, and the efficiency is high;
decentralizing: all nodes are considered as peer-to-peer, any node does not need to know the condition of the whole network, and as long as the network is connected, the message can be disseminated to the whole network;
the safety is higher: after hiding the proxy server, the client (publisher) can shield part of network attacks.
As shown in FIG. 5, which is a schematic diagram of an MQTT messaging system according to an embodiment of the present application, the MQTT messaging system may include:
At least one publishing client 501, at least one subscribing client 502, a plurality of MQTT proxy nodes 503;
the multiple MQTT proxy nodes 503 are configured to synchronize, by using a gossip algorithm, topology map information of each of the multiple MQTT proxy nodes and relationship information of the publishing client and the subscribing client;
the target publishing client 5011 is configured to, after synchronization is completed, if the target publishing client 5011 publishes the first topic MQTT message through the first MQTT proxy node 5031, at least one publishing client 501 includes the target publishing client 5011;
A first MQTT proxy node 5031 for sending the first-topic MQTT message to a second MQTT proxy node 5032, the plurality of MQTT proxy nodes 503 comprising the first MQTT proxy node 5031 and the second MQTT proxy node 5032;
A second MQTT proxy node 5032 for delivering the first-topic MQTT message to the target subscription client 5021 via the second MQTT proxy node 5032, the at least one subscription client 502 comprising the target subscription client 5011, the second MQTT proxy node 5032 being an MQTT proxy node directly connected to the target subscription client 5011.
Optionally, the first MQTT proxy node 5031 and the second MQTT proxy node 5032 are configured to start the first MQTT proxy node 5031 and the second MQTT proxy node 5032; establishing a connection between the first MQTT proxy node 5031 and the second MQTT proxy node 5032; the topology map information of the first MQTT proxy node 5031 and the relationship information of the publishing client and the subscribing client are synchronized to the second MQTT proxy node 5032, and the topology map information of the second MQTT proxy node 5032 and the relationship information of the publishing client and the subscribing client are synchronized to the first MQTT proxy node 5031 so that the topology map information of the first MQTT proxy node 5031 and the second MQTT proxy node 5032 and the relationship information of the publishing client and the subscribing client are consistent.
Optionally, the first MQTT proxy node 5031 and the second MQTT proxy node 5032 are configured to synchronize the updated topology map information of the first MQTT proxy node 5031 with the updated topology map information of the second MQTT proxy node 5032 if the topology map information of the first MQTT proxy node 5031 is updated; and/or the number of the groups of groups,
The first MQTT proxy node 5031 and the second MQTT proxy node 5032 are configured to synchronize the updated topology map information of the second MQTT proxy node 5032 to the first MQTT proxy node 5031 if the topology map information of the second MQTT proxy node 5032 is updated.
Optionally, the topology map information of each MQTT proxy node includes: topology information of each MQTT proxy node, and at least one of publishing information of a publishing client connected with each MQTT proxy node and subscribing information of a subscribing client.
Optionally, the target publishing client 5011 is specifically configured to determine, according to the first topic MQTT message, a second MQTT proxy node 5032 connected to the target subscribing client 5021 that subscribes to the first topic message; the first subject MQTT message is sent by the first MQTT-proxy node 5031 to the second MQTT-proxy node 5032.
Optionally, the first subject MQTT message is sent to the third MQTT-proxy node 5033 via the first MQTT-proxy node 5031; the first subject MQTT message is sent to the second MQTT-proxy node 5032 via the third MQTT-proxy node 5033, with at least one number of third MQTT-proxy nodes 5033.
Optionally, at least one publishing client 501 is connected to at least one subscribing client 502 through the plurality of MQTT proxy nodes.
As shown in fig. 6, which is a schematic diagram of another embodiment of an electronic device according to an embodiment of the present application, may include:
Fig. 6 is a block diagram showing a part of the structure of a mobile phone related to an electronic device according to an embodiment of the present application. Referring to fig. 6, the mobile phone includes: radio Frequency (RF) circuitry 610, memory 620, input unit 630, display unit 640, sensor 650, audio circuitry 660, wireless fidelity (WIRELESS FIDELITY, wi-Fi) module 670, processor 680, power supply 690, and the like. Those skilled in the art will appreciate that the handset configuration shown in fig. 6 is not limiting of the handset and may include more or fewer components than shown, or may combine certain components, or may be arranged in a different arrangement of components.
The following describes the components of the mobile phone in detail with reference to fig. 6:
The RF circuit 610 may be configured to receive and transmit signals during a message or a call, and in particular, receive downlink information of a base station and process the downlink information with the processor 680; in addition, the data of the design uplink is sent to the base station. Generally, RF circuitry 610 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, and the like. In addition, the RF circuitry 610 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol including, but not limited to, global System for Mobile communications (Global System of Mobile communication, GSM), general Packet Radio Service (GPRS), code division multiple Access (Code Division Multiple Access, CDMA), wideband code division multiple Access (Wideband Code Division Multiple Access, WCDMA), long term evolution (Long Term Evolution, LTE), email, short message service (short MESSAGING SERVICE, SMS), and the like.
The memory 620 may be used to store software programs and modules, and the processor 680 may perform various functional applications and data processing of the cellular phone by executing the software programs and modules stored in the memory 620. The memory 620 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, phonebook, etc.) created according to the use of the handset, etc. In addition, memory 620 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The input unit 630 may be used to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the handset. In particular, the input unit 630 may include a touch panel 631 and other input devices 632. The touch panel 631, also referred to as a touch screen, may collect touch operations thereon or thereabout by a user (e.g., operations of the user on the touch panel 631 or thereabout using any suitable object or accessory such as a finger, a stylus, etc.), and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 631 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 680 and can receive commands from the processor 680 and execute them. In addition, the touch panel 631 may be implemented in various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 630 may include other input devices 632 in addition to the touch panel 631. In particular, other input devices 632 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, mouse, joystick, etc.
The display unit 640 may be used to display information input by a user or information provided to the user and various menus of the mobile phone. The display unit 640 may include a display panel 641, and optionally, the display panel 641 may be configured in the form of a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 631 may cover the display panel 641, and when the touch panel 631 detects a touch operation thereon or thereabout, the touch panel 631 is transferred to the processor 680 to determine the type of the touch event, and then the processor 680 provides a corresponding visual output on the display panel 641 according to the type of the touch event. Although in fig. 6, the touch panel 631 and the display panel 641 are two independent components to implement the input and input functions of the mobile phone, in some embodiments, the touch panel 631 and the display panel 641 may be integrated to implement the input and output functions of the mobile phone.
The handset may also include at least one sensor 650, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 641 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 641 and/or the backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the acceleration in all directions (generally three axes), and can detect the gravity and direction when stationary, and can be used for applications of recognizing the gesture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and knocking), and the like; other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that may also be configured with the handset are not described in detail herein.
Audio circuitry 660, speaker 661, microphone 662 may provide an audio interface between a user and the handset. The audio circuit 660 may transmit the received electrical signal converted from audio data to the speaker 661, and the electrical signal is converted into a sound signal by the speaker 661 to be output; on the other hand, microphone 662 converts the collected sound signals into electrical signals, which are received by audio circuit 660 and converted into audio data, which are processed by audio data output processor 680 for transmission to, for example, another cell phone via RF circuit 610, or which are output to memory 620 for further processing.
Wi-Fi belongs to a short-distance wireless transmission technology, and a mobile phone can help a user to send and receive e-mails, browse web pages, access streaming media and the like through a Wi-Fi module 670, so that wireless broadband Internet access is provided for the user. Although fig. 6 shows Wi-Fi module 670, it is understood that it does not belong to the necessary constitution of the cell phone, and can be omitted entirely as needed within the scope of not changing the essence of the application.
Processor 680 is a control center of the handset, connects various parts of the entire handset using various interfaces and lines, and performs various functions and processes of the handset by running or executing software programs and/or modules stored in memory 620, and invoking data stored in memory 620, thereby performing overall monitoring of the handset. Optionally, processor 680 may include one or more processing units; preferably, the processor 680 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 680.
The handset further includes a power supply 690 (e.g., a battery) for powering the various components, which may be logically connected to processor 680 by a power management system, such as to provide charge, discharge, and power management functions via the power management system.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which will not be described herein.
The schematic structure of the electronic device shown in fig. 6 may be, but not limited to, a publishing client 501, a subscribing client 502, or an MQTT proxy node 503 in the embodiment of the present application.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (Solid STATE DISK, SSD)), etc.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (9)

1. A gossip-based distributed MQTT messaging method applied to an MQTT messaging system comprising at least one publishing client, at least one subscribing client, a plurality of MQTT proxy nodes, the method comprising:
Synchronizing topology diagram information of each MQTT proxy node in the plurality of MQTT proxy nodes and relationship information of a publishing client and a subscribing client through a gossip algorithm;
After synchronization is completed, if the target release client releases the first theme MQTT message through the first MQTT proxy node, the at least one release client comprises the target release client;
Sending the first subject MQTT message to a second MQTT proxy node via the first MQTT proxy node, the plurality of MQTT proxy nodes comprising the first MQTT proxy node and the second MQTT proxy node;
Transmitting the first subject MQTT message to a target subscription client through the second MQTT proxy node, wherein the at least one subscription client comprises the target subscription client, and the second MQTT proxy node is an MQTT proxy node directly connected with the target subscription client;
The step of synchronizing the topology graph information of each MQTT proxy node in the plurality of MQTT proxy nodes through a gossip algorithm comprises the following steps:
Starting the first MQTT proxy node and the second MQTT proxy node;
establishing connection between the first MQTT proxy node and the second MQTT proxy node;
Synchronizing the topology map information of the first MQTT proxy node and the relationship information of the publishing client and the subscribing client to the second MQTT proxy node, synchronizing the topology map information of the second MQTT proxy node and the relationship information of the publishing client and the subscribing client to the first MQTT proxy node, and enabling the topology map information of the first MQTT proxy node and the second MQTT proxy node and the relationship information of the publishing client and the subscribing client to be consistent.
2. The method according to claim 1, wherein the method further comprises:
If the topology map information of the first MQTT proxy node is updated, synchronizing the updated topology map information of the first MQTT proxy node to the second MQTT proxy node; and/or the number of the groups of groups,
And if the topology map information of the second MQTT proxy node is updated, synchronizing the updated topology map information of the second MQTT proxy node to the first MQTT proxy node.
3. The method according to any one of claims 1-2, wherein the topology map information of each MQTT-proxy node comprises: topology information of each MQTT proxy node, and at least one of publishing information of a publishing client connected with each MQTT proxy node and subscribing information of a subscribing client.
4. The method according to any of claims 1-2, wherein the sending, by the first MQTT-proxy node, the first-topic MQTT message to a second MQTT-proxy node, comprises:
Determining a second MQTT proxy node connected with a target subscription client subscribing to the first theme MQTT message according to the first theme MQTT message;
And sending the first subject MQTT message to the second MQTT proxy node through the first MQTT proxy node.
5. The method according to any of claims 1-2, wherein the sending, by the first MQTT-proxy node, the first-topic MQTT message to a second MQTT-proxy node, comprises:
Sending the first subject MQTT message to a third MQTT proxy node via the first MQTT proxy node;
And sending the first subject MQTT message to the second MQTT proxy node through the third MQTT proxy node, wherein the number of the third MQTT proxy nodes is at least one.
6. The method of claim 1, wherein the at least one publishing client is connected to the at least one subscribing client through the plurality of MQTT proxy nodes.
7. An MQTT messaging system, comprising:
At least one publishing client, at least one subscribing client, a plurality of MQTT proxy nodes;
The MQTT proxy nodes are used for synchronizing the topological graph information of each MQTT proxy node in the MQTT proxy nodes and the relation information of the publishing client and the subscribing client through a gossip algorithm;
The target release client is used for releasing the first theme MQTT message through the first MQTT proxy node after the synchronization is completed, and the at least one release client comprises the target release client;
the first MQTT proxy node is configured to send the first subject MQTT message to a second MQTT proxy node, where the plurality of MQTT proxy nodes includes the first MQTT proxy node and the second MQTT proxy node;
the second MQTT proxy node is configured to transmit, to a target subscription client, the first theme MQTT message through the second MQTT proxy node, where the at least one subscription client includes the target subscription client, and the second MQTT proxy node is an MQTT proxy node directly connected to the target subscription client;
The step of synchronizing the topology graph information of each MQTT proxy node in the plurality of MQTT proxy nodes through a gossip algorithm comprises the following steps:
Starting the first MQTT proxy node and the second MQTT proxy node;
establishing connection between the first MQTT proxy node and the second MQTT proxy node;
Synchronizing the topology map information of the first MQTT proxy node and the relationship information of the publishing client and the subscribing client to the second MQTT proxy node, synchronizing the topology map information of the second MQTT proxy node and the relationship information of the publishing client and the subscribing client to the first MQTT proxy node, and enabling the topology map information of the first MQTT proxy node and the second MQTT proxy node and the relationship information of the publishing client and the subscribing client to be consistent.
8. A terminal device, comprising:
A memory storing executable program code;
A processor coupled to the memory;
The processor being adapted to correspondingly perform the method of any of claims 1-6.
9. A computer readable storage medium comprising instructions which, when run on a processor, cause the processor to perform the method of any of claims 1-6.
CN202210656795.6A 2022-06-11 2022-06-11 Distributed MQTT message transmission method, transmission system and storage medium based on gossip Active CN115242805B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210656795.6A CN115242805B (en) 2022-06-11 2022-06-11 Distributed MQTT message transmission method, transmission system and storage medium based on gossip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210656795.6A CN115242805B (en) 2022-06-11 2022-06-11 Distributed MQTT message transmission method, transmission system and storage medium based on gossip

Publications (2)

Publication Number Publication Date
CN115242805A CN115242805A (en) 2022-10-25
CN115242805B true CN115242805B (en) 2024-04-19

Family

ID=83669446

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210656795.6A Active CN115242805B (en) 2022-06-11 2022-06-11 Distributed MQTT message transmission method, transmission system and storage medium based on gossip

Country Status (1)

Country Link
CN (1) CN115242805B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115766317A (en) * 2022-10-31 2023-03-07 海尔优家智能科技(北京)有限公司 Method and device for transmitting messages among components, storage medium and electronic device
CN116684939B (en) * 2023-08-02 2023-11-07 中国电信股份有限公司 Message processing method, device, computer equipment and computer readable storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102594689A (en) * 2012-02-22 2012-07-18 中兴通讯股份有限公司 Distributed network control method and device
CN108259570A (en) * 2017-12-25 2018-07-06 山东浪潮云服务信息科技有限公司 A kind of transmission network platform of distributed message, method and system
WO2018210401A1 (en) * 2017-05-15 2018-11-22 Telefonaktiebolaget Lm Ericsson (Publ) Topic handling in mqtt networks
CN111711663A (en) * 2020-05-26 2020-09-25 北京金山云网络技术有限公司 Processing method and device for publishing and subscribing services and electronic equipment
CN111865630A (en) * 2019-04-26 2020-10-30 北京达佳互联信息技术有限公司 Topology information acquisition method, device, terminal and storage medium
CN112967071A (en) * 2021-03-04 2021-06-15 北京联合大学 Urban fruit quality tracing method based on block chain
CN113162970A (en) * 2021-01-27 2021-07-23 中央财经大学 Message routing method, device, equipment and medium based on publish/subscribe model
CN113872805A (en) * 2021-09-24 2021-12-31 希诺麦田技术(深圳)有限公司 Network topology information visualization method, device and medium
CN114025002A (en) * 2021-11-05 2022-02-08 深圳市宏电技术股份有限公司 MQTT information transmission method, system and communication equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8533230B2 (en) * 2009-06-24 2013-09-10 International Business Machines Corporation Expressing manageable resource topology graphs as dynamic stateful resources
US10645181B2 (en) * 2016-12-12 2020-05-05 Sap Se Meta broker for publish-subscribe-based messaging

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102594689A (en) * 2012-02-22 2012-07-18 中兴通讯股份有限公司 Distributed network control method and device
WO2018210401A1 (en) * 2017-05-15 2018-11-22 Telefonaktiebolaget Lm Ericsson (Publ) Topic handling in mqtt networks
CN108259570A (en) * 2017-12-25 2018-07-06 山东浪潮云服务信息科技有限公司 A kind of transmission network platform of distributed message, method and system
CN111865630A (en) * 2019-04-26 2020-10-30 北京达佳互联信息技术有限公司 Topology information acquisition method, device, terminal and storage medium
CN111711663A (en) * 2020-05-26 2020-09-25 北京金山云网络技术有限公司 Processing method and device for publishing and subscribing services and electronic equipment
CN113162970A (en) * 2021-01-27 2021-07-23 中央财经大学 Message routing method, device, equipment and medium based on publish/subscribe model
CN112967071A (en) * 2021-03-04 2021-06-15 北京联合大学 Urban fruit quality tracing method based on block chain
CN113872805A (en) * 2021-09-24 2021-12-31 希诺麦田技术(深圳)有限公司 Network topology information visualization method, device and medium
CN114025002A (en) * 2021-11-05 2022-02-08 深圳市宏电技术股份有限公司 MQTT information transmission method, system and communication equipment

Also Published As

Publication number Publication date
CN115242805A (en) 2022-10-25

Similar Documents

Publication Publication Date Title
KR102578623B1 (en) Communication connection methods and apparatus, computer devices, and storage media
CN115242805B (en) Distributed MQTT message transmission method, transmission system and storage medium based on gossip
CN113518085B (en) Data transmission method based on multiple channels and related device
US10959124B2 (en) Uplink data transmission method, terminal, network side device and system
JP6511541B2 (en) Message updating method, apparatus and terminal
US10225356B2 (en) Method and terminal for receiving push information, storage medium
CN105847168B (en) data transmission method, network server, user terminal and system
JP6557741B2 (en) Picture combining method, terminal, and picture combining system
CN107204989B (en) Advertisement blocking method, terminal, server and storage medium
CN109905380B (en) Node control method and related device in distributed system
JP2019508084A (en) Movement control method of role in game, server and client
CN107800585B (en) Network communication method and device, and message pushing method and device
KR20070116619A (en) Proxy for enabling communication between mobile device and game service
CN106293738B (en) Expression image updating method and device
CN112087362B (en) Message forwarding method and device between clients and terminal
CN111444237A (en) Server system, data transmission method and electronic equipment
CN111787088B (en) Method and device for processing small program data
CN108270839B (en) Access frequency control system and method
WO2018149365A1 (en) Data acquisition method, mobile terminal, and server
CN113259697B (en) Live broadcast state notification method, related device, equipment and storage medium
CN107104760B (en) Method for transmitting data packet, client and server
KR102596801B1 (en) PC5 link establishment methods, equipment and systems
CN105681370A (en) File synchronizing method, server and client
CN116112403B (en) Cloud service management system and method for application service, electronic equipment and storage medium
CN111132073B (en) Multicast communication link layer identifier updating method, device and terminal equipment

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
GR01 Patent grant
GR01 Patent grant