Message processing method and device, Internet of Things system and storage medium

By dispersing the task of querying target devices in the Internet of Things system and querying subscription relationships using the local storage space of the proxy server, the problem of high message distribution delay in the Internet of Things system is solved, and the real-time nature of subscription message broadcast is realized.

CN120111064APending Publication Date: 2025-06-06HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311660926.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

The message distribution delay in the Internet of Things system is high, and the real-time nature of subscription message broadcast cannot be effectively realized.

Method used

By distributing the task of querying the target device between the message distribution computing node and the proxy server, the proxy server queries the subscription relationship in the local storage space, thereby broadcasting the subscription message to the target device.

Benefits of technology

It significantly improves the query efficiency of the target device corresponding to the subscription message, shortens the time-consuming process of acquiring the target device, and realizes the real-time broadcast of the subscription message.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120111064A_ABST
    Figure CN120111064A_ABST
Patent Text Reader

Abstract

The invention discloses a message processing method and device, an Internet of Things system and a storage medium. The method comprises the following steps: receiving a subscription message broadcasted by a message distribution computing node, the subscription message carrying a subscription theme; querying a target device subscribing to the subscription theme from a subscription relationship stored in a local storage space; the subscription relationship comprises a mapping relationship between a device identifier corresponding to a device in communication connection with the proxy server and a subscription theme subscribed by the device; and sending the subscription message to the target device. According to the embodiment of the invention, the technical problem that the real-time performance of subscription message broadcasting cannot be effectively realized due to relatively high message distribution delay of the Internet of Things system in the related technology can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of Internet of Things, and in particular to a message processing method, device, Internet of Things system and storage medium. Background Art

[0002] In the IoT system of related technologies, when broadcasting messages of a target topic to millions of devices connected to the IoT system, the message distribution computing node usually first queries the target device subscribed to the target topic from the database storing subscription relationship data, and then broadcasts the message of the target topic to the target device. However, the above method takes a long time to obtain the target device and is inefficient, which will result in a high message distribution delay and cannot effectively achieve the real-time nature of subscription message broadcasting. Summary of the invention

[0003] In view of the above problems, the present application provides a message processing method, device, Internet of Things system and storage medium to at least solve the technical problem in the related technology that the message distribution delay of the Internet of Things system is high and the real-time nature of the subscription message broadcast cannot be effectively realized.

[0004] According to the first aspect of an embodiment of the present application, a message processing method is provided, including: receiving a subscription message broadcast by a message distribution computing node, the subscription message carrying a subscription topic; querying a target device subscribed to the subscription topic from a subscription relationship stored in a local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device communicatively connected to the proxy server, and a subscription topic subscribed to by the device; and sending the subscription message to the target device.

[0005] According to a second aspect of an embodiment of the present application, a message processing method is provided, comprising: receiving a subscription message sent by a user server; broadcasting the subscription message to a proxy server in an Internet of Things platform, so that the proxy server sends the subscription message to a target device based on a subscription relationship stored in a local storage space; wherein the subscription relationship comprises a mapping relationship between a device identifier corresponding to a device communicatively connected to the proxy server and a subscription topic subscribed by the device.

[0006] According to the third aspect of an embodiment of the present application, a message processing device is provided, which includes: a first receiving unit, used to receive a subscription message broadcast by a message distribution computing node, wherein the subscription message carries a subscription topic; a query unit, used to query a target device subscribed to the subscription topic from a subscription relationship stored in a local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device communicatively connected to the proxy server, and a subscription topic subscribed to by the device; and a sending unit, used to send the subscription message to the target device.

[0007] According to the fourth aspect of an embodiment of the present application, a message processing device is provided, comprising: a receiving unit for receiving a subscription message sent by a user server; a first broadcasting unit for broadcasting the subscription message to a proxy server in an Internet of Things platform, so that the proxy server sends the subscription message to a target device based on a subscription relationship stored in a local storage space; wherein the subscription relationship comprises a mapping relationship between a device identifier corresponding to a device communicatively connected to the proxy server and a subscription topic subscribed by the device.

[0008] According to the fifth aspect of the embodiment of the present application, an Internet of Things system is also provided, characterized in that the Internet of Things system includes: a user server, a message distribution computing node and a proxy server; the message distribution computing node is used to receive a subscription message sent by the user server and broadcast the subscription message to the proxy server; the proxy server is used to receive the subscription message, the subscription message carries a subscription topic; query the target device subscribed to the subscription topic from the subscription relationship stored in the local storage space; and send the subscription message to the target device.

[0009] According to the sixth aspect of an embodiment of the present application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the message processing method of the first aspect or the message processing method of the second aspect when running.

[0010] In an embodiment of the present application, a subscription message broadcasted by a receiving message distribution computing node is adopted, and the subscription message carries a subscription topic; a target device subscribed to the subscription topic is queried from a subscription relationship stored in a local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device connected to the proxy server in communication, and a subscription topic subscribed by the device; a method of sending the subscription message to the target device; that is, the present application adopts a message distribution computing node to broadcast the subscription message to each proxy server, and each proxy server queries the target device subscribed to the subscription topic in the local storage, and then the proxy server broadcasts the message to the target device. The present application disperses the task of querying the target device from a single message distribution computing node to multiple proxy servers, which can not only significantly improve the query efficiency of the target device corresponding to the subscription message, shorten the time consumption of obtaining the target device, but also realize the real-time broadcast of the subscription message. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Moreover, the same reference numerals are used throughout the drawings to represent the same components. In the drawings:

[0012] Figure 1 is a schematic diagram of an application environment of an optional message processing method according to an embodiment of the present application;

[0013] Figure 2 is a schematic diagram of an application environment of an optional message processing method in the related art;

[0014] Figure 3 is a schematic diagram of an application environment of another optional message processing method according to an embodiment of the present application;

[0015] Figure 4 is a flowchart of an optional message processing method according to an embodiment of the present application;

[0016] Figure 5 is a flowchart of another optional message processing method according to an embodiment of the present application;

[0017] Figure 6 is a flowchart of another optional message processing method according to an embodiment of the present application;

[0018] Figure 7 is a flowchart of another optional message processing method according to an embodiment of the present application;

[0019] Figure 8 is a flowchart of another optional message processing method according to an embodiment of the present application;

[0020] Fig. 9 It is a structural diagram of a message processing device provided in an embodiment of the present application;

[0021] Fig.10 It is a structural diagram of a message processing device provided in an embodiment of the present application;

[0022] Fig.11 is a structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0023] Fig.12 is a schematic diagram of the structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only embodiments of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] The following are explanations of the technical terms that may be involved in this application:

[0027] MQTT (Message Queue Telemetry Transport): MQTT is a client-server based message publish / subscribe transport protocol. The MQTT protocol is lightweight, simple, open and easy to implement, and has a wide range of applications, including restricted environments such as machine-to-machine (M2M) communication and the Internet of Things (IoT).

[0028] MQTT Server: MQTT server.

[0029] Broker: message distribution computing node.

[0030] Broadcast: In IoT scenarios, messages are sent to all devices that have subscribed to a topic.

[0031] As an optional implementation, the above data processing method can be applied to, but is not limited to, Figure 1In the application environment shown. The application environment may include but is not limited to: a message distribution computing node 102, a network 114, and a proxy server 108. The message distribution computing node 102 includes a database 104 and a processing engine 106, and the database 104 is used to store subscription messages. The processing engine 116 is used to send the subscription message to the proxy server 108. In addition, the proxy server 108 includes a database 110 and a processing engine 112, and the database 110 is used to store subscription messages, and includes a mapping relationship between a device identifier corresponding to a device connected to the proxy server 108 in communication, and a subscription topic subscribed by the device. The processing engine 112 is used to receive a subscription message broadcasted by the message distribution computing node 102, and the subscription message carries a subscription topic; query the target device subscribing to the subscription topic from the subscription relationship stored in the local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device connected to the proxy server 108 in communication, and a subscription topic subscribed by the device; and send the subscription message to the target device.

[0032] The specific process of the above data processing method is as follows: the message distribution computing node 102 executes steps S102-S104 to receive the subscription message sent by the user server; the subscription message is broadcast to the proxy server 108 in the Internet of Things platform through the network 114; after the proxy server 108 receives the subscription message, it executes steps S104-S108 to receive the subscription message broadcast by the message distribution computing node 102, and the subscription message carries the subscription topic; the target device subscribed to the subscription topic is queried from the subscription relationship stored in the local storage space; the subscription relationship includes the mapping relationship between the device identifier corresponding to the device communicating with the proxy server 108 and the subscription topic subscribed by the device; the subscription message is sent to the target device.

[0033] Optionally, the message distribution node 102 includes a stateless server, and multiple stateless servers share an external storage. The proxy server 108 includes but is not limited to a server that supports a long connection protocol, such as an MQTT server. The proxy server 108 can be a single server, or a server cluster consisting of multiple servers, or a cloud server, and the cloud server includes but is not limited to a private cloud server or a public cloud server. The network 114 can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The above is only an example, and no limitation is made to this in this embodiment.

[0034] like Figure 2As shown, in the IoT system in the related art, when broadcasting the target topic message to the millions of devices connected to the IoT platform, the message distribution computing node (Broker2) usually first queries the target device (such as device 2 and device 4) subscribed to the above target topic from the database storing the subscription relationship data, and then broadcasts the target topic message to the target device. However, the above method takes a long time to obtain the target device and is inefficient, which will result in a high message distribution delay and cannot effectively achieve the real-time nature of subscription message broadcasting.

[0035] In order to solve the above technical problems, as an optional implementation method, Figure 3 As shown, the embodiment of the present application provides a message processing method, which is applied to a proxy server in an Internet of Things system, comprising the following steps:

[0036] S302, receiving a subscription message broadcast by a message distribution computing node, where the subscription message carries a subscription topic.

[0037] In the embodiments of the present application, Figure 4 As shown, the user server sends a subscription message to the message distribution node (Broker2) through the application programming interface gateway (API gateway). Figure 4 Broker1 and Broker3 are standby nodes. When Broker2 fails, Broker1 or Broker3 is enabled. It should be noted that in this application, the message distribution node (Broker2) broadcasts the subscription message to each proxy server (proxy server 1 to proxy server 3), and each proxy server receives the subscription message broadcast by the message distribution computing node, and the subscription message carries the subscription topic.

[0038] S304, querying the target device subscribing to the subscription topic from the subscription relationship stored in the local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device communicating with the proxy server and a subscription topic subscribed by the device.

[0039] Specifically, the local storage spaces of the above-mentioned proxy servers 1 to 3 all store: the mapping relationship between the device identifier corresponding to the device connected to the proxy server in communication and the subscription topic subscribed by the device. Taking proxy server 2 as an example, proxy server 2 is connected to devices 3 and 4 in communication. The communication connection includes protocols that support long connections such as MQTT protocol, AMQP (Advanced Message Queuing Protocol), STOMP (Streaming Text Orientated Message Protocol), etc. The subscription topic subscribed by device 3 is Topic 1, and the subscription topic subscribed by device 4 is Topic 2. Proxy server 2 queries the target device subscribing to the subscription topic Topic 1 from the subscription relationship stored in the local storage space, and the target device is device 3. Similarly, the subscription topic subscribed by device 1 is Topic 1, and the subscription topic subscribed by device 2 is Topic 3. Proxy server 1 queries the target device subscribing to the subscription topic Topic 1 from the subscription relationship stored in the local storage space, and the target device is device 1. It should be noted that the local storage space of each proxy server includes a temporary storage such as a memory, or a permanent storage such as a hard disk.

[0040] S306: Send the subscription message to the target device.

[0041] After each proxy server queries the target device that subscribes to the subscription topic, the subscription message is sent to the target device. Figure 4 As shown, proxy server 2 sends a subscription message with the subscription topic Topic1 to the target device being device 3. Proxy server 1 sends a subscription message with the subscription topic Topic1 to the target device being device 1.

[0042] In an embodiment of the present application, a subscription message broadcasted by a receiving message distribution computing node is adopted, and the subscription message carries a subscription topic; a target device subscribed to the subscription topic is queried from a subscription relationship stored in a local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device connected to the proxy server in communication, and a subscription topic subscribed by the device; a method of sending the subscription message to the target device; that is, the present application adopts a message distribution computing node to broadcast the subscription message to each proxy server, and each proxy server queries the target device subscribed to the subscription topic in the local storage, and then the proxy server broadcasts the message to the target device. The present application disperses the task of querying the target device from a single message distribution computing node to multiple proxy servers, which can not only significantly improve the query efficiency of the target device corresponding to the subscription message, shorten the time-consuming process of obtaining the target device, but also realize the real-time broadcast of the subscription message.

[0043] In one or more embodiments, Figure 5 As shown, the embodiment of the present application also provides a message processing method, comprising the following steps:

[0044] S502, receiving a first mapping relationship broadcast by the message distribution computing node, where the first mapping relationship includes a mapping relationship between a device identifier corresponding to a device connected to the Internet of Things system and a subscription topic;

[0045] S504: extracting the subscription relationship corresponding to the proxy server from the first mapping relationship;

[0046] S506: Store the extracted subscription relationship in the local storage space.

[0047] Specifically, if Figure 4 As shown, before distributing subscription messages to each device, each proxy server can obtain the mapping relationship between each device connected to itself and the subscription topic from the first mapping relationship sent by the message distribution computing node. The above-mentioned first mapping relationship includes the mapping relationship between the device identification of the device (device 1 to device 5) connected to the Internet of Things system and the subscription topic. Assume that the device identifications of devices 1 to 5 are Device1, Device2, Device3, Device4, and Device5 respectively. The first mapping relationship includes: the subscription topic corresponding to Device1 is Topic1, the subscription topics corresponding to Device2 are Topic2 and Topic3, the subscription topics corresponding to Device3 are Topic1 and Topic2, the subscription topic corresponding to Device4 is Topic4, and the subscription topic corresponding to Device5 is Topic2. Here, the proxy server 1 extracts the subscription relationship corresponding to the proxy server 1 from the first mapping relationship: the subscription topic corresponding to Device1 is Topic1, and the subscription topics corresponding to Device2 are Topic2 and Topic3. Proxy server 2 extracts the subscription relationship corresponding to proxy server 1 from the first mapping relationship: the subscription topics corresponding to Device 3 are Topic 1 and Topic 2, and the subscription topic corresponding to Device 4 is Topic 4. Proxy server 3 extracts the subscription relationship corresponding to proxy server 1 from the first mapping relationship: the subscription topic corresponding to Device 5 is Topic 2. Each proxy server stores the extracted subscription relationship in its own local storage space.

[0048] S508: Receive a subscription message broadcast by a message distribution computing node, where the subscription message carries a subscription topic.

[0049] S510, querying the target device subscribing to the subscription topic from the subscription relationship stored in the local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device communicating with the proxy server and a subscription topic subscribed by the device.

[0050] S512: Send the subscription message to the target device.

[0051] The above steps S508-S512 have been clearly explained in the previous text and will not be repeated here.

[0052] In one or more embodiments, Figure 6 As shown, the embodiment of the present application also provides a message processing method, comprising the following steps:

[0053] S602, receiving a message subscription request sent by a device to the Internet of Things system;

[0054] S604, obtaining a subscription topic and a device identifier of the device from the message subscription request;

[0055] S606: Store the mapping relationship between the device identifier and the subscription topic in the local storage space.

[0056] Specifically, Figure 4 Taking the proxy server 2 shown in as an example, the proxy server 2 receives a message subscription request for the subscription topic Topic 1 sent by device 3 to the Internet of Things system at one moment, and obtains the subscription topic Topic 1 and the device identifier Device 3 from the message subscription request. The mapping relationship between Topic 1 and the device identifier Device 3 is stored in the local storage space of the proxy server 2. For another example, the proxy server 2 receives a message subscription request for the subscription topic Topic 4 sent by device 4 to the Internet of Things system at another moment, and obtains the subscription topic Topic 4 and the device identifier Device 4 from the message subscription request. The mapping relationship between Topic 4 and the device identifier Device 4 is stored in the local storage space of the proxy server 2.

[0057] S608: Receive a subscription message broadcast by a message distribution computing node, where the subscription message carries a subscription topic.

[0058] S610, querying the target device subscribing to the subscription topic from the subscription relationship stored in the local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device communicating with the proxy server and a subscription topic subscribed by the device.

[0059] S612: Send the subscription message to the target device.

[0060] Specifically, steps S608-S610 in the embodiment of the present application have been clearly described in the previous text and will not be repeated here.

[0061] In one or more embodiments, querying the target network device subscribing to the subscription topic from the subscription relationship stored in the local storage space includes:

[0062] Determine, based on the mapping relationship cached in the local memory, a first device identifier corresponding to the subscription topic;

[0063] Acquire a second device identifier of a device currently in communication connection with the proxy server from session state information corresponding to a session connection currently established between the proxy server and the device;

[0064] An intersection is taken for the first device identifier and the second device identifier, and a device corresponding to the target device identifier obtained by taking the intersection is determined as a target device that subscribes to the subscription topic.

[0065] Specifically, in the embodiment of the present application, Figure 4 Taking the proxy server 2 shown in as an example, the mapping relationship between the device identifier and the subscription topic is cached in the memory of the proxy server 2. Assume that the mapping relationship is: the subscription topics corresponding to Device3 are Topic1 and Topic2, and the subscription topic corresponding to Device4 is Topic4. In the case that the topic of the current subscription message is Topic1, the first device identifier corresponding to the subscription topic Topic1 is determined to be Device3. From the session state information corresponding to the session connection currently established between the proxy server 2 and the device, the second device identifiers of the devices (device 3 and device 4) currently communicating with the proxy server 2 are obtained as Device3 and Device4 respectively. The intersection of the first device identifier and the second device identifier is taken to obtain the target device identifier as Device3, so that the target device can be determined to be Device 3.

[0066] The embodiment of the present application exchanges space for time by caching the subscription relationship between the device and the subscription topic in a proxy server, such as in the memory of the MQTT Server, and traversing the above-mentioned subscription relationship in the memory of the MQTT Server. Compared with the method of querying the message subscription relationship from the database of subscription relationships between subscription topics in the related art, the speed of determining the device subscribing to the message can be significantly improved, thereby improving the efficiency of the message sending process.

[0067] In one or more embodiments, Figure 7 As shown, the embodiment of the present application also provides a message processing method, which is applied to a message distribution computing node in an Internet of Things system, comprising the following steps:

[0068] S702, receiving a subscription message sent by a user server;

[0069] S704, broadcasting the subscription message to a proxy server in the Internet of Things system, so that the proxy server sends the subscription message to the target device based on the subscription relationship stored in the local storage space; wherein the subscription relationship includes a mapping relationship between a device identifier corresponding to a device that is communicatively connected to the proxy server and a subscription topic subscribed by the device.

[0070] In the embodiments of the present application, Figure 4As shown, the user server sends a subscription message to the message distribution node (Broker2) through the application programming interface gateway (API gateway), and Broker1 and Broker3 are standby nodes. When Broker2 fails, Broker1 or Broker3 is enabled. It should be noted that in this application, the message distribution node (Broker2) broadcasts the subscription message to each proxy server (proxy server 1 to proxy server 3), and each proxy server receives the subscription message broadcast by the message distribution computing node, and the subscription message carries the subscription topic. The local storage space of the above-mentioned proxy servers 1 to 3 stores: the device identification corresponding to the device connected to the proxy server, and the mapping relationship between the subscription topics subscribed by the device. Taking proxy server 2 as an example, proxy server 2 is connected to device 3 and device 4 in communication. The communication connection includes MQTT protocol, AMQP (Advanced Message Queuing Protocol), STOMP (Streaming Text Orientated Message Protocol) and other protocols that support long connections. The subscription topic subscribed by device 3 is Topic1, and the subscription topic subscribed by device 4 is Topic2. The proxy server 2 queries the target device subscribing to the subscription topic Topic1 from the subscription relationship stored in the local storage space, and the target device is device 3. Similarly, the subscription topic subscribed by device 1 is Topic1, and the subscription topic subscribed by device 2 is Topic3. The proxy server 1 queries the target device subscribing to the subscription topic Topic1 from the subscription relationship stored in the local storage space, and the target device is device 1. It should be noted that the local storage space of each proxy server includes a temporary storage such as memory, or a permanent storage such as a hard disk. The above technical solution of the present application can not only significantly improve the computing power of the Internet of Things broadcast subscription messages, but also improve the efficiency of broadcast subscription messages by distributing the computing power required for broadcast subscription messages from a single message distribution computing node to the entire proxy server (such as MQTT Server) cluster. The technical problem of low efficiency of broadcasting messages in the Internet of Things system for millions of devices and delay in broadcasting subscription messages is solved. The embodiment of the present application can achieve the effect of broadcasting subscription messages in seconds for millions of devices.

[0071] In one or more embodiments, Figure 8 As shown, the embodiment of the present application also provides a message processing method, comprising the following steps:

[0072] S802: broadcast a first mapping relationship to each proxy server, where the first mapping relationship includes a mapping relationship between a device identifier corresponding to a device connected to the Internet of Things system and a subscription topic.

[0073] S804: Receive a subscription message sent by the user server.

[0074] S806, broadcasting the subscription message to a proxy server in the Internet of Things system, so that the proxy server sends the subscription message to the target device based on the subscription relationship stored in the local storage space; wherein the subscription relationship includes a mapping relationship between a device identifier corresponding to a device that is communicatively connected to the proxy server and a subscription topic subscribed by the device.

[0075] Specifically, in the embodiments of the present application, specifically, Figure 4 As shown, before each proxy server distributes subscription messages to each device, the message distribution computing node broadcasts the first mapping relationship to each proxy server. Each proxy server obtains the mapping relationship between each device connected to itself and the subscription topic from the first mapping relationship. The above-mentioned first mapping relationship includes the mapping relationship between the device identifiers of the devices (devices 1 to 5) connected to the Internet of Things system and the subscription topic. Assume that the device identifiers of devices 1 to 5 are Device1, Device2, Device3, Device4, and Device5, respectively. The first mapping relationship includes: the subscription topic corresponding to Device1 is Topic1, the subscription topic corresponding to Device2 is Topic2 and Topic3, the subscription topic corresponding to Device3 is Topic1 and Topic2, the subscription topic corresponding to Device4 is Topic4, and the subscription topic corresponding to Device5 is Topic2. Here, proxy server 1 extracts the subscription relationship corresponding to proxy server 1 from the first mapping relationship: the subscription topic corresponding to Device1 is Topic1, and the subscription topic corresponding to Device2 is Topic2 and Topic3. Proxy server 2 extracts the subscription relationship corresponding to proxy server 1 from the first mapping relationship: the subscription topics corresponding to Device 3 are Topic 1 and Topic 2, and the subscription topic corresponding to Device 4 is Topic 4. Proxy server 3 extracts the subscription relationship corresponding to proxy server 1 from the first mapping relationship: the subscription topic corresponding to Device 5 is Topic 2. Afterwards, each proxy server stores the extracted subscription relationship in its own local storage space.

[0076] The above steps S804-S806 have been clearly explained in the previous text and will not be repeated here.

[0077] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0078] According to another aspect of the embodiment of the present application, a message processing device for implementing the above message processing method is also provided, and the device is applied to a proxy server in an Internet of Things system, such as Fig. 9 As shown, the device comprises:

[0079] The first receiving unit 902 is used to receive a subscription message broadcast by a message distribution computing node, where the subscription message carries a subscription topic;

[0080] A query unit 904 is used to query a target device subscribing to the subscription topic from the subscription relationship stored in the local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device communicating with the proxy server and a subscription topic subscribed by the device;

[0081] The sending unit 906 is configured to send the subscription message to the target device.

[0082] In an embodiment of the present application, a subscription message broadcasted by a receiving message distribution computing node is adopted, and the subscription message carries a subscription topic; a target device subscribed to the subscription topic is queried from a subscription relationship stored in a local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device connected to the proxy server in communication, and a subscription topic subscribed by the device; a method of sending the subscription message to the target device; that is, the present application adopts a message distribution computing node to broadcast the subscription message to each proxy server, and each proxy server queries the target device subscribed to the subscription topic in the local storage, and then the proxy server broadcasts the message to the target device. The present application disperses the task of querying the target device from a single message distribution computing node to multiple proxy servers, which can not only significantly improve the query efficiency of the target device corresponding to the subscription message, shorten the time-consuming process of obtaining the target device, but also realize the real-time broadcast of the subscription message.

[0083] In one or more embodiments, the message processing device further includes:

[0084] A second receiving unit, configured to receive a first mapping relationship broadcast by the message distribution computing node, wherein the first mapping relationship includes a mapping relationship between a device identifier corresponding to a device connected to the Internet of Things system and a subscription topic;

[0085] an extracting unit, configured to extract the subscription relationship corresponding to the proxy server from the first mapping relationship;

[0086] The first storage unit is used to store the extracted subscription relationship in the local storage space.

[0087] In one or more embodiments, the message processing device further includes:

[0088] A third receiving unit, configured to receive a message subscription request sent by a device to the Internet of Things system;

[0089] An acquiring unit, configured to acquire a subscription topic and a device identifier of the device from the message subscription request;

[0090] The second storage unit is used to store the mapping relationship between the device identifier and the subscription topic in the local storage space.

[0091] In one or more embodiments, the query unit 904 includes:

[0092] A first determination module, configured to determine a first device identifier corresponding to the subscription topic based on the mapping relationship cached in the local memory;

[0093] an acquisition module, configured to acquire a second device identifier of a device currently in communication connection with the proxy server from session state information corresponding to a session connection currently established between the proxy server and the device;

[0094] The second determination module is configured to obtain an intersection of the first device identifier and the second device identifier, and determine a device corresponding to the target device identifier obtained by obtaining the intersection as a target device for subscribing to the subscription topic.

[0095] According to another aspect of the embodiment of the present application, a message processing device for implementing the above message processing method is also provided. The device is applied to a message distribution computing node in an Internet of Things system, such as Fig.10 As shown, the device comprises:

[0096] The receiving unit 1002 is used to receive a subscription message sent by a user server;

[0097] The first broadcast unit 1004 is used to broadcast the subscription message to the proxy server in the Internet of Things system, so that the proxy server sends the subscription message to the target device based on the subscription relationship stored in the local storage space; wherein the subscription relationship includes a mapping relationship between a device identifier corresponding to a device that is communicatively connected to the proxy server and a subscription topic subscribed by the device.

[0098] In one or more embodiments, the message processing device further includes:

[0099] The second broadcast unit is used to broadcast the first mapping relationship to each proxy server, where the first mapping relationship includes a mapping relationship between a device identifier corresponding to a device accessing the Internet of Things system and a subscription topic.

[0100] According to another aspect of the embodiment of the present application, an electronic device for implementing the above message processing method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Fig.11 As shown, the electronic device includes a memory 1102 and a processor 1104. The memory 1102 stores a computer program, and the processor 1104 is configured to execute the steps in any of the above method embodiments through the computer program.

[0101] Optionally, in this embodiment, the electronic device may be at least one network device among a plurality of network devices of a computer network.

[0102] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0103] S11, receiving a subscription message broadcasted by a message distribution computing node, wherein the subscription message carries a subscription topic;

[0104] S12, querying the target device subscribing to the subscription topic from the subscription relationship stored in the local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to the device communicating with the proxy server and the subscription topic subscribed by the device;

[0105] S13: Send the subscription message to the target device.

[0106] Among them, the memory 1102 can be used to store software programs and modules, such as program instructions / modules corresponding to the message processing method and device in the embodiment of the present application, and the processor 1104 executes various functional applications and data processing by running the software programs and modules stored in the memory 1102, that is, realizing the above-mentioned message processing method. The memory 1102 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1102 may further include a memory remotely arranged relative to the processor 1104, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. Among them, the memory 1102 may be specifically used for storing subscription messages, and a mapping relationship between a device identifier corresponding to a device connected to the proxy server for communication, and a subscription topic subscribed by the device.

[0107] As an example, Fig.11 As shown, the memory 1102 may include but is not limited to the first receiving unit 902, the query unit 904 and the sending unit 906 in the message processing device. In addition, it may also include but is not limited to other module units in the message processing device, which will not be repeated in this example.

[0108] Optionally, the transmission device 1106 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 1106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1106 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0109] In addition, the electronic device mentioned above further includes: a connection bus 1108, which is used to connect various module components in the electronic device mentioned above.

[0110] According to another aspect of the embodiment of the present application, an electronic device for implementing the above message processing method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Fig.12 As shown, the electronic device includes a memory 1202 and a processor 1204. The memory 1202 stores a computer program, and the processor 1204 is configured to execute the steps in any of the above method embodiments through the computer program.

[0111] Optionally, in this embodiment, the electronic device may be at least one network device among a plurality of network devices of a computer network.

[0112] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0113] S21, receiving a subscription message sent by a user server;

[0114] S22, broadcasting the subscription message to a proxy server in the Internet of Things platform, so that the proxy server sends the subscription message to the target device based on the subscription relationship stored in the local storage space;

[0115] The subscription relationship includes a mapping relationship between a device identifier corresponding to a device that is in communication connection with the proxy server and a subscription topic subscribed by the device.

[0116] Among them, the memory 1202 can be used to store software programs and modules, such as program instructions / modules corresponding to the message processing method and device in the embodiment of the present application, and the processor 1204 executes various functional applications and data processing by running the software programs and modules stored in the memory 1202, that is, realizing the above-mentioned message processing method. The memory 1202 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1202 may further include a memory remotely arranged relative to the processor 1204, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. Among them, the memory 1202 may be specifically used for storing subscription messages, and a mapping relationship between a device identifier corresponding to a device connected to the proxy server for communication, and a subscription topic subscribed by the device.

[0117] As an example, Fig.12 As shown, the memory 1202 may include, but is not limited to, the receiving unit 1002 and the first broadcasting unit 1004 in the message processing device. In addition, it may also include, but is not limited to, other module units in the message processing device, which will not be described in detail in this example.

[0118] Optionally, the transmission device 1206 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 1206 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1206 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0119] In addition, the electronic device mentioned above further includes: a connection bus 1208, which is used to connect various module components in the electronic device mentioned above.

[0120] In other embodiments, the electronic device may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes in the form of network communication. Among them, the nodes may form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.

[0121] In one or more embodiments, the present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned message processing method. Wherein, the computer program is configured to execute the steps of any of the above-mentioned method embodiments when running.

[0122] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0123] S11, receiving a subscription message broadcasted by a message distribution computing node, wherein the subscription message carries a subscription topic;

[0124] S12, querying the target device subscribing to the subscription topic from the subscription relationship stored in the local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to the device communicating with the proxy server and the subscription topic subscribed by the device;

[0125] S13, sending the subscription message to the target device. Or a computer program for performing the following steps:

[0126] S21, receiving a subscription message sent by a user server;

[0127] S22, broadcasting the subscription message to a proxy server in the Internet of Things platform, so that the proxy server sends the subscription message to the target device based on the subscription relationship stored in the local storage space;

[0128] The subscription relationship includes a mapping relationship between a device identifier corresponding to a device that is in communication connection with the proxy server and a subscription topic subscribed by the device.

[0129] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0130] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0131] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.

[0132] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0133] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0134] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple 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.

[0135] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0136] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

[0137] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

Claims

1. A message processing method, It is characterized in that A proxy server applied to an Internet of Things system, the method comprising: Receive a subscription message broadcasted by a message distribution computing node, wherein the subscription message carries a subscription topic; Querying a target device subscribing to the subscription topic from the subscription relationship stored in the local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device connected to the proxy server for communication and a subscription topic subscribed by the device; The subscription message is sent to the target device.

2. The method according to claim 1, It is characterized in that Before receiving the subscription message broadcast by the message distribution computing node, the method includes: Receive a first mapping relationship broadcast by the message distribution computing node, where the first mapping relationship includes a mapping relationship between a device identifier corresponding to a device connected to the Internet of Things system and a subscription topic; Extracting the subscription relationship corresponding to the proxy server from the first mapping relationship; The extracted subscription relationship is stored in the local storage space.

3. The method according to claim 1 or 2, It is characterized in that Before receiving the subscription message broadcast by the message distribution computing node, the method includes: A message subscription request sent by a receiving device to the Internet of Things system; Acquire a subscription topic and a device identifier of the device from the message subscription request; The mapping relationship between the device identification and the subscription topic is stored in the local storage space.

4. The method according to claim 3, It is characterized in that The querying of the target network device subscribing to the subscription topic from the subscription relationship stored in the local storage space includes: Determine, based on the mapping relationship cached in the local memory, a first device identifier corresponding to the subscription topic; Acquire a second device identifier of a device currently in communication connection with the proxy server from session state information corresponding to a session connection currently established between the proxy server and the device; An intersection is taken for the first device identifier and the second device identifier, and a device corresponding to the target device identifier obtained by taking the intersection is determined as a target device that subscribes to the subscription topic.

5. A message processing method, It is characterized in that The method is applied to a message distribution computing node in an Internet of Things system, and comprises: Receive subscription messages sent by user servers; Broadcasting the subscription message to a proxy server in the IoT platform, so that the proxy server sends the subscription message to the target device based on the subscription relationship stored in the local storage space; The subscription relationship includes a mapping relationship between a device identifier corresponding to a device that is in communication connection with the proxy server and a subscription topic subscribed by the device.

6. The method according to claim 5, It is characterized in that Before broadcasting the subscription message to the proxy server in the Internet of Things platform, the method further includes: broadcasting a first mapping relationship to each proxy server, wherein the first mapping relationship includes a mapping relationship between a device identifier corresponding to a device accessing the Internet of Things platform and a subscription topic.

7. A message processing device, It is characterized in that A proxy server applied to an Internet of Things system, the device comprising: A first receiving unit, configured to receive a subscription message broadcasted by a message distribution computing node, wherein the subscription message carries a subscription topic; A query unit, used to query a target device subscribing to the subscription topic from the subscription relationship stored in the local storage space; the subscription relationship includes a mapping relationship between a device identifier corresponding to a device communicating with the proxy server and a subscription topic subscribed by the device; A sending unit is used to send the subscription message to the target device.

8. A message processing device, It is characterized in that A message distribution computing node applied to an Internet of Things system, the device comprising: A receiving unit, used to receive a subscription message sent by a user server; The first broadcast unit is used to broadcast the subscription message to the proxy server in the Internet of Things platform, so that the proxy server sends the subscription message to the target device based on the subscription relationship stored in the local storage space; wherein the subscription relationship includes a mapping relationship between a device identifier corresponding to a device that is communicatively connected to the proxy server and a subscription topic subscribed by the device.

9. An Internet of Things system, It is characterized in that The Internet of Things system includes: a user server, a message distribution computing node and a proxy server; The message distribution computing node is used to receive the subscription message sent by the user server and broadcast the subscription message to the proxy server; The proxy server is used to receive the subscription message, which carries a subscription topic; query the target device that subscribes to the subscription topic from the subscription relationship stored in the local storage space; and send the subscription message to the target device.

10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that The program is executed by a processor to implement the method according to any one of claims 1 to 4, or 5 to 6.

Citation Information

Cited By

  • Equipment state updating method and device, equipment and storage medium

    CN120811938A