Message transmission method, system and device, storage medium and computer program product
By introducing a message distribution module into the power system, decoupling the pre-module and message output module, the problem of difficulty for users to view messages in real time is solved, the user's function of conveniently viewing messages is realized, and storage management is optimized.
Patent Information
- Application Number
- CN202510068456.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-02-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the pre-module is coupled with the message storage module, which causes the user to download and view the message when viewing it, making it difficult to meet the user's needs for real-time message viewing.
By introducing a message distribution module, the pre-module is decoupled from the message output module. The message distribution module receives real-time messages sent by the pre-module and sends them to the subscribed message output module according to the message identification.
It enables users to view real-time messages without downloading messages, improves user convenience, reduces the use of hard disk space, and avoids additional storage management.
Smart Images

Figure CN119484610A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of power system protocol message transmission, and in particular to a message transmission method, system, device, storage medium and computer program product. Background Art
[0002] During the operation and control of the power system, different devices will exchange information by transmitting messages. And the messages in the information exchange process must comply with the power system specification. The power system specification specifies in detail the communication protocols, data transmission methods and other standards between different devices in the power system.
[0003] As the bottom-level communication module in the power system, the front-end module is a module that summarizes the basic power data. The front-end module is mainly used to communicate with other devices to collect, process and transmit data. The communication between the front-end module and other devices is also achieved through messages. Users can view the messages to clarify the interaction between the front-end module and other devices or the operating status of the monitoring system.
[0004] However, the inventors have found that the front-end module in the prior art usually has a storage function for protocol messages. That is, the message storage module is usually coupled to the front-end module. In this way, when the front-end module interacts with other devices through messages, the front-end module will directly write the interacted messages into a local file for storage.
[0005] The prior art method of coupling the message storage module to the front module causes the user to download the message before viewing it, and it is difficult to view the real-time message in time, which is difficult to meet the user's needs. Summary of the invention
[0006] The present application aims to provide a message transmission method, system, device, storage medium and computer program product to improve user convenience.
[0007] According to one aspect of the present application, a message transmission method performed by a message distribution module is proposed. The message transmission method is applied to a message transmission system. The message transmission system includes a front-end module, a message distribution module, and a message output module. The front-end module interacts with a substation terminal device via messages. The message distribution module receives message subscriptions. The message output module subscribes to messages from the message distribution module in response to a user's instruction. The message transmission method includes a message distribution module receiving a real-time message sent by the front-end module and a message identifier corresponding to the real-time message. The real-time message is a message generated by the interaction between the front-end module and the substation terminal device. According to the message identifier, the real-time message is sent to the first target message output module that has subscribed to the real-time message to output the real-time message.
[0008] According to another aspect of the present application, a message transmission method performed by a front-end module is proposed. The front-end module is a module of a message transmission system. The message transmission system includes a front-end module, a message distribution module, and a message output module. The front-end module interacts with a substation terminal device via messages. The message distribution module receives message subscriptions. The message output module, in response to a user's instruction, subscribes to messages from the message distribution module. The message transmission method includes the front-end module collecting real-time messages while interacting with the substation terminal device via messages. Determine the message identifier of the real-time message. Send the real-time message and the message identifier to the message distribution module so that the message distribution module executes the message transmission method described in the above aspect.
[0009] According to another aspect of the present application, a message transmission system is proposed. The message transmission system includes a front-end module, a message distribution module, and a message output module. The front-end module interacts with the substation terminal device through messages, and determines the message identifier based on the interacted real-time message. The message distribution module receives the real-time message and the message identifier from the front-end module, and receives the message subscription. The message output module subscribes to the message distribution module for the message in response to the user's instruction. The message distribution module also sends the real-time message to the first target message output module according to the message identifier corresponding to the real-time message, so as to publish the real-time message. Among them, the first target message output module is a message output module that has subscribed to the real-time message.
[0010] According to another aspect of the present application, an electronic device is proposed, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0011] According to another aspect of the present application, a non-volatile computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.
[0012] According to another aspect of the present application, a computer program product is provided, which includes a computer program stored on a computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the method described above is implemented.
[0013] Beneficial Effects The present application utilizes a message distribution module to decouple the front-end module from the message output module, so that the message that the front-end module interacts with the substation terminal device is not directly stored locally, but the message distribution module distributes the message to the message output module that subscribes to the message, so that the message output module outputs the message. In this way, users do not have to download the message from the front-end module to view it, but can automatically distribute the message by the message distribution module, so that they can directly view the message, which improves user convenience. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0015] Figure 1 This is a schematic diagram of the system architecture of the message transmission system according to an embodiment of the present application; Figure 2 A schematic diagram of a flow chart of a message transmission method executed by a message distribution module in an embodiment of the present application; Figure 3 A schematic diagram of a process for discarding unsubscribed messages in an embodiment of the present application; Figure 4 A schematic diagram of a flow chart of a message distribution module in an embodiment of the present application establishing a binding relationship in a subscription publishing mode; Figure 5 A schematic diagram of a flow chart of establishing a binding relationship in a broadcast publishing mode by a message distribution module according to an embodiment of the present application; Figure 6 A schematic diagram of the process of distributing messages in the subscription and publishing mode by the message distribution module of the embodiment of the present application; Figure 7 A schematic diagram of a flow chart of a message distribution module in a broadcast publishing mode according to an embodiment of the present application; Figure 8 A schematic diagram of a flow chart of a message transmission method executed by a front-end module in an embodiment of the present application; Fig. 9 A schematic diagram of an electronic device according to an embodiment of the present application.
[0016] Description of reference numerals: 01. Front-end module; 02. Message distribution module; 03. Message output module; 901. Processor; 902. Bus; 903. Memory; 904. Transceiver. DETAILED DESCRIPTION
[0017] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0018] The described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of these specific details, or other modes, components, materials, devices, etc. may be adopted. In these cases, known structures, methods, devices, implementations, materials or operations will not be shown or described in detail.
[0019] In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0020] The terms "first", "second" and the like in the specification and claims of this application and the above drawings are used to distinguish different objects rather than to describe a specific order.
[0021] The following is a clear and complete description of the technical solution of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0022] According to one aspect of the present application, an embodiment of the present application provides a message transmission method, which is applied to a message transmission system.
[0023] Figure 1 The system architecture of the message transmission system is shown. Figure 1 The message transmission system includes a front-end module 01, a message distribution module 02 and a message output module 03. The front-end module 01 is used to interact with the substation terminal device. The message output module 03 is used to respond to user instructions to subscribe to messages from the message distribution module 02. The message distribution module 02 is used to receive the subscription of the message output module 03 to the message and execute the message transmission method.
[0024] Figure 2 The flow of the message transmission method is shown. Figure 2 , the message transmission method includes steps S210-S220.
[0025] In step S210, the message distribution module 02 receives the real-time message sent by the front-end module 01 and the message identifier corresponding to the real-time message.
[0026] According to the exemplary embodiment, the real-time message is a message generated by the interaction between the front-end module 01 and the substation terminal device. The message identifier is a message identifier determined by the front-end module 01 according to the message, and is used to indicate the message type of the message.
[0027] The message type may be specifically a type classified according to a message interaction channel. For example, messages for the same message interaction channel are of one message type. The message identifier may be an identifier describing a substation terminal device communicating with the front-end module 01 to indicate the message interaction channel of the message.
[0028] Exemplarily, when the front-end module 01 sends a message to the substation terminal device, or when the front-end module 01 receives a message sent by the substation terminal device, the front-end module 01 will determine the message identifier of the real-time message according to the interactive real-time message. And the front-end module 01 will also send the real-time message and the message identifier to the message distribution module 02, so that the message distribution module 02 receives the real-time message and the message identifier.
[0029] In step S220, the message distribution module 02 sends the real-time message to the first target message output module that has subscribed to the real-time message according to the message identifier, so as to output the real-time message.
[0030] According to the exemplary embodiment, the user can subscribe to messages according to the needs, and the message output module 03 is user-oriented. The user can send a message subscription instruction for the target message type to the message output module 03, and the message output module 03 subscribes to the message distribution module 02 for the message of the target message type according to the message subscription instruction.
[0031] According to the example embodiment, in step S220, when the message distribution module 02 receives the real-time message and the message identifier, it determines the message type of the real-time message according to the message identifier, and sends the real-time message to the message output module 03 that has subscribed to the real-time message. In this way, the message output module 03 can receive the real-time message and output the real-time message for the user to view.
[0032] For example, when a user wants to view the messages exchanged between the substation terminal device a1 and the front-end module 01 , the user can send a message subscription instruction for the substation terminal device a1 to the message output module 03 . The message output module 03 then subscribes the substation terminal device a1 to the message distribution module 02 .
[0033] When the message distribution module 02 receives the real-time message and the message identifier, the message distribution module 02 will send the message exchanged between the substation terminal device a1 and the front-end module 01 to the message output module 03 according to the message identifier. The message output module 03 can receive the subscribed related message and can directly display the message or store the message so that the user can view it in time.
[0034] In the embodiment of the present application, the message distribution module 02 is used to decouple the front module 01 from the message output module 03, so that the message interacted by the front module 01 is not directly stored locally, but the message distribution module 02 distributes the message to the message output module 03 that subscribes to the message, so that the message output module 03 outputs the message. In this way, the user does not have to download the message from the front module 01 to view it, but the message distribution module 02 can automatically distribute the message to view the message directly, which improves user convenience.
[0035] Moreover, in the prior art, the front module 01 and the message storage module are coupled, so that the front module 01 writes the message into a local file and only supports downloading the message for viewing. This approach also has other disadvantages. First, the front module 01 stores all the messages into a local file, which will occupy a large amount of hard disk space. Secondly, since the space occupied by the message will become larger and larger as the system runs in this approach, it is necessary to additionally manage the locally stored messages, such as deleting or compressing them.
[0036] In the present application, the message of the front module 01 is not directly stored in the local file, but is directly distributed to the subscribed message output module 03 by the message distribution module 02. In this way, the hard disk space occupied by the message of the front module 01 can be reduced, and even no hard disk space can be occupied. In addition, since the message is not directly stored in the hard disk space, there is no need to manage the messages stored in the hard disk space.
[0037] According to some embodiments, the message distribution module 02 of the present application may specifically be RabbitMQ message middleware.
[0038] RabbitMQ is an open source message broker software that implements the Advanced Message Queuing Protocol for asynchronous communication between different applications.
[0039] RabbitMQ message middleware can support cross-node access in the network and supports secondary development in almost all commonly used programming languages. In this way, users can choose easy-to-use programming languages and nodes according to the needs of actual scenarios for secondary development, which improves the applicability of the message distribution module 02 of this application.
[0040] In addition, RabbitMQ can support message queue localization and can distribute messages through message queues to improve message reliability.
[0041] According to some embodiments, reference Figure 3 , the message transmission method may further include step S230.
[0042] In step S230 , the message distribution module 02 discards the real-time message if the real-time message is not subscribed by the message output module 03 .
[0043] According to an example embodiment, when the real-time message is not subscribed by the message output module 03, the message distribution module 02 may directly discard the message, thereby reducing the occupation of memory resources by messages that are not of interest.
[0044] According to some embodiments, the front-end module 01, the message distribution module 02 and the message output module 03 may be deployed on the same server or on different servers, which is not limited here.
[0045] For example, the front-end module 01, the message distribution module 02 and the message output module 03 are deployed on the same server, or the front-end module 01, the message distribution module 02 and the message output module 03 are deployed on their respective corresponding servers.
[0046] It is worth mentioning that when each module is deployed on different servers, it is necessary to ensure that the servers with data interaction can communicate with each other, that is, the two servers with data interaction need to have the same network environment.
[0047] For example, the front-end module 01 needs to send a message to the message distribution module 02 , so the server of the front-end module 01 and the server of the message distribution module 02 are required to be able to communicate with each other.
[0048] For example, the message distribution module 02 will send the subscribed message to the message output module 03, and the message output module 03 will also subscribe to the message from the message distribution module 02. Therefore, it is required that the message distribution module 02 and the message output module 03 can also communicate with each other, that is, the message distribution module 02 and the message output module 03 are in the same network environment. In this way, the user can subscribe to the message from the message distribution module 02 through the message output module 03 in the application of the terminal.
[0049] According to some embodiments, reference Figure 4 The message transmission method also includes step S410, step S420 and step S430.
[0050] In step S410, the message distribution module 02 determines the data distribution mode according to the number of message output modules 03 in the message transmission system.
[0051] According to an example embodiment, the data distribution mode includes a broadcast publishing mode and a subscription publishing mode. In the broadcast publishing mode, the message distribution module 02 can use multiple switches of the fanout type to broadcast data to all subscribers, which is suitable for application scenarios with multiple consumers.
[0052] In the subscription and publishing mode, the message distribution module 02 can use a switch of type direct and distribute data through different routers, which is suitable for application scenarios with only one consumer.
[0053] Exemplarily, in step S410, when the number of message output modules 03 in the message transmission system is 1, the message distribution module 02 determines that the data distribution mode is the subscription publishing mode. When the number of message output modules 03 in the message transmission system is at least two, the message distribution module 02 determines that the data distribution mode is the broadcast publishing mode.
[0054] In step S420, when the data distribution mode is the subscription publishing mode and the message distribution module 02 receives a subscription instruction for the target message interaction channel sent by the message output module 03, it determines the target subscription message queue.
[0055] According to an example embodiment, the target subscription message queue is a subscription message queue corresponding to the target message interaction channel.
[0056] The subscription message queue is a message queue created in advance according to each message interaction channel, and there is a one-to-one correspondence between the subscription message queue and the message interaction channel.
[0057] Exemplarily, in the message transmission system, the front-end module 01 performs message interaction with the substation terminal devices b1 - b3 .
[0058] The message interaction channels of the message transmission system are respectively the message interaction channel c1 between the front module 01 and the substation terminal device b1, the message interaction channel c2 between the front module 01 and the substation terminal device b2, and the message interaction channel c3 between the front module 01 and the substation terminal device b3.
[0059] Each message interaction channel corresponds to a subscription message queue. For example, message interaction channel c1 corresponds to subscription message queue d1, message interaction channel c2 corresponds to subscription message queue d2, and message interaction channel c3 corresponds to subscription message queue d3.
[0060] In the subscription publishing mode, the message generated by the message interaction channel will be distributed to the corresponding subscription message queue by the message distribution module 02 using switches and routers. The subscription message queue will distribute the message to the message output module 03 of the subscription message.
[0061] In the subscription publishing mode, the message distribution module 02 distributes the message to the corresponding subscription message queue through the switch and the router. In addition, the message distribution module 02 is provided with a direct type switch and a preset number of routers.
[0062] There is a one-to-one correspondence between routers and message exchange channels. For example, message exchange channel b1 corresponds to router e1, and message exchange channel b2 corresponds to router e2.
[0063] In the subscription publishing mode, all messages of the message interaction channels b1-b3 will be sent to the direct type switch. The switch will then distribute the message to the router corresponding to the message interaction channel, and then the router will distribute the message to the subscription message queue corresponding to the message interaction channel. Then the subscription message queue will send the message to the message output module 03.
[0064] According to an example embodiment, in the above step S420, in the subscription publishing mode, when the message distribution module 02 receives a subscription instruction for a target message interaction channel, the subscription message queue corresponding to the target message interaction channel can be used as the target subscription message queue.
[0065] According to the example embodiment, the target subscription message queue is used to distribute messages of the target message interaction channel. In the process of distributing messages by the subscription message queue, the message is usually sent to the message output module 03 bound to the subscription message queue. That is, the subscription message queue is used to distribute the messages in the queue to the bound message output module 03.
[0066] In step S430, the message distribution module 02 binds the second target message output module to the target subscription message queue, so that the target subscription message queue sends the message of the target message interaction channel to the second target message output module.
[0067] According to the example embodiment, the second target message output module is a message output module 03 that sends a subscription instruction for a target message interaction channel.
[0068] For example, when any message output module x1 sends a subscription instruction for the message interaction channel b1, the message distribution module 02 binds the subscription message queue c1 to the any message output module x1 so that the subscription message queue c1 can send messages of the message interaction channel b1 to the any message output module x1.
[0069] According to some embodiments, reference Figure 5 , the message transmission method also includes steps S510-S530.
[0070] In step S510, when the data distribution mode is the broadcast publishing mode and a subscription instruction for a target message interaction channel is received from the message output module 03, the message distribution module 02 determines a target broadcast switch corresponding to the target message interaction channel.
[0071] According to an exemplary embodiment, the broadcast switch is pre-set according to the message interaction channel, and the message interaction channel and the broadcast switch are in a one-to-one correspondence.
[0072] For example, the message interaction channel b1 corresponds to the broadcast switch f1, the message interaction channel b2 corresponds to the broadcast switch f2, and the message interaction channel b3 corresponds to the broadcast switch f3.
[0073] Messages for message interaction channel b1 will be distributed via broadcast switch f1, and so on. Messages for message interaction channel b2 will be distributed via broadcast switch f2, and messages for message interaction channel b3 will be distributed via broadcast switch f3.
[0074] According to the example embodiment, in step S510, when the data distribution mode is the broadcast publishing mode, if the message distribution module 02 receives a subscription instruction for the target message interaction channel sent by the message output module 03, the broadcast switch corresponding to the target message interaction channel can be determined as the target broadcast switch. In this way, the target broadcast switch distributes the message of the target message interaction channel.
[0075] In step S520 , the message distribution module 02 determines the target broadcast message queue corresponding to the third target message output module 03 .
[0076] According to the exemplary embodiment, in the message distribution module 02, a broadcast message queue is respectively provided for each message output module 03 in the message transmission system, that is, there is a one-to-one correspondence between the message output module 03 and the broadcast message queue.
[0077] The broadcast message queue is used to send the messages in the queue to the corresponding message output module 03.
[0078] For example, the message transmission system has a first message output module g1 and a second message output module g2, and a broadcast message queue h1 and a broadcast message queue h2 are set in the message distribution module 02. The broadcast message queue h1 is used to send messages in the queue to the first message output module g1, and the broadcast message queue h2 is used to send messages in the queue to the second message output module g2.
[0079] According to the example embodiment, in step S520, the third target message output module is a message output module 03 that generates a subscription instruction for the target message interaction channel in the broadcast publishing mode. For example, the first message output module g1 sends a subscription instruction for the message interaction channel b1. In step S520, the broadcast message queue corresponding to the first message output module g1 is the broadcast message queue h1.
[0080] In step S530 , the message distribution module 02 binds the target broadcast switch with the target broadcast message queue so that the target broadcast switch sends the message of the target message interaction channel to the target broadcast message queue, and the target broadcast message queue sends the message to the third target message output module 03 .
[0081] For example, it is assumed that the first message output module g1 sends a subscription instruction to the message interaction channel b1, the target broadcast switch is the broadcast switch f1, and the target broadcast message queue is the broadcast message queue h1. In step S530, the message distribution module 02 binds the broadcast switch f1 to the broadcast message queue h1. In this way, when the message interaction channel b1 generates a message, after the message is output by the front module 01 to the message distribution module 02, the message distribution module 02 will distribute the message to the bound broadcast message queue h1 through the broadcast switch f1. The broadcast message queue h1 can send the message to the first message output module g1.
[0082] According to some embodiments, when there is a message output module 03 that subscribes to a message from a message distribution module 02, the message distribution module 02 can establish a binding relationship between the switch, the message queue and the message output module 03 through the above-mentioned steps S410-step S430 and steps S510-step S530, so that when the subsequent message distribution module 02 receives a message, it can be accurately transmitted to the message output module 03 that subscribes to the message.
[0083] According to some embodiments, reference Figure 6 In the above step S220, the message distribution module 02 sends the real-time message to the first target message output module that has subscribed to the real-time message according to the message identifier, which may specifically include step S221 and step S222.
[0084] In step S221, when the data distribution mode is the subscription publishing mode, the message distribution module 02 determines the subscription message queue corresponding to the real-time message according to the message identifier and the first preset mapping relationship.
[0085] According to the exemplary embodiment, the message identifier is an identifier of a message interaction channel characterizing the message, and is generated by the front-end module 01 according to the message.
[0086] Exemplarily, the message identifier may be determined by the front-end module 01 according to a preset subscription switch name and a router name. The router name may be determined by the front-end module 01 according to the number of the message interaction channel of the message.
[0087] For example, the real-time message is a message generated by the message interaction channel b1. The preset subscription switch name is fepmessage. The message interaction channel b1 corresponds to the router e1. The name of the router e1 can be route&channel&1. The front module 01 determines that the message identifier of the real-time message can be fepmessage, route&channel&1.
[0088] According to an example embodiment, the first preset mapping relationship includes a mapping relationship between a message interaction channel and a subscription message queue. Each message interaction channel corresponds to a subscription message queue, and the subscription message queue is used to receive and distribute messages of the corresponding message interaction channel.
[0089] According to an example embodiment, in step S221, when the data distribution mode is a subscription publishing mode, the message distribution module 02 can determine the message interaction channel of the real-time message based on the message identifier, and then determine the subscription message queue corresponding to the real-time message based on the message interaction channel and the first preset mapping relationship.
[0090] Exemplarily, when the real-time message is a message generated by the message interaction channel b1, in the subscription and publication mode, the message distribution module 02 determines that the subscription message queue is the subscription message queue c1.
[0091] In step S222, the message distribution module 02 sends the real-time message to the subscription message queue corresponding to the real-time message through the preset subscription switch, so that the subscription message queue corresponding to the real-time message sends the real-time message to the first target message output module.
[0092] According to the example embodiment, the preset subscription switch is the only switch used in the subscription publishing mode. For example, the above-mentioned direct type switch, and the switch name is fepmessage. That is, for any message interaction channel, the message will be distributed through the preset subscription switch in the subscription publishing mode.
[0093] Exemplarily, for a real-time message from the message interaction channel b1, in the subscription and publishing mode, the message distribution module 02 sends the real-time message to the subscription message queue c1 through the direct type switch and the router named route&channel&1.
[0094] When the first target message output module has subscribed to the message of the message interaction channel b1, the first target message output module has been bound to the subscription message queue c1. Therefore, the subscription message queue c1 will send the received real-time message to the first target message output module.
[0095] According to some embodiments, reference Figure 7 In the above step S220, the message distribution module 02 sends the real-time message to the first target message output module that has subscribed to the real-time message according to the message identifier, which can also be achieved through steps S710 and S720.
[0096] In step S710, when the data distribution mode is the broadcast publishing mode, the message distribution module 02 determines the target broadcast switch according to the message identifier and the second preset mapping relationship.
[0097] According to the example embodiment, in the broadcast publishing mode, the message distribution module 02 sends the real-time message to the first target message output module according to the message identifier through the steps S710 and S720.
[0098] According to an exemplary embodiment, the message identifier may also include the name of the broadcast switch. The name of the broadcast switch may be specifically set by the front-end module 01 according to the number of the message interaction channel corresponding to the broadcast switch.
[0099] Each message interaction channel corresponds to a broadcast switch, and the broadcast switch is used to distribute the messages of the corresponding message interaction channel in the broadcast publishing mode.
[0100] For example, the real-time message is a message generated by the message interaction channel b1. The message interaction channel b1 is numbered 1, and the corresponding broadcast switch is the broadcast switch e1.
[0101] The name of the broadcast switch is named according to a preset naming rule, for example, the name of the broadcast switch is fep&channel&id. ID is the number of the message interaction channel corresponding to the broadcast switch. ID is the unique identifier of each message interaction channel.
[0102] For example, the name of the broadcast switch e1 is fep&channel&1. The front-end module 01 determines that the message identifier of the real-time message may be fep&channel&1.
[0103] According to some embodiments, the broadcast switch can be created manually by a staff member according to actual conditions, and the name of the broadcast switch can be manually set. The staff member can also define the attribute of the broadcast switch as persistent.
[0104] Persistent broadcast switches can still exist after RabbitMQ is restarted, which can ensure the reliability of message delivery.
[0105] According to an example embodiment, the second preset mapping relationship includes a mapping relationship between a broadcast switch and a message interaction channel. In step S710, the message distribution module 02 can determine the message interaction channel corresponding to the message according to the message identifier, and then determine the broadcast switch according to the second preset mapping relationship. For example, the real-time message in the above example corresponds to the broadcast switch e1.
[0106] Alternatively, in step S710, the message distribution module 02 may directly determine the name of the broadcast switch according to the message identifier of the real-time message, so as to determine the target broadcast switch.
[0107] In step S720, the message distribution module 02 distributes the real-time message to the target broadcast message queue through the target broadcast switch, so that the target broadcast message queue sends the real-time message to the first target message output module.
[0108] Among them, the target broadcast message queue is the broadcast message queue corresponding to the first target message output module.
[0109] According to the exemplary embodiment, in the broadcast publishing mode, each message output module 03 corresponds to a broadcast message queue. Each message interaction channel corresponds to a broadcast switch.
[0110] For the message output module 03 that subscribes to the message interaction channel, the broadcast message queue of the message output module 03 has a binding relationship established with the broadcast switch in advance.
[0111] In this way, when the broadcast switch receives the relevant message, the broadcast switch can output the message to the bound broadcast message queue. The broadcast message queue then transmits the message in the queue to the corresponding message output module 03.
[0112] Exemplarily, assuming that both the third message output module g3 and the fourth message output module g4 subscribe to the real-time message of the message interaction channel b1, the broadcast switch f1 is bound to the broadcast message queue h3 and the broadcast message queue h4 respectively.
[0113] In step S720, when the message distribution module 02 receives the real-time message, the real-time message is distributed to the broadcast message queue h3 and the broadcast message queue h4 through the broadcast switch f1. The broadcast message queue h3 then sends the real-time message to the third message output module g3, and the broadcast message queue h3 distributes the real-time message to the fourth message output module g4.
[0114] According to some embodiments, the message distribution module 02 uses RabbitMQ message middleware to implement message distribution. Since the message queue in RabbitMQ supports the setting of multiple attributes, the user can flexibly adjust the data receiving scheme by setting the attributes of the message queue.
[0115] According to some embodiments, in order to improve data reliability and ensure system security, the user may also perform the following settings on the message queue of the RabbitMQ message middleware.
[0116] In some embodiments, users can set each message queue (broadcast message queue and subscription message queue) to be persistent, so that even if the RabbitMQ server is restarted, the persistent message queue will not be deleted.
[0117] In some embodiments, the user can also set the maximum length of the message queue (x-max-length). In this way, the server will not crash due to too many messages piling up in the message queue. It is worth noting that the setting value of the maximum length of the message queue should be set in consideration of the user's consumption capacity and the operating system configuration.
[0118] In some embodiments, the user can also set an expiration date (x-message-ttl parameter, in milliseconds) for all messages in the message queue. In this way, all messages in the message queue will have the same expiration date. If the survival time of the message in the message queue exceeds the expiration date and has not been consumed, the message will be deleted from the message queue.
[0119] It should be clearly understood that the present application describes how to form and use specific examples, but the present application is not limited to any details of these examples. On the contrary, based on the teaching of the content disclosed in the present application, these principles can be applied to many other embodiments.
[0120] Those skilled in the art may understand that all or part of the steps to implement the above embodiments are implemented as a computer program executed by a CPU. When the computer program is executed by the CPU, the above functions defined by the above method provided in this application are performed.
[0121] According to another aspect of the present application, an embodiment of the present application provides another message transmission method, which is also applied to a message transmission system.
[0122] Reference Figure 1 The message transmission system includes a front-end module 01, a message distribution module 02 and a message output module 03. The front-end module 01 interacts with the substation terminal device. The message distribution module 02 receives the message subscription. The message output module 03 subscribes to the message distribution module 02 in response to the user's instruction.
[0123] The message transmission method is executed by the front-end module 01. Figure 8 The message transmission method includes steps S810 to S830.
[0124] In step S810, the front-end module 01 collects real-time messages when interacting with the substation terminal device.
[0125] In step S820, the front-end module 01 determines the message identifier of the real-time message.
[0126] In step S830, the front-end module 01 sends the real-time message and the message identifier to the message distribution module 02, so that the message distribution module 02 executes the message transmission method described in the above steps S210 to S220.
[0127] Exemplarily, when the front-end module 01 sends a message to the substation terminal device, or when the front-end module 01 receives a message sent by the substation terminal device, the front-end module 01 collects a real-time message. In step S820, the front-end module 01 determines the message identifier of the real-time message, and in step S830, the front-end module 01 sends the real-time message and the message identifier to the message distribution module 02.
[0128] When receiving the real-time message and the message identifier, the message distribution module 02 distributes the real-time message to the first target message output module that subscribes to the real-time message. The first target message output module directly faces the user and can directly display the real-time message according to the user's needs or store the real-time message according to the user's needs.
[0129] The present application decouples the front module 01 from the message output module 03 through the message distribution module 02. In this way, the user can directly subscribe to the message of interest, and the message can be automatically transmitted to the user after it is generated, so that the user can obtain the message without having to download it from the front module 01 to view the message, which improves the convenience of the user.
[0130] According to some embodiments, in the above step S820, the front-end module 01 determines the message identifier of the real-time message, and specifically determines the message identifier of the real-time message according to the message interaction channel of the real-time message.
[0131] According to an example embodiment, the message identifier may specifically include a subscription message identifier and a broadcast message identifier.
[0132] The subscription message identifier is used by the message distribution module 02 to determine the router to determine the subscription message queue in the subscription publishing mode.
[0133] According to an example embodiment, the subscription message identifier includes a preset subscription switch name and a subscription router name.
[0134] A preset subscription switch and a preset number of subscription routers are pre-set in the message distribution module 02. Each subscription router corresponds to a message interaction channel. The user pre-sets the name of the preset subscription switch and the names of each subscription router, for example, the preset subscription switch name is set to fepmessage, and each subscription router is named according to the router naming rule.
[0135] Exemplarily, the name of the subscription router may be route&channel&id, where id is the number of the message interaction channel and id is a unique identifier of each message interaction channel.
[0136] Exemplarily, in step S820, when the front-end module 01 receives the real-time message, it can determine the name of the preset subscription switch and the name of the subscription router corresponding to the message interaction channel according to the message interaction channel of the real-time message.
[0137] For example, for a message of the message interaction channel b1, the number of the message interaction channel is 1, and the subscription message identifier of the message is: fepmessage, route&channel&1.
[0138] According to an example embodiment, the broadcast message identifier is used by the message distribution module 02 to determine the broadcast switch in the broadcast publishing mode.
[0139] A preset number of broadcast switches are pre-set in the message distribution module 02. Each broadcast switch corresponds to a message interaction channel. The user pre-names each broadcast switch according to the naming rules of the broadcast switch.
[0140] For example, the name of the broadcast switch can be named in the form of "fep&channel&id". ID is the number of the message interaction channel corresponding to the broadcast switch. ID is the unique identifier of each message interaction channel.
[0141] In step S820, when the front-end module 01 receives the real-time message, it can determine the name of the broadcast switch according to the message interaction channel of the real-time message, and further determine the broadcast message identifier of the real-time message.
[0142] For example, for a message on the message interaction channel b1, the number of the message interaction channel is 1, and the broadcast message identifier of the message is: fep&channel&1.
[0143] According to some embodiments, in the above step S830, the front-end module 01 sends the real-time message and the message identifier to the message distribution module 02. Specifically, the message transmission direction of the real-time message can be determined first. Then, the front-end module 01 adds the transmission direction identifier to the real-time message according to the message transmission direction. Then, the front-end module 01 sends the real-time message and the message identifier with the added transmission direction identifier to the message distribution module 02.
[0144] According to the example embodiment, the message exchange is usually carried out in frames, and a complete message frame includes a frame header, a control field, an address field, a data field, a frame tail, etc. When the front module 01 transmits the message to the message distribution module 02, a transmission time stamp and a transmission direction identifier can be added to the message.
[0145] There are two types of transmission directions, namely, front module 01→substation terminal device, and substation terminal device→front module 01. When the front module 01 adds a transmission direction identifier to the message, the front module 01 can be used as the reference direction, and a sending identifier can be added to the message sent by the front module 01, and a receiving identifier can be added to the message received by the front module 01.
[0146] The transmitted time stamp can be accurate to millisecond level to record the moment when the front-end module 01 receives a message or sends a message.
[0147] According to some embodiments, a message parsing module may be built into the front-end module 01. The message parsing module may parse the message and send the parsed message together with the original message to the message distribution module 02 for the convenience of subscribers to view.
[0148] Exemplarily, the front-end module 01 records the message after the transmission identifier, and the message after parsing is: 2024-09-1012:12:22.456789 [send] 68 04 07 00 00 00 [explain] start frame.
[0149] According to another aspect of the present application, a message transmission system is provided. Figure 1 The message transmission system includes a front-end module 01, a message distribution module 02 and a message output module 03.
[0150] The front-end module 01 interacts with the substation terminal device through messages, and determines the message identifier according to the interacted real-time message. The message output module 03 responds to the user's instruction to subscribe to the message distribution module 02. The message distribution module 02 receives the real-time message and message identifier from the front-end module 01, and receives the message subscription. The message distribution module 02 also sends the real-time message to the first target message output module according to the message identifier corresponding to the real-time message, so as to publish the real-time message. Among them, the first target message output module is the message output module 03 that has subscribed to the real-time message.
[0151] According to the example embodiment, when the front-end module 01 sends a message to the substation terminal device, or when the front-end module 01 receives a message sent by the substation terminal device, the front-end module 01 collects a real-time message. The front-end module 01 determines the message identifier of the real-time message, and the front-end module 01 then sends the real-time message and the message identifier to the message distribution module 02.
[0152] When receiving the real-time message and the message identifier, the message distribution module 02 distributes the real-time message to the first target message output module that subscribes to the real-time message. The first target message output module directly faces the user and can directly display the real-time message according to the user's needs or store the real-time message according to the user's needs.
[0153] The present application decouples the front module 01 from the message output module 03 through the message distribution module 02. In this way, the user can directly subscribe to the message of interest, and the message can be automatically transmitted to the user after it is generated, so that the user can obtain the message without having to download it from the front module 01 to view the message, which improves the convenience of the user.
[0154] According to another aspect of the present application, an electronic device is also provided. Fig. 9 , Fig. 9The electronic device shown includes: a processor 901 and a memory 903. The processor 901 and the memory 903 are connected, such as through a bus 902. Optionally, the electronic device may further include a transceiver 904. It should be noted that in actual applications, the transceiver 904 is not limited to one, and the structure of the electronic device does not constitute a limitation on the embodiments of the present application.
[0155] The processor 901 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor 901 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0156] The bus 902 may include a path to transmit information between the above components. The bus 902 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 902 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0157] The memory 903 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0158] The memory 903 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 901. The processor 901 is used to execute the application code stored in the memory 903 to implement the contents shown in the above method embodiment.
[0159] According to another aspect of the present application, an embodiment of the present application provides a non-volatile computer-readable medium, on which a computer program is stored, and when the computer-readable medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment. The storage medium can be a read-only memory, a disk or an optical disk, etc.
[0160] According to another aspect of the present application, an embodiment of the present application provides a computer program product. The computer program product includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the corresponding content in the aforementioned method embodiment.
[0161] Finally, it should be noted that the above are only preferred embodiments of the present application and are not intended to limit the present application. Although the present application is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions of the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A message transmission method, characterized in that: The message transmission method is applied to a message transmission system, which includes: a front-end module for performing message interaction with a substation terminal device; a message distribution module for receiving message subscriptions; and a message output module for subscribing messages to the message distribution module in response to a user's instruction; The message transmission method comprises: The message distribution module receives the real-time message sent by the front-end module and the message identifier corresponding to the real-time message, wherein the real-time message is a message generated by the interaction between the front-end module and the substation terminal device; According to the message identifier, the real-time message is sent to a first target message output module that has subscribed to the real-time message, so as to output the real-time message.
2. The message transmission method according to claim 1, characterized in that: The message transmission method also includes: Determining a data distribution mode according to the number of the message output modules in the message transmission system; When the data distribution mode is a subscription publishing mode and a subscription instruction for a target message interaction channel sent by a message output module is received, a target subscription message queue is determined; There is a one-to-one correspondence between the subscription message queue and the message interaction channel, and the target subscription message queue is the subscription message queue corresponding to the target message interaction channel; The target subscription message queue is used to distribute the messages of the target message interaction channel, and is used to distribute the messages in the queue to the bound message output module; Bind the second target message output module to the target subscription message queue so that the target subscription message queue sends the message of the target message interaction channel to the second target message output module, wherein the second target message output module is a message output module that sends subscription instructions for the target message interaction channel in a subscription and publishing mode.
3. The message transmission method according to claim 2, characterized in that: The message transmission method also includes: When the data distribution mode is a broadcast publishing mode and a subscription instruction for a target message interaction channel sent by a message output module is received, determining a target broadcast switch corresponding to the target message interaction channel; There is a one-to-one correspondence between the message interaction channel and the broadcast switch, and the target broadcast switch is used to distribute the message of the target message interaction channel; Determine a target broadcast message queue corresponding to a third target message output module, wherein the message output module and the broadcast message queue are in a one-to-one correspondence, the broadcast message queue is used to send messages in the queue to the corresponding message output module, and the third target message output module is a message output module that sends a subscription instruction for the target message interaction channel in the broadcast publishing mode; The target broadcast switch is bound to the target broadcast message queue, so that the target broadcast switch sends the message of the target message interaction channel to the target broadcast message queue, and the target broadcast message queue sends the message to the second target message output module.
4. The message transmission method according to claim 3, characterized in that: The message identifier is an identifier of a message interaction channel representing the message; The sending, according to the message identifier, the real-time message to a first target message output module that has subscribed to the real-time message comprises: In the case where the data distribution mode is a subscription publishing mode, determining a subscription message queue corresponding to the real-time message according to the message identifier and the first preset mapping relationship; The real-time message is sent to a subscription message queue corresponding to the real-time message through a preset subscription switch, so that the subscription message queue corresponding to the real-time message sends the real-time message to the first target message output module; The first preset mapping relationship includes a mapping relationship between a message interaction channel and a subscription message queue.
5. The message transmission method according to claim 3, characterized in that: The message identifier is an identifier of a message transmission channel representing the message; The sending the real-time message to the first target message output module according to the message identifier corresponding to the real-time message includes: In the case where the data distribution mode is a broadcast publishing mode, determining a target broadcast switch according to the message identifier and a second preset mapping relationship; Distributing the real-time message to a target broadcast message queue through the target broadcast switch, so that the target broadcast message queue sends the real-time message to a first target message output module; Wherein, the target broadcast message queue is the broadcast message queue corresponding to the first target message output module; The second preset mapping relationship includes a mapping relationship between a message interaction channel and a broadcast switch.
6. A message transmission method, characterized in that: The message transmission method is applied to a message transmission system, and the message transmission system comprises: The front module exchanges messages with the substation terminal equipment; Message distribution module, receiving message subscription; A message output module, responding to a user's instruction to subscribe to a message from the message distribution module; The message transmission method comprises: The front-end module collects real-time messages when interacting with the substation terminal device through messages; Determining a message identifier of the real-time message according to a message interaction channel of the real-time message; The real-time message and the message identifier are sent to the message distribution module, so that the message distribution module executes the message transmission method described in any one of claims 1-5 above.
7. The message transmission method according to claim 6, characterized in that: The sending the real-time message and the message identifier to the message distribution module includes: Determining a message transmission direction of the real-time message; According to the message transmission direction, adding a transmission direction identifier in the real-time message; The real-time message with the transmission direction identifier added and the message identifier are sent to the message distribution module.
8. A message transmission system, characterized in that: include: The front-end module interacts with the substation terminal equipment through messages and determines the message identifier according to the interactive real-time message; A message distribution module, receiving real-time messages and message identifiers from the front-end module, and receiving message subscriptions; A message output module, responding to a user's instruction to subscribe to a message from the message distribution module; The message distribution module also sends the real-time message to the first target message output module according to the message identifier corresponding to the real-time message, so as to publish the real-time message; The first target message output module is a message output module that has subscribed to the real-time message.
9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the message transmission method as described in any one of claims 1-7.
10. A non-volatile computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the message transmission method as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
A front-end processor and an acquisition system for a power system
CN109739919A
Message calling method and device, electronic equipment and storage medium
CN113259430A
Multi-protocol access system and method for multiple Internet of Things devices
CN116471342A
Message processing method, device, equipment, system and readable storage medium
CN116954934A
Data transmission method, data processing method, data reception method and device, and storage medium
WO2021088641A1