Message queue-based internet of things platform and container application communication method and system
By using a message queue-based communication method between an IoT platform and container applications, the problem of low efficiency in IoT device management is solved. Asynchronous data transmission and reliable communication are achieved, reducing network latency and packet loss, and improving the system's flexibility and efficiency.
Patent Information
- Application Number
- CN202311358223.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-19
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-10-19
AI Technical Summary
Existing IoT device management methods are inefficient and costly. HTTP/WebSocket communication suffers from complex interfaces, significant network environment impacts, latency, and packet loss issues, putting pressure on the platform, especially during high-response-time tasks and peak access periods.
A message queue-based communication method is adopted between the IoT platform and container applications. Asynchronous data transmission is carried out by establishing a message queue channel. Additional data is generated for transmission using client-specific information to ensure the uniqueness and reliability of data transmission. Operation and feedback message bodies are encapsulated for reliable delivery.
It improves communication flexibility and efficiency, reduces network latency and packet loss, ensures reliable message delivery in unstable network conditions, buffers access peaks from a large number of container applications, and provides a more reliable and efficient communication mechanism.
Smart Images

Figure CN117579646B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data transmission technology, and in particular to a communication method and system for IoT platforms and container applications based on message queues. Background Technology
[0002] With the rapid development of IoT technology, more and more devices are connecting to the network, and these devices are involved in an increasingly wide range of fields. Traditional management methods for IoT devices often require significant manpower and resources, resulting in low efficiency and high costs. This has led to the emergence of a new technology: containerization. Containerization is a lightweight virtualization technology that packages applications and their dependencies into an independent container, forming a lightweight runtime environment. Containerized deployment has become a trend, offering advantages such as rapid deployment, efficient management, and portability.
[0003] Communication between containers and platforms has also become a significant issue, with HTTP / WebSocket currently being the primary method. However, using HTTP / WebSocket presents several problems: complex interfaces leading to substantial development workload; susceptibility to network conditions, potentially resulting in latency and packet loss; increased user wait times for high-response-time tasks such as deep learning; and significant platform pressure during peak access periods. Summary of the Invention
[0004] Therefore, it is necessary to provide a communication method and system for IoT platforms and container applications based on message queues to address the aforementioned technical issues.
[0005] A message queue-based communication method for IoT platforms and container applications is applied to a message queue-based communication system for IoT platforms and container applications, which includes IoT platform clients and container application clients.
[0006] This method includes:
[0007] Establish a message queue channel between the IoT platform client and the container application client;
[0008] The system obtains the operation message sent by the IoT platform client and sends the operation to the container application client through the message queue channel; wherein, the operation message includes: status message, temporary access token of the IoT device involved, and task message;
[0009] The container application client receives the operation message, changes the container application state according to the operation message, establishes a connection with the relevant IoT device, executes the corresponding task, obtains a feedback message, and sends the feedback message to the IoT platform client through the message queue channel; wherein, the feedback message includes: a state change message and a result message;
[0010] The IoT platform client receives feedback messages, processes the messages based on the feedback messages, and closes the temporary access token if the task is completed, thus obtaining the corresponding message processing result.
[0011] In one embodiment, after establishing the message queue channel between the IoT platform client and the container application client, the method further includes:
[0012] Step A1: Using formula (1), generate additional transmission data for the message queue channel based on the client-specific information of the IoT platform client and the client-specific information of the container application client.
[0013] F2 = W2 < <len(R2)+R2 (1)
[0014] Where F2 represents the binary form of the additional data transmitted in the message queue channel; W2 represents the binary form of the client-specific information of the IoT platform client; R2 represents the binary form of the client-specific information of the container application client; len() represents the total number of bits of the binary data within the parentheses; << represents the left shift operator;
[0015] Step A2: When the IoT platform client and the container application client transmit data using the message queue channel, additional transmission data is added to the transmitted data using formula (2) to obtain the first transmission data. The IoT platform client and the container application client then transmit the first transmission data using the message queue channel.
[0016] g2 = [F2 < <len(G2)+G2]-F2 (2)
[0017] Where g2 represents the binary data of the first transmitted data obtained after adding additional transmitted data to the transmitted data; G2 represents the binary form of the transmitted data;
[0018] Step A3: After the transmission of the first transmitted data is completed, the receiver that received the first transmitted data uses formula (3) to perform a transmission supplementary data verification based on the received data to verify whether the first transmitted data is exclusive data of the message queue channel:
[0019]
[0020] Where E represents the verification value of whether the first transmitted data is the exclusive data of the message queue channel; G′2 represents the binary form of the exclusive data obtained by extracting the exclusive data if the verification is successful; >> represents the right shift symbol;
[0021] If E=1, it means that the first transmitted data is the exclusive data of the message queue channel, and the first transmitted data is retained;
[0022] If E = 0, it means that the first transmitted data is not exclusive data of the message queue channel, and the first transmitted data is discarded.
[0023] In one embodiment, sending the operation to the container application client via the message queue channel includes:
[0024] The operation message is encapsulated into a first message body, and the first message body is sent to the container application client through the message queue channel.
[0025] In one embodiment, encapsulating the operation message into a first message body includes:
[0026] A first operator, a first message length, and a first message content are generated based on the operation message; wherein the operation message serves as the first message content.
[0027] The first operator, the first message length, and the first message content are encapsulated into a first message body.
[0028] In one embodiment, generating the first operator, the first message length, and the first message content based on the operation message includes:
[0029] The operation messages are classified to obtain classification messages, and a first operator is generated based on the classification messages; wherein, the classification messages include: state change messages and task messages.
[0030] In one embodiment, the container application client receives the operation message, obtains a feedback message based on the operation message, and further includes:
[0031] The first message body is decapsulated to obtain the operation message.
[0032] In one embodiment,
[0033] Sending the feedback message to the IoT platform client through the message queue channel includes:
[0034] The feedback message is encapsulated into a second message body, and the second message body is sent to the IoT platform client through the message queue channel;
[0035] Encapsulating the feedback message into a second message body includes: generating a second operator, a second message length, and a second message content based on the feedback message; wherein the feedback message serves as the second message content.
[0036] The second operator, the second message length, and the second message content are encapsulated into a second message body.
[0037] In one embodiment, the IoT platform client receives a feedback message, processes the message based on the feedback message, and obtains the corresponding message processing result, including:
[0038] The second message body is decapsulated to obtain the second operator and the feedback message. The message is then processed according to the second operator and the feedback message to obtain the corresponding message processing result.
[0039] In one embodiment, the IoT platform client receives a feedback message, processes the message based on the feedback message, and obtains a corresponding message processing result, further including:
[0040] A display message is generated based on the feedback message, and the feedback message is displayed visually.
[0041] A message queue-based communication system for IoT platforms and container applications is used to realize the message queue-based communication between IoT platforms and container applications as described above, including: an IoT platform client and a container application client;
[0042] Establish a message queue channel between the IoT platform client and the container application client;
[0043] The system acquires the operation message sent by the IoT platform client and sends the operation to the container application client through the message queue channel; wherein the operation message includes: status message and task message;
[0044] The container application client receives the operation message, obtains a feedback message based on the operation message, and sends the feedback message to the IoT platform client through the message queue channel; wherein, the feedback message includes: a state change message and a result message;
[0045] The IoT platform client receives feedback messages, processes the messages based on the feedback messages, and obtains the corresponding message processing results.
[0046] Compared to existing technologies, the advantages and beneficial effects of this invention are as follows: The message queue-based communication method and system for IoT platforms and container applications provided by this invention allows container applications to communicate with the IoT platform via message queues when sending messages. The operation of the IoT platform is decoupled from the container application and does not directly depend on the stability of the network connection. Container applications and the IoT platform can send or receive messages asynchronously, improving communication flexibility and efficiency. Message queues ensure reliable message delivery, preventing message loss even in cases of network instability or disconnection. In situations with a large number of calls to container applications, message queues can act as a buffer, reducing access spikes. Compared to HTTP APIs, this invention provides a more reliable and efficient communication mechanism. Attached Figure Description
[0047] Figure 1 This is a flowchart illustrating a method for communication between an IoT platform and a container application based on a message queue, as shown in one embodiment.
[0048] Figure 2 This is a schematic diagram of the structure of a message queue-based IoT platform and container application communication system in one embodiment. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings.
[0050] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this invention should have the ordinary meaning understood by those skilled in the art. The terms "first," "second," and similar terms used in the embodiments of this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word covers the element or object listed after the word and its equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0051] As described in the background section, existing communication methods suffer from problems such as complex interfaces, large development workload, potential delays and packet loss due to network environment, increased user waiting time for high-response-time tasks such as deep learning, and significant pressure on the platform during peak access periods.
[0052] Based on the above-mentioned prior art and in view of the problems existing in the prior art, the embodiments of the present invention provide a communication method and system for IoT platforms and container applications based on message queues.
[0053] In one embodiment, such as Figure 1 As shown, a method for communication between an IoT platform and container applications based on message queues is provided, including the following steps:
[0054] Step S101: Establish a message queue channel between the IoT platform client and the container application client.
[0055] Specifically, a client is added to both the IoT platform and each container application. The IoT platform client establishes a message queue channel with the container application client to conduct data communication.
[0056] In this embodiment, clients are added to the IoT platform and container application, allowing them to send or receive messages asynchronously, improving communication flexibility and efficiency. When there are numerous calls to the container application, the message queue acts as a buffer, reducing access spikes and improving message delivery efficiency and accuracy.
[0057] Based on this, after establishing the message queue channel between the IoT platform client and the container application client, the following is also included:
[0058] Step A1: Using formula (1), generate additional transmission data for the message queue channel based on the client-specific information of the IoT platform client and the client-specific information of the container application client.
[0059] F2 = W2 < <len(R2)+R2 (1)
[0060] Where F2 represents the binary form of the additional data transmitted in the message queue channel; W2 represents the binary form of the client-specific information of the IoT platform client; R2 represents the binary form of the client-specific information of the container application client; len() represents the total number of bits of the binary data within the parentheses; << represents the left shift operator;
[0061] Step A2: When the IoT platform client and the container application client transmit data using the message queue channel, additional transmission data is added to the transmitted data using formula (2) to obtain the first transmission data. The IoT platform client and the container application client then transmit the first transmission data using the message queue channel.
[0062] g2 = [F2 < <len(G2)+G2]-F2 (2)
[0063] Where g2 represents the binary data of the first transmitted data obtained after adding additional transmitted data to the transmitted data; G2 represents the binary form of the transmitted data;
[0064] Step A3: After the transmission of the first transmitted data is completed, the receiver that received the first transmitted data uses formula (3) to perform a transmission supplementary data verification based on the received data to verify whether the first transmitted data is exclusive data of the message queue channel:
[0065]
[0066] Where E represents the verification value of whether the first transmitted data is the exclusive data of the message queue channel; G′2 represents the binary form of the exclusive data obtained by extracting the exclusive data if the verification is successful; >> represents the right shift symbol;
[0067] If E=1, it means that the first transmitted data is the exclusive data of the message queue channel, and the first transmitted data is retained;
[0068] If E = 0, it means that the first transmitted data is not exclusive data of the message queue channel, and the first transmitted data is discarded.
[0069] Specifically, the client-specific information refers to the unique identifier that each client device possesses, similar to a mobile phone's serial number. Both the IoT platform client and the container application client have their own unique identifier. A message queue channel is established between the IoT platform client and the container application client. Data transmission takes place through this message queue channel.
[0070] Interference data exists within the message queue channel. Therefore, when the IoT platform client and the container application client transmit data using the message queue channel, additional transmission data is added based on the client-specific information of both the IoT platform client and the container application client to obtain a first transmission data. The IoT platform client and the container application client then transmit this first transmission data using the message queue channel. By examining the content of the first transmission data, it can be determined whether the data after adding the additional transmission data is the correct transmission data within the message queue channel and is not interference data.
[0071] After the first transmitted data is received, the receiver that received the first transmitted data receives all transmitted first transmitted data in the message queue channel, verifies and analyzes the first transmitted data to determine whether it is interference data and whether it is exclusive data for the message queue channel. If the receiver determines that the first transmitted data is interference data, then the received first transmitted data is not exclusive data for this message queue channel; if the receiver determines that the first transmitted data is not interference data, then the received first transmitted data is exclusive data for this message queue channel.
[0072] If the first transmitted data received is exclusive to the message queue channel, then the first transmitted data will be retained; if the first transmitted data received is not exclusive to the message queue channel, then the data will be discarded.
[0073] In this embodiment, formula (1) in step A1 is used to generate additional transmission data for the message queue channel based on the client-specific information of the IoT platform client and the container application client. This additional transmission data ensures that the data is exclusive to the message queue channel, thus ensuring the uniqueness and reliability of the channel establishment. Then, formula (2) in step A2 is used to add additional transmission data to the transmitted data. While binding the additional transmission data, the data is also shortened to reduce the amount of data transmitted in the channel, ensuring the accuracy of data transmission and saving the power consumption of the system. Finally, formula (3) in step A3 is used to verify the additional transmission data based on the received data, controlling and verifying whether the transmitted data is exclusive to the message queue channel, and retaining the exclusive data to ensure the reliability and accuracy of the transmitted data.
[0074] Step S102: Obtain the operation message sent by the IoT platform client, and send the operation to the container application client through the message queue channel; wherein, the operation message includes: status message, temporary access token of the IoT device involved, and task message.
[0075] Specifically, the IoT platform generates operation messages and sends them to the IoT platform client via API. Examples include changing the state of a container application (such as creation, pause, or destruction), computation tasks, and temporary access tokens for the involved IoT devices. These temporary access tokens are required to invoke the IoT devices to perform task computations. The operations are then sent to the container application client via a message queue channel.
[0076] In this embodiment, sending operation messages through the message queue channel ensures reliable delivery of operation messages, and messages will not be lost even if the network is unstable or disconnected.
[0077] Based on this, sending the operation to the container application client through the message queue channel includes:
[0078] The operation message is encapsulated into a first message body, and the first message body is sent to the container application client through the message queue channel.
[0079] Specifically, the message queue channel contains multiple first message bodies. The structure of each first message body is defined, including information such as the first operator, the first message length, and the first message content. The operation message is encapsulated into a first message body, and this first message body is sent to the container application client through the message queue channel.
[0080] In this embodiment, the first message body is sent to the container application client via a message queue channel. The operation of the IoT platform is decoupled from the container application and does not directly depend on the stability of the network connection. Message transmission is unaffected by the network environment, resulting in less latency and packet loss.
[0081] Based on this, encapsulating the operation message into a first message body includes:
[0082] A first operator, a first message length, and a first message content are generated based on the operation message; wherein the operation message serves as the first message content.
[0083] The first operator, the first message length, and the first message content are encapsulated into a first message body.
[0084] Specifically, based on the content of the operation message, a first operator, a first message length, and a first message content can be generated. For example, the first operator might be an operation to change the state of a container, an arithmetic operation, etc. The first operator, the first message length, and the first message content are then encapsulated into a first message body.
[0085] Based on this, generating the first operator, the first message length, and the first message content according to the operation message includes:
[0086] The operation messages are classified to obtain classification messages, and a first operator is generated based on the classification messages; wherein, the classification messages include: state change messages and task messages.
[0087] Specifically, there are multiple types of operation messages. Operation messages can be classified according to the type of operation to obtain classified messages. The classification information includes different operation names and operation methods. The first operator is generated based on the classification information.
[0088] In step S103, the container application client receives the operation message, changes the container application state according to the operation message, establishes a connection with the relevant IoT device, executes the corresponding task, obtains a feedback message, and sends the feedback message to the IoT platform client through the message queue channel; wherein, the feedback message includes: a state change message and a result message.
[0089] Specifically, after receiving an operation message, the container application client performs the operation according to the operation message. For example, when the container application state changes, it will perform calculations and establish a connection with the relevant IoT devices to execute specific calculation tasks. It will then receive feedback messages such as state change messages and calculation results, and send the feedback messages to the IoT platform client through a message queue channel.
[0090] Based on this, the container application client receives the operation message, obtains a feedback message based on the operation message, and further includes:
[0091] The first message body is decapsulated to obtain the operation message.
[0092] Specifically, the container application client receives the first message body sent by the IoT platform client, and needs to decapsulate the first message body to obtain the operation information encapsulated in the first message body.
[0093] Based on this, sending the feedback message to the IoT platform client through the message queue channel includes:
[0094] The feedback message is encapsulated into a second message body, and the second message body is sent to the IoT platform client through the message queue channel.
[0095] Specifically, the message queue channel contains multiple second message bodies. The structure of each second message body is defined, including information such as the second operator, second message length, and second message content. The second message body is encapsulated based on the feedback message and then sent to the IoT platform client through the message queue channel.
[0096] Based on this, encapsulating the feedback message into a second message body includes:
[0097] A second operator, a second message length, and a second message content are generated based on the feedback message; wherein the feedback message serves as the second message content.
[0098] The second operator, the second message length, and the second message content are encapsulated into a second message body.
[0099] Specifically, based on the content of the feedback message, a second operator, a second message length, and a second message content can be generated. For example, the second operator could be the calculation result, state change feedback, etc. The second operator, the second message length, and the second message content are then encapsulated into a second message body.
[0100] In step S104, the IoT platform client receives a feedback message, processes the message according to the feedback message, and closes the temporary access token if the task is completed, thus obtaining the corresponding message processing result.
[0101] Specifically, the received feedback messages can be processed to obtain the processing result. Once the specific processing result is obtained, the task is considered complete, and the temporary access token is deactivated.
[0102] Based on this, the IoT platform client receives feedback messages, processes the messages according to the feedback messages, and obtains the corresponding message processing results, including:
[0103] The second message body is decapsulated to obtain the second operator and the feedback message. The message is then processed according to the second operator and the feedback message to obtain the corresponding message processing result.
[0104] Specifically, the IoT platform client receives the second message body sent by the container application client, and needs to decapsulate the second message body to obtain the feedback message encapsulated in the second message body.
[0105] Based on this, the IoT platform client receives feedback messages, processes the messages according to the feedback messages, and obtains the corresponding message processing results, and also includes:
[0106] A display message is generated based on the feedback message, and the feedback message is displayed visually.
[0107] Specifically, when the received feedback message is a state change message, the IoT platform client will visualize the state information; when the received feedback message is a result message, the IoT platform client will display the running results.
[0108] This invention provides a message queue-based communication method and system for IoT platforms and container applications. When a container application sends messages to the IoT platform, communication is achieved through a message queue. The operation of the IoT platform is decoupled from the container application and does not directly depend on the stability of the network connection. Container applications and the IoT platform can send or receive messages asynchronously, improving communication flexibility and efficiency. The message queue ensures reliable message delivery, preventing message loss even in cases of network instability or disconnection. During heavy calls to the container application, the message queue acts as a buffer, mitigating access spikes. Compared to HTTP APIs, this invention provides a more reliable and efficient communication mechanism.
[0109] It should be noted that the method of this embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this embodiment, and the multiple devices will interact with each other to complete the method described.
[0110] It should be noted that the above description describes some embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in a different order than that shown in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0111] Based on the same inventive concept, and corresponding to any of the above embodiments, the present invention also provides a message queue-based Internet of Things platform and container application communication system.
[0112] refer to Figure 2 The message queue-based IoT platform and container application communication system includes: IoT platform client 1 and container application client 2;
[0113] The specific steps for establishing a message queue channel between the IoT platform client 1 and the container application client 2 include:
[0114] Step A1: Using formula (1), generate additional data for message queue channel transmission based on the client-specific information of the IoT platform client 1 and the container application client 2.
[0115] F2 = W2 < <len(R2)+R2 (1)
[0116] Where F2 represents the binary form of the additional data transmitted in the message queue channel; W2 represents the binary form of the client-specific information of the IoT platform client 1; R2 represents the binary form of the client-specific information of the container application client 2; len() represents the total number of bits of the binary data within the parentheses; << represents the left shift operator;
[0117] Step A2: When transmitting data in the message queue channel, add additional transmission data to the transmitted data using formula (2) to obtain the first transmitted data.
[0118] g2 = [F2 < <len(G2)+G2]-F2 (2)
[0119] Where g2 represents the binary data of the first transmitted data obtained after adding additional transmitted data to the transmitted data; G2 represents the binary form of the transmitted data;
[0120] Step A3: After the transmission is completed, use formula (3) to perform transmission supplementary data verification based on the received data, control and verify whether the first transmitted data is the exclusive data of the message queue channel, and extract the exclusive data.
[0121]
[0122] Where E represents the verification value of whether the first transmitted data is the exclusive data of the message queue channel; G′2 represents the binary form of the exclusive data obtained by extracting the exclusive data if the verification is successful; >> represents the right shift symbol;
[0123] If E=1, it means that the first transmitted data is the exclusive data of the message queue channel, and the exclusive data is extracted.
[0124] If E = 0, it means that the first transmitted data is not exclusive data of the message queue channel, and it is discarded directly.
[0125] The system acquires the operation message sent by the IoT platform client 1 and sends the operation to the container application client 2 through the message queue channel; wherein the operation message includes: status message and task message;
[0126] The container application client 2 receives the operation message, obtains a feedback message based on the operation message, and sends the feedback message to the IoT platform client 1 through the message queue channel; wherein, the feedback message includes: a state change message and a result message;
[0127] The IoT platform client 1 receives feedback messages, processes the messages based on the feedback messages, and obtains the corresponding message processing results.
[0128] For ease of description, the above system is described by dividing it into various modules based on their functions. Of course, in implementing this invention, the functions of each module can be implemented in one or more software and / or hardware components.
[0129] The system described in the above embodiments is used to implement the corresponding message queue-based IoT platform and container application communication method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0130] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention (including the claims) is limited to these examples; within the framework of the invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of the invention as described above, which are not provided in the details for the sake of brevity.
[0131] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.
[0132] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of the invention, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of the invention, and this also takes into account the fact that the details of implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of the invention will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of the invention, it will be apparent to those skilled in the art that the embodiments of the invention may be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0133] Although the invention has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0134] The embodiments of this invention are intended to cover all such substitutions, modifications, and variations falling within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this invention should be included within the protection scope of this invention.
Claims
1. A method for communication between an IoT platform and container applications based on message queues, characterized in that, It is applied to message queue-based communication systems for IoT platforms and container applications, including IoT platform clients and container application clients. The method includes: Establish a message queue channel between the IoT platform client and the container application client; The system obtains the operation message sent by the IoT platform client and sends the operation message to the container application client through the message queue channel; wherein, the operation message includes: status message, temporary access token of the IoT device involved, and task message; The container application client receives the operation message, changes the container application state according to the operation message, establishes a connection with the relevant IoT device, executes the corresponding task, obtains a feedback message, and sends the feedback message to the IoT platform client through the message queue channel; wherein, the feedback message includes: a state change message and a result message; The IoT platform client receives feedback messages, processes the messages based on the feedback messages, and closes the temporary access token if the task is completed, thus obtaining the corresponding message processing result. After establishing the message queue channel between the IoT platform client and the container application client, the method further includes: Step A1: Using formula (1), generate additional transmission data for the message queue channel based on the client-specific information of the IoT platform client and the client-specific information of the container application client. (1) in The binary form representing the additional data transmitted through the message queue channel; This represents the binary form of the client-specific information of the IoT platform client; The binary form representing the client-specific information of the container application client; This indicates the total number of bits in the binary data within the parentheses. Indicates the left shift symbol; Step A2: When the IoT platform client and the container application client transmit data using the message queue channel, additional transmission data is added to the transmitted data using formula (2) to obtain the first transmission data. The IoT platform client and the container application client then transmit the first transmission data using the message queue channel. (2) in This refers to the binary data of the first transmitted data obtained after adding additional transmitted data to the transmitted data; This represents the binary form of the transmitted data; Step A3: After the transmission of the first transmitted data is completed, the receiver that received the first transmitted data uses formula (3) to perform a transmission supplementary data verification based on the received data to verify whether the first transmitted data is exclusive data of the message queue channel: (3) in This indicates a verification value indicating whether the first transmitted data is exclusive data of the message queue channel; This indicates the binary form of the exclusive data obtained by extracting the exclusive data if the verification passes. Indicates the right shift symbol; like If so, it means that the first transmitted data is exclusive data of the message queue channel, and the first transmitted data is retained; like If the first transmitted data is not exclusive to the message queue channel, then the first transmitted data will be discarded.
2. The method for communication between an IoT platform and a container application based on a message queue according to claim 1, characterized in that, Sending the operation message to the container application client through the message queue channel includes: The operation message is encapsulated into a first message body, and the first message body is sent to the container application client through the message queue channel.
3. The method for communication between an IoT platform and a container application based on a message queue according to claim 2, characterized in that, The step of encapsulating the operation message into a first message body includes: A first operator, a first message length, and a first message content are generated based on the operation message; wherein the operation message serves as the first message content. The first operator, the first message length, and the first message content are encapsulated into a first message body.
4. The method for communication between an IoT platform and a container application based on a message queue according to claim 3, characterized in that, The step of generating the first operator, the first message length, and the first message content based on the operation message includes: The operation messages are classified to obtain classification messages, and a first operator is generated based on the classification messages; wherein, the classification messages include: state change messages and task messages.
5. The method for communication between an IoT platform and a container application based on a message queue according to claim 2, characterized in that, The container application client receives the operation message, obtains a feedback message based on the operation message, and further includes: The first message body is decapsulated to obtain the operation message.
6. The method for communication between an IoT platform and a container application based on a message queue according to claim 1, characterized in that, Sending the feedback message to the IoT platform client through the message queue channel includes: The feedback message is encapsulated into a second message body, and the second message body is sent to the IoT platform client through the message queue channel; Encapsulating the feedback message into a second message body includes: generating a second operator, a second message length, and a second message content based on the feedback message; wherein the feedback message serves as the second message content. The second operator, the second message length, and the second message content are encapsulated into a second message body.
7. The method for communication between an IoT platform and a container application based on a message queue according to claim 6, characterized in that, The IoT platform client receives feedback messages, processes the messages based on the feedback messages, and obtains the corresponding message processing results, including: The second message body is decapsulated to obtain the second operator and the feedback message. The message is then processed according to the second operator and the feedback message to obtain the corresponding message processing result.
8. The method for communication between an IoT platform and a container application based on a message queue according to claim 1, characterized in that, The IoT platform client receives feedback messages, processes the messages based on the feedback messages, and obtains corresponding message processing results, and also includes: A display message is generated based on the feedback message, and the feedback message is displayed visually.
Citation Information
Patent Citations
Internet-of-things gateway system based on no-service technology and data processing method thereof
CN113992644A
Techniques for messaging bot rich communication
EP3211840A1
