Message forwarding system based on MQTT and use method thereof

By introducing an MQTT forwarder into the message transmission system, the operation logic for processing new business needs is isolated, and the problems of high system coupling and low data transmission efficiency in the existing technology are solved, and efficient data transmission and system supervision are achieved.

CN119814902APending Publication Date: 2025-04-11ZHUHAI GREE INTELLIGENT EQUIP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411912067.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The existing message transmission technology has high system coupling, making it difficult to take into account new business needs and effective supervision of corresponding services, resulting in poor data transmission efficiency and seriously affecting the user experience.

Method used

Design a message forwarding system based on MQTT, and isolate the operation logic of new business requirements by adding an MQTT forwarder, realize authentication and connection of the target MQTT server, establish a mapping relationship between the target database and the downstream system, determine system tasks, and enable the downstream system to perform system tasks.

Benefits of technology

It reduces the system coupling of message transmission, realizes effective supervision of new business needs and corresponding services, improves data transmission efficiency and system user experience, and meets the efficient operation needs of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119814902A_ABST
    Figure CN119814902A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data transmission, and discloses an MQTT-based message forwarding system and a use method thereof.The system comprises a target MQTT server, a target database and at least one downstream system, the target MQTT server is determined according to a target message issued by an upstream system and used for forwarding the target message, and the system further comprises an MQTT transponder, a target database and at least one downstream system, the authentication module is used for performing authentication with a target MQTT server; and when the authentication is passed, establishing a connection with the target MQTT server, receiving a target message forwarded by the target MQTT server, establishing a mapping relationship between the target database and the corresponding downstream system according to the target message, and determining a system task according to the mapping relationship, so that the downstream system executes the system task. According to the invention, the MQTT transponder is additionally arranged to carry out isolation processing on the operation logic required by the new business, so that the system coupling degree of message transmission can be reduced, and the efficient operation of the system is ensured while the service supervision efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data transmission, and in particular to a message forwarding system based on MQTT and a use method thereof. Background Art

[0002] MQTT (Message Queuing Telemetry Transport) is a "lightweight" message transmission protocol based on the publish / subscribe model. The protocol is built on the TCP / IP protocol and is commonly used for data communication between Internet of Things (IoT) devices. The original intention of the protocol design is to efficiently transmit messages in low-bandwidth and unstable network environments. It is particularly suitable for resource-constrained devices, such as embedded devices and sensors.

[0003] Currently, when MQTT technology is applied in projects, downstream systems such as warehouse management systems (WMS) or robot control systems (RCS) are usually designed and developed according to the protocols provided by upstream systems such as manufacturing execution systems (MES) to ensure the smoothness of the overall system. However, downstream systems such as WMS and RCS already have normal operating logic, and the direct introduction of MQTT can easily lead to excessive system coupling, which in turn affects the existing operating logic of downstream systems. In addition, the introduction of MQTT requires the addition of new operating logic, such as referencing the existing log framework to the new service, which makes it difficult to monitor the content related to the MQTT service, which can easily lead to confusion in log records and make management difficult.

[0004] In summary, the existing message transmission has a high degree of system coupling, which makes it difficult to take into account new business needs and effective supervision of corresponding services, resulting in poor data transmission efficiency and seriously affecting the user experience. Summary of the invention

[0005] In view of this, the present invention provides a message forwarding system based on MQTT and a method of using the same, so as to solve the problems existing in existing message transmission, such as high system coupling, easy impact on the existing operating logic of the system, resulting in poor efficiency of data transmission and service supervision, and difficulty in ensuring efficient operation of the system.

[0006] In the first aspect, the present invention provides a message forwarding system based on MQTT, the system comprising a target MQTT server, a target database and at least one downstream system, wherein the target MQTT server is determined based on the target message published by the upstream system and is used to forward the target message, the system also comprises: an MQTT forwarder, which is used to authenticate with the target MQTT server; when the authentication is passed, a connection is established with the target MQTT server and the target message forwarded by the target MQTT server is received, a mapping relationship between the target database and the corresponding downstream system is established based on the target message, and a system task is determined based on the mapping relationship so that the downstream system performs the system task.

[0007] The MQTT-based message forwarding system provided by the present invention isolates the operating logic of new business needs by adding an MQTT forwarder, and specifically authenticates the target MQTT server through the MQTT forwarder; when the authentication is passed, a connection is established with the target MQTT server and the target message forwarded by the target MQTT server is received, a mapping relationship between the target database and the corresponding downstream system is established according to the target message, and a system task is determined according to the mapping relationship so that the downstream system executes the system task, which can reduce the system coupling degree of message transmission, realize effective supervision of new business needs and corresponding services, improve data transmission efficiency, and greatly improve the system usage experience, meeting the system's efficient operation requirements.

[0008] In an optional implementation, the MQTT forwarder includes: a monitoring module, a database module and a log module;

[0009] Among them, the monitoring module is used to monitor the message release of the upstream system; when monitoring the target message released by the upstream system, it connects to the target MQTT server and monitors the running status of the target MQTT server, and monitors the running process of the downstream system executing the corresponding system task;

[0010] The database module is used to monitor the running status of the target database, wherein the target database stores a preset message list, which contains multiple messages, each of which contains a mapping relationship between the corresponding task and the material information associated with it;

[0011] The log module is used to monitor and record system operation information.

[0012] The present invention designs an MQTT forwarder including a monitoring module, a database module and a log module, which can integrate integrated functions such as service connection, message subscription and reception, and system operation monitoring, completely isolate the operating logic of the existing system from new requirements, help reduce the system coupling degree of message transmission, thereby simplifying the system operation process and improving the system utilization efficiency.

[0013] In an optional embodiment, each downstream system has a built-in message reading module, wherein the message reading module is used to read the corresponding message in the preset message list in the target database and convert the message into a system task so that the corresponding downstream system executes the system task.

[0014] The present invention embeds a message reading module in each downstream system to obtain system tasks corresponding to the newly added requirements, thereby being able to completely isolate the operation logic of the existing system and reducing the system coupling of message transmission to a certain extent.

[0015] In an optional implementation, the monitoring module includes: a task issuing unit and a task reporting unit;

[0016] Among them, the task issuing unit is used to respond to the target message issued by the upstream system, load the authentication file corresponding to the target message, parse the authentication file to obtain the corresponding parsing file, authenticate with the target MQTT server based on the parsing file, and establish a connection with the target MQTT server when the authentication is passed; receive the target message forwarded by the target MQTT server and identify the corresponding entity type of the target message, determine the entity mapping relationship of the entity type according to the target database and insert it into the preset message list of the target database; and send the target message to the target downstream system, wherein the target downstream system refers to the downstream system that has subscribed to the corresponding target message;

[0017] The task reporting unit is used to collect and analyze the operation data corresponding to the target task reported by the target downstream system when the target downstream system executes the target task, wherein the target task is obtained by the target downstream system reading the target message from the preset message list of the target database and converting the target message.

[0018] The present invention designs a monitoring module including a task issuing unit and a task reporting unit, so that the tasks issued by the upstream system can be obtained in real time, and forwarded to enable the corresponding downstream system to obtain and execute the tasks; at the same time, the task execution process of the downstream system is monitored in real time to obtain abnormal conditions in the task execution process, which can greatly improve the efficiency of message transmission, further reduce the operating burden of the downstream system, help improve the execution efficiency of the downstream system tasks, and thus ensure the smooth completion of the tasks.

[0019] In an optional implementation, the MQTT-based message forwarding system further includes:

[0020] When the operation data corresponding to the target task reported by the target downstream system collected by the task reporting unit is the operation end data, the state of the corresponding entity type of the target message in the preset message list of the target database is changed;

[0021] Alternatively, when the operation data corresponding to the target task reported by the target downstream system collected by the task reporting unit is operation abnormality data, corresponding abnormality processing is performed on the target downstream system.

[0022] The present invention can timely grasp the execution progress of the target task by real-time monitoring and analysis of the corresponding operating data during the target downstream system executing the target task, thus ensuring the smooth completion of the target task to a certain extent.

[0023] In an optional implementation, the preset message list is constructed based on historical tasks executed by each downstream system and material information associated with the historical tasks.

[0024] The present invention can establish a connection relationship between each downstream system and a target database by constructing a message list of historical tasks executed by each downstream system and material information associated with the historical tasks, thereby improving the efficiency of each downstream system in executing corresponding tasks.

[0025] In an optional embodiment, the MQTT forwarder also includes a client, which is configured with a visual operation interface. The visual operation interface has multiple built-in function buttons and a display area, wherein each function button is used to set the message to be published in the upstream system, and the display area is used to display the message to be published.

[0026] The present invention provides a message configuration interface for the upstream system through a visual operation interface configured in the client of the MQTT forwarder, which can meet the personalized configuration requirements of the upstream system for different published messages and help improve the efficiency of message transmission and task execution.

[0027] In an optional embodiment, the client of the MQTT forwarder is started when the preset deployment requirements are met, and when the client is started, the database module of the MQTT forwarder is automatically connected to the target database, wherein the preset deployment requirements include that the MQTT forwarder and each downstream system are in the same network environment or share the same target database.

[0028] The present invention can ensure the normal operation of the MQTT forwarder by designing the standardized deployment requirements of the client of the MQTT forwarder, thereby improving the efficiency of message processing and service supervision, and greatly ensuring the efficient operation of the system.

[0029] In a second aspect, the present invention provides a method for using a message forwarding system based on MQTT, which is applied to a message forwarding system based on MQTT as described in the first aspect or any corresponding embodiment thereof, and the method includes:

[0030] The MQTT forwarder responds to the target message published by the upstream system and performs an authenticated connection with the target MQTT server based on the target message; when establishing a connection with the target MQTT server, it receives the target message forwarded by the target MQTT server and identifies the corresponding entity type of the target message, determines the entity mapping relationship of the entity type according to the target database and inserts it into the preset message list of the target database; and sends the target message to the target downstream system, wherein the target downstream system refers to the downstream system that has subscribed to the target message;

[0031] The target downstream system reads the target message from the preset message list of the target database, converts the target message into the target task, executes the target task and reports the operation data corresponding to the target task execution process to the MQTT forwarder;

[0032] The MQTT forwarder collects and analyzes the operating data reported by the target downstream system to monitor the process of executing the target task of the target downstream system.

[0033] The method for using the message forwarding system based on MQTT of the present invention isolates the operation logic of the new business demand by adding an MQTT forwarder, specifically responds to the target message released by the upstream system through the MQTT forwarder, and performs an authentication connection with the target MQTT server based on the target message; after the authentication connection, receives the target message forwarded by the target MQTT server and identifies the corresponding entity type of the target message; determines the entity mapping relationship of the entity type according to the target database and inserts it into the preset message list of the target database; at the same time, sends the target message to the corresponding target downstream system that has subscribed to the same target message; so that the target downstream system reads the target message from the preset message list of the target database and converts it into a target task, executes the target task and reports the operation data corresponding to the execution process of the target task; the MQTT forwarder collects and analyzes the operation data reported by the target downstream system to realize the process monitoring of the execution of the target task by the target downstream system, which can significantly reduce the system coupling degree of message transmission, not only can realize the effective supervision of new business demands and corresponding services, but also improves the data transmission efficiency and system usage experience, greatly meeting the efficient operation requirements of the system.

[0034] In an optional implementation, the method for using the MQTT-based message forwarding system further includes:

[0035] When the operating data reported by the target downstream system collected by the MQTT forwarder is abnormal, an early warning signal is generated and sent to the target downstream system, so that the target downstream system can handle the exception based on the early warning signal.

[0036] When the MQTT forwarder monitors that the operating data reported by the target downstream system is abnormal, the target downstream system is processed accordingly to ensure the smooth completion of the target task, thereby helping to improve the execution efficiency of the downstream system tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 It is a structural diagram of a message forwarding system based on MQTT according to an embodiment of the present invention;

[0039] Figure 2 is a structural diagram of another message forwarding system based on MQTT according to an embodiment of the present invention;

[0040] Figure 3 It is a schematic diagram of the structure of the MQTT forwarding system;

[0041] Figure 4 It is a schematic diagram of the database table structure;

[0042] Figure 5 This is a client diagram of the MQTT forwarder;

[0043] Figure 6 This is a schematic diagram of the MQTT operation log recorded by the MQTT forwarder;

[0044] Figure 7 It is a flowchart of a method for using the MQTT-based message forwarding system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0046] In this embodiment, a message forwarding system based on MQTT is provided. Figure 1 Schematic diagram of the structure of the message forwarding system based on MQTT in an embodiment of the present invention. Figure 1As shown, the system includes a target MQTT server 1, a target database 2 and at least one downstream system 3, wherein the target MQTT server 1 is determined based on the target message published by the upstream system 4 and is used to forward the target message; the system also includes: an MQTT forwarder 5, which is used to authenticate with the target MQTT server 1; when the authentication is passed, a connection is established with the target MQTT server 1 and the target message forwarded by the target MQTT server 1 is received, a mapping relationship between the target database 2 and the corresponding downstream system 3 is established based on the target message, and a system task is determined based on the mapping relationship so that the downstream system 3 performs the system task.

[0047] In this embodiment, the specific types of the upstream system 4 and the downstream system 3 are not limited here, and can be adaptively adjusted according to actual needs. For example, the upstream system 4 is an MES system; the downstream system 3 is a WMS system or an RCS system, which is only for exemplary description.

[0048] It should be noted that, in this embodiment, the target MQTT server 1 is an MQTT server (also called MQTT Broker), which is the core component in the MQTT architecture and is responsible for coordinating communications between MQTT clients (publishers and subscribers). Specifically, the MQTT Broker acts as a central hub, receives messages published by clients, and filters and distributes them according to topics; it supports a large number of concurrent connections, can handle the communication needs of thousands or even millions of devices, and can ensure efficient management and delivery of information flows.

[0049] It should be noted that the target database 2 in this embodiment is used to store relevant data of all systems including the upstream system and all downstream systems, and its specific content can be adaptively adjusted according to the actual system type.

[0050] In the embodiment of the present invention, an MQTT forwarder is added to isolate the operating logic of the new business demand, and specifically, the MQTT forwarder is used to authenticate the target MQTT server; when the authentication is passed, a connection is established with the target MQTT server and the target message forwarded by the target MQTT server is received, a mapping relationship between the target database and the corresponding downstream system is established according to the target message, and the system task is determined according to the mapping relationship so that the downstream system executes the system task. This can reduce the system coupling degree of message transmission, achieve effective supervision of new business demands and corresponding services, improve data transmission efficiency, and greatly improve the system usage experience, meeting the system's efficient operation requirements.

[0051] In this embodiment, Figure 2 FIG. 1 is a schematic diagram of another MQTT-based message forwarding system according to an embodiment of the present invention. Figure 2, the MQTT forwarder 5 includes: a monitoring module 51, a database module 52 and a log module 53; wherein the monitoring module 51 is used to monitor the message release of the upstream system 4; when the target message released by the upstream system 4 is monitored, the target MQTT server 1 is connected and the running state of the target MQTT server 1 is monitored, and the running process of the downstream system 3 executing the corresponding system task is monitored; the database module 52 is used to monitor the running state of the target database 2, wherein the target database 2 stores a preset message list, and the preset message list contains multiple messages, and each message contains a mapping relationship between the corresponding task and the material information associated with it; the log module 53 is used to monitor and record the system operation information. Specifically, the MQTT forwarder designed in this embodiment, which includes a monitoring module, a database module and a log module, can integrate the integrated functions such as service connection, message subscription and reception, and system operation monitoring, completely isolate the operation logic of the existing system from the new demand, and help reduce the system coupling degree of message transmission, thereby simplifying the system operation process and improving the system efficiency.

[0052] It should be noted that the preset message list in this embodiment is constructed based on the historical tasks executed by each downstream system and the material information associated with the historical tasks. Specifically, by constructing a message list associated with the historical tasks executed by each downstream system and the material information associated with the historical tasks, a connection relationship between each downstream system and the target database can be established, thereby improving the efficiency of each downstream system in executing the corresponding tasks.

[0053] It should be noted that the monitoring module 51 in this embodiment includes: a task issuing unit 511 and a task reporting unit 512; wherein the task issuing unit 511 is used to respond to the target message issued by the upstream system 4, load the authentication file corresponding to the target message, parse the authentication file to obtain the corresponding parsing file, authenticate with the target MQTT server 1 based on the parsing file, and establish a connection with the target MQTT server 1 when the authentication is passed; receive the target message forwarded by the target MQTT server 1 and identify the corresponding entity type of the target message, determine the entity mapping relationship of the entity type according to the target database 2 and insert it into the preset message list of the target database; and send the target message to the target downstream system, wherein the target downstream system refers to the downstream system 3 that has subscribed to the target message; the task reporting unit 512 is used to collect and analyze the operating data corresponding to the target task reported by the target downstream system when the target downstream system executes the target task, wherein the target task is obtained by the target downstream system reading the target message from the preset message list of the target database 2 and converting the target message.

[0054] It should be explained that the authentication file in this embodiment is used to ensure the secure communication between the target MQTT server 1 and the MQTT forwarder 5, and its specific type can be adaptively adjusted according to the actual communication transmission protocol. For example, MQTT technology provides transport layer security (TLS) and secure socket layer (SSL) encryption functions to ensure the security of data transmission; TLS is (TransporLayer Sercurity, transport layer security protocol); SSL is (Security Socket Layer, encryption socket protocol layer). In actual applications, the authentication connection between the MQTT server and the client can be carried out through the corresponding security certificate carried when the message is published, which is only used as an example.

[0055] In this embodiment, the connection relationship between the target database 2 and the target downstream system can be realized through ORM (Object-Relational Mapping) technology. It should be noted that ORM technology is used to map objects represented by object models to SQL-based relational model database structures; wherein SQL is Structured Query Language, which is a special programming language, i.e., a database query and programming language, used to access data and query, update and manage relational database systems.

[0056] In the embodiment of the present invention, by designing a monitoring module including a task issuing unit and a task reporting unit, it is possible to obtain the tasks issued by the upstream system in real time, and forward them so that the corresponding downstream system can obtain and execute the tasks; at the same time, the task execution process of the downstream system is monitored in real time to obtain abnormal situations in the task execution process, which can greatly improve the efficiency of message transmission, further reduce the operating burden of the downstream system, help improve the execution efficiency of the downstream system tasks, and thus ensure the smooth completion of the tasks.

[0057] It should be noted that the MQTT-based message forwarding system of this embodiment also includes: when the operation data corresponding to the target task reported by the target downstream system collected by the task reporting unit 512 is operation end data, the state of the corresponding entity type of the target message in the preset message list of the target database 2 is changed; or, when the operation data corresponding to the target task reported by the target downstream system collected by the task reporting unit 512 is operation exception data, corresponding exception processing is performed on the target downstream system.

[0058] In the embodiment of the present invention, by real-time monitoring and analysis of the corresponding operating data during the target downstream system executing the target task, the execution progress of the target task can be grasped in time, which ensures the smooth completion of the target task to a certain extent.

[0059] In this embodiment, see Figure 2 A message reading module 31 is built into the downstream system 3, wherein the message reading module 31 is used to read the corresponding message of the preset message list in the target database 2, and convert the message into a system task so that the corresponding downstream system 3 executes the system task.

[0060] It should be noted that this embodiment adheres to the design principle of "single responsibility principle", so the designed MQTT forwarder 5 itself is only responsible for the transmission of MQTT messages, that is, the MQTT forwarder 5 does not participate in the downstream system, such as the business process of the WMS system, so the various downstream systems can be decoupled to a certain extent.

[0061] In the embodiment of the present invention, a message reading module is built into each downstream system to obtain system tasks corresponding to the newly added requirements, which can be completely isolated from the operation logic of the existing system, thereby reducing the system coupling degree of message transmission to a certain extent.

[0062] In this embodiment, the MQTT forwarder 5 also includes a client, which is configured with a visual operation interface. The visual operation interface has multiple built-in function buttons and a display area, wherein each function button is used to set the message to be published of the upstream system 4, and the display area is used to display the message to be published.

[0063] In the embodiment of the present invention, a message configuration interface of the upstream system is provided through a visual operation interface configured in the client of the MQTT forwarder, which can meet the personalized configuration requirements of the upstream system for different published messages and help improve the efficiency of message transmission and task execution.

[0064] It should be noted that the client of the MQTT forwarder of this embodiment is turned on when the preset deployment requirements are met, and when the client is turned on, the database module 52 of the MQTT forwarder 5 is automatically connected to the target database 2, wherein the preset deployment requirements include that the MQTT forwarder 5 and each downstream system 3 are in the same network environment or share the same target database. Specifically, by designing the standardized deployment requirements of the client of the MQTT forwarder, the normal operation of the MQTT forwarder can be guaranteed, thereby improving the efficiency of message processing and service supervision, and greatly ensuring the efficient operation of the system.

[0065] In a specific embodiment, in order to address the problems of high system coupling caused by directly referencing MQTT services to WMS, which in turn affects the overall operating logic of the existing system; and confusing log records caused by referencing the existing log framework to the new service, making it difficult to manage and monitor the MQTT service, a message forwarding solution based on MQTT is designed to ensure that the normal operation of the original logic will not be interfered with when new operating logic needs to be added, so as to ensure the parallel operation of different logical processing of the system. Figure 3This is a schematic diagram of the structure of the MQTT forwarding system. Figure 3 It can be seen that the system includes MQTT forwarder, client MQTT server (i.e. target MQTT server), target database and WMS / WCS (i.e. downstream system). It should be noted that WCS is (WarehouseControl System, warehouse control system); MQTTnet is a high-performance .NET library for MQTT-based communication, which provides an MQTT Client (client) and an MQTT Server (agent or server); among them, the MQTT client is a device that publishes or subscribes to messages, and the MQTT server is the central node for receiving, storing and distributing these messages, that is, the client is responsible for sending and receiving messages, and the server is responsible for managing and delivering messages; SQLSugar is a lightweight open source ORM framework that supports multiple databases (such as SQL Server, MySQL, etc.). It provides rich functions, including CRUD operations, transaction management, dynamic table names, multi-table joint queries, etc. Developers can implement complex database logic through simple chain operations.

[0066] In this embodiment, the MQTT forwarder includes a monitoring module that automatically connects and monitors the specified MQTT server; a database module that connects to the database to read the database status and update the database data; a visualization module that provides specific operating parameters and manual operations, and a log module that monitors the operation of the MQTT forwarding system and records the system's processing results. Specifically, the working principle of the forwarder is as follows:

[0067] 1. Load ORM to connect the downstream system to the target database.

[0068] 2. Load the client TLS authentication file, parse it through X509Certificate, parse it into an entity object through the ssl_protocols instruction, and load the parsed authentication file into the MQTT forwarder. It should be noted that X509Certificate is a public key certificate representation built in accordance with the X.509 standard, which is mainly used to ensure the security of network communications and verify identity; the ssl_protocols instruction is used to specify the SSL / TLS protocol version supported by the server, thereby improving the security of the server.

[0069] 3. Establish a TLS two-way authentication connection with the customer MQTT server.

[0070] 4. Subscribe to the specified topic (i.e. Topic) and listen to Topic messages; traverse the specified data table in the database and listen to the task reporting status of the WMS / WCS system.

[0071] It should be noted that, compared with the existing MQTT proxy server, the above-mentioned MQTT forwarder of this embodiment also includes some logical processing for docking with the WMS system, that is, this forwarder will assist WMS in performing logical processing of some tasks to avoid reprocessing of the MQTT data read by WMS, thereby increasing the operating burden of WMS.

[0072] It should be noted that, before the specific deployment of the above-mentioned MQTT forwarding system of this embodiment, the database table structure is first designed according to the MQTT service message, such as the corresponding lists named T_MQTTMsg and T_MQTTMaterial, which are used to receive the processed MQTT tasks and the material information associated with the tasks, among which MQTTMsg and MQTTMaterial are a one-to-many relationship and are associated through taskID. Figure 4 It is a schematic diagram of the database table structure. Specifically, Figure 4 The meanings of the parameters contained in different tables are shown in the parameter comparison table in Table 1.

[0073] Table 1

[0074] parameter meaning taskID Unique ID of the task partNumber Item Number serialNumber Material serial number lot Batch number qty quantity productionDate Production Date packageCode Packaging code isNull Is it an empty package? reportWork Whether to report work dockingBin Docking station / docking point F_CatchTime Message capture time F_ConsumeTime Message consumption time F_State Message Status F_TaskType Task Type

[0075] In this embodiment, after the database table structure is established, the MQTT forwarding system client is deployed and enabled. It should be noted that the MQTT forwarder and WMS / WCS must be deployed in the same network environment or use the same database. The database module of the forwarder will automatically connect to the database service when the client is enabled. Configured message processing flow: When the listening module of the MQTT forwarder receives the MQTT message sent by the MES, the MQTT information is deserialized into an entity type recognized by .Net ASP. After obtaining the entity type, through the MQTT message entity class reading module assembled in the WMS / WCS, that is, after MQTT obtains the entity class, it inserts the MQTT message table through the ORM, and the WMS / WCS reads the message table to read the MQTT message, converts it into a WMS / WCS system task according to the message content, and executes it autonomously. After the execution is completed, the status of the MQTT message entity class is changed.

[0076] It should be noted that the status of the MQTT message entity class in this embodiment can be adaptively understood based on relevant content in this field. For example, the status of the MQTT message entity class mainly includes: CONNECT status (for requests for the client to establish a connection with the agent), SUBSCRIBE status (for subscribing to a topic), and DISCONNECT (for disconnecting), etc.

[0077] In this embodiment, after the above deployment is completed, the forwarder is started, and after the parameters are entered, the specified server is connected, and the authentication file is loaded together. Then the monitoring module will subscribe to the topic we need to monitor. In the right window of the MQTT forwarder, the log module will record every step of the forwarder so that the message content in the topic can be seen in real time; at the same time, the text log recorded by the log module can also be found in the local folder to monitor the information flow and various anomalies in the MQTT forwarder. It should be noted that the client of the MQTT forwarder in this embodiment and the recorded MQTT operation log can be found in Figure 5 and Figure 6 .

[0078] In this embodiment, in order to further optimize the overall performance of the MQTT message forwarding system, multi-threading can be used to process business logic (consuming less performance than patrolling); the client's visual interface can also be optimized, such as using better material packages and more reasonable functional block divisions. At the same time, you can also try to integrate table design into the visual interface to further enhance the customer's operating experience.

[0079] In summary, the MQTT forwarder developed in this embodiment can enable the forwarder to supervise the relevant content of the MQTT service instead of the WMS, and at the same time transfer the relevant new logic to the forwarder for processing, which greatly reduces the coupling degree between the WMS and the MQTT service; secondly, in terms of supervision, it avoids the embarrassing situation that the WMS needs to monitor the operation of downstream systems and other equipment downward, and needs to monitor the connection and message processing of the MQTT service upward; in terms of performance, part of the logic of WMS docking with the MQTT service is transferred to the listening module of the MQTT forwarder, that is, the WMS data conversion is completed in the listening process. When the forwarder forwards the data, the WMS receives the data that has been processed by the forwarder, which can greatly improve the operating efficiency of the WMS.

[0080] An embodiment of the present invention provides an embodiment of a method for using a message forwarding system based on MQTT. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0081] In this embodiment, a method for using a message forwarding system based on MQTT is provided. Figure 7 is a flow chart of a method for using a message forwarding system based on MQTT according to an embodiment of the present invention. Figure 7 As shown, the process includes the following steps:

[0082] In step S701, the MQTT forwarder responds to the target message published by the upstream system and establishes an authenticated connection with the target MQTT server based on the target message; when establishing a connection with the target MQTT server, it receives the target message forwarded by the target MQTT server and identifies the corresponding entity type of the target message, determines the entity mapping relationship of the entity type according to the target database and inserts it into the preset message list of the target database; and sends the target message to the target downstream system, wherein the target downstream system refers to the downstream system that has subscribed to the target message.

[0083] In step S702, the target downstream system reads the target message from the preset message list of the target database, converts the target message into a target task, executes the target task and reports the operation data corresponding to the target task execution process to the MQTT forwarder.

[0084] Step S703, the MQTT forwarder collects and analyzes the operation data reported by the target downstream system to monitor the process of executing the target task of the target downstream system.

[0085] It should be noted that the contents involved in the process steps of the above method in this embodiment are referred to in the previous text and will not be repeated here.

[0086] In the embodiment of the present invention, an MQTT forwarder is added to isolate the operation logic of the new business demand. Specifically, the MQTT forwarder is used to respond to the target message published by the upstream system, and an authentication connection is performed with the target MQTT server based on the target message; after the authentication connection, the target message forwarded by the target MQTT server is received and the corresponding entity type of the target message is identified; the entity mapping relationship of the entity type is determined according to the target database and inserted into the preset message list of the target database; at the same time, the target message is sent to the corresponding target downstream system that has subscribed to the same target message; so that the target downstream system reads the target message from the preset message list of the target database and converts it into a target task, executes the target task and reports the operation data corresponding to the execution process of the target task; the MQTT forwarder collects and analyzes the operation data reported by the target downstream system to realize the process monitoring of the execution of the target task by the target downstream system, which can significantly reduce the system coupling degree of message transmission, not only can realize the effective supervision of new business needs and corresponding services, but also improve the data transmission efficiency and system usage experience, which greatly meets the efficient operation requirements of the system.

[0087] In actual applications, since there is a possibility of failure when the downstream system executes tasks, the method of using the MQTT-based message forwarding system of this embodiment also includes: when the operating data reported by the target downstream system collected by the MQTT forwarder is abnormal, an early warning signal is generated and sent to the target downstream system, so that the target downstream system performs exception processing based on the early warning signal.

[0088] It should be noted that the specific content of the early warning signal and the corresponding exception handling in this embodiment is not limited here, and can be determined according to the actual needs. Specifically, when the MQTT forwarder monitors that the operating data reported by the target downstream system is abnormal, the target downstream system is handled accordingly, which can ensure the smooth completion of the target task, thereby helping to improve the execution efficiency of the downstream system tasks.

[0089] In summary, the method for using the MQTT-based message forwarding system in the embodiment of the present invention can reduce the system coupling degree of message transmission, improve service supervision efficiency and ensure the efficient operation of the system.

[0090] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A message forwarding system based on MQTT, the system comprising a target MQTT server, a target database and at least one downstream system, wherein: The target MQTT server is determined based on the target message published by the upstream system, and is used to forward the target message; it is characterized in that the system also includes: an MQTT forwarder, which is used to authenticate with the target MQTT server; when the authentication is passed, a connection is established with the target MQTT server and the target message forwarded by the target MQTT server is received, a mapping relationship between the target database and the corresponding downstream system is established based on the target message, and a system task is determined based on the mapping relationship so that the downstream system executes the system task.

2. The MQTT-based message forwarding system according to claim 1, characterized in that: The MQTT forwarder includes: a monitoring module, a database module and a log module; The monitoring module is used to monitor the message release of the upstream system; when the target message released by the upstream system is monitored, the target MQTT server is connected and the running status of the target MQTT server is monitored, and the running process of the downstream system executing the corresponding system task is monitored; The database module is used to monitor the running status of the target database, wherein the target database stores a preset message list, the preset message list includes multiple messages, and each message includes a mapping relationship between a corresponding task and its associated material information; The log module is used to monitor and record system operation information.

3. The MQTT-based message forwarding system according to claim 2, characterized in that: Each downstream system has a built-in message reading module, wherein the message reading module is used to read the corresponding message in the preset message list in the target database and convert the message into a system task so that the corresponding downstream system executes the system task.

4. The MQTT-based message forwarding system according to claim 2, characterized in that: The monitoring module includes: a task issuing unit and a task reporting unit; Wherein, the task issuing unit is used to respond to the target message published by the upstream system, load the authentication file corresponding to the target message, parse the authentication file to obtain the corresponding parsing file, authenticate with the target MQTT server based on the parsing file, and establish a connection with the target MQTT server when the authentication is passed; receive the target message forwarded by the target MQTT server and identify the corresponding entity type of the target message, determine the entity mapping relationship of the entity type according to the target database and insert it into the preset message list of the target database; and issue the target message to the target downstream system, wherein the target downstream system refers to the downstream system that has subscribed to the target message; The task reporting unit is used to collect and analyze the operating data corresponding to the target task reported by the target downstream system when the target downstream system executes the target task, wherein the target task is obtained by the target downstream system reading the target message from a preset message list of a target database and converting the target message.

5. The MQTT-based message forwarding system according to claim 4, characterized in that: The system further comprises: When the operation data corresponding to the target task reported by the target downstream system collected by the task reporting unit is operation end data, a state change is performed on the entity type corresponding to the target message in the preset message list of the target database; Alternatively, when the operation data corresponding to the target task reported by the target downstream system and collected by the task reporting unit is operation abnormality data, corresponding abnormality processing is performed on the target downstream system.

6. The MQTT-based message forwarding system according to claim 2, characterized in that: The preset message list is constructed based on the historical tasks executed by each downstream system and the material information associated with the historical tasks.

7. The MQTT-based message forwarding system according to claim 2, characterized in that: The MQTT forwarder also includes a client, which is configured with a visual operation interface. The visual operation interface has multiple function buttons and a display area built in, wherein each function button is used to set a message to be published in an upstream system, and the display area is used to display the message to be published.

8. The MQTT-based message forwarding system according to claim 7, characterized in that: The client of the MQTT forwarder is turned on when the preset deployment requirements are met, and when the client is turned on, the database module of the MQTT forwarder is automatically connected to the target database, wherein the preset deployment requirements include that the MQTT forwarder and each downstream system are in the same network environment or share the same target database.

9. A method for using a message forwarding system based on MQTT, applied to the message forwarding system based on MQTT as claimed in any one of claims 1 to 8, characterized in that: The method comprises: The MQTT forwarder responds to the target message published by the upstream system and performs an authentication connection with the target MQTT server based on the target message; when establishing a connection with the target MQTT server, it receives the target message forwarded by the target MQTT server and identifies the corresponding entity type of the target message, determines the entity mapping relationship of the entity type according to the target database and inserts it into the preset message list of the target database; and sends the target message to the target downstream system, wherein the target downstream system refers to the downstream system that has subscribed to the target message; The target downstream system reads the target message from the preset message list of the target database, converts the target message into a target task, executes the target task and reports the operation data corresponding to the target task execution process to the MQTT forwarder; The MQTT forwarder collects and analyzes the operating data reported by the target downstream system to monitor the process of executing the target task of the target downstream system.

10. The method for using the MQTT-based message forwarding system according to claim 9, characterized in that: The method further comprises: When the operating data reported by the target downstream system collected by the MQTT forwarder is abnormal, an early warning signal is generated and sent to the target downstream system, so that the target downstream system performs abnormal processing based on the early warning signal.