Gateway message sending method and device, storage medium and electronic device

CN116760792BActive Publication Date: 2026-06-23QINGDAO HAIER TECH +2

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QINGDAO HAIER TECH
Filing Date
2023-06-29
Publication Date
2026-06-23

Smart Images

  • Figure CN116760792B_ABST
    Figure CN116760792B_ABST
Patent Text Reader

Abstract

The application discloses a gateway message sending method and device, a storage medium and an electronic device, relates to the technical field of smart home, and solves the technical problem of how to improve the sending efficiency of gateway messages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart home technology, and more specifically, to a method, apparatus, storage medium, and electronic device for sending gateway messages. Background Technology

[0002] Currently, for edge scenarios running on Linux gateways such as 30GU1 and 30GU2, a centralized single-host edge scenario service architecture, i.e., a centralized single-gateway structure, is often adopted. This gateway is a device without a touchscreen that can automatically or manually control the execution of scenarios and the switching of loads (e.g., lights, curtains). In actual user scenarios, an edge scenario, as the name suggests, is a scenario that can run on an edge device. To improve the response speed of edge scenarios, it is often necessary to process and send messages generated during edge scenario execution in a timely manner. However, this single-gateway edge scenario, due to its reliance on pipelined communication, requires each message to undergo multiple layers of processing before transmission, resulting in significant message transmission time and low message sending efficiency.

[0003] Therefore, in related technologies, there is a technical problem of how to improve the efficiency of gateway message sending.

[0004] No effective solution has yet been proposed for the technical problem of improving the efficiency of gateway message sending in related technologies. Summary of the Invention

[0005] This application provides a method, apparatus, storage medium, and electronic device for sending gateway messages, to at least solve the technical problem of how to improve the sending efficiency of gateway messages in related technologies.

[0006] According to one embodiment of this application, a method for sending gateway messages is provided, comprising: receiving a first acquisition request sent by a second message forwarding component of a second service gateway through a first event bus interaction component of a first service gateway; determining a gateway message corresponding to a target message type indicated by the first acquisition request; and sending the gateway message corresponding to the target message type to the second message forwarding component to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway.

[0007] In one exemplary embodiment, determining the gateway message corresponding to the target message type indicated by the first acquisition request includes: identifying other components in the first service gateway besides the first event bus interaction component; receiving gateway messages of different message types sent by the other components through the first event bus interaction component; and determining the gateway message corresponding to the target message type indicated by the first acquisition request from the gateway messages of different message types.

[0008] In one exemplary embodiment, sending a gateway message corresponding to the target message type to the second message forwarding component includes: determining a first user-side service module connected to the first event bus interaction component from the other components; if it is determined that the gateway message corresponding to the target message type represents a first gateway message corresponding to a device state, obtaining the first gateway message from the first user-side service module; and sending the first gateway message to the second message forwarding component.

[0009] In one exemplary embodiment, sending a gateway message corresponding to the target message type to the second message forwarding component includes: determining a first domain model component connected to the first event bus interaction component from the other components; obtaining the second gateway message from the first domain model component when the gateway message corresponding to the target message type represents a second gateway message corresponding to a domain state; and sending the second gateway message to the second message forwarding component; wherein the second gateway message corresponding to the domain state is generated by the first domain model component through a first gateway message corresponding to a device state obtained from the first event bus interaction component.

[0010] In one exemplary embodiment, sending a gateway message corresponding to the target message type to the second message forwarding component includes: determining a first scenario software development kit component connected to the first event bus interaction component from the other components; if it is determined that the gateway message corresponding to the target message type represents a third gateway message corresponding to a scenario state, obtaining the third gateway message from the first scenario software development kit component; and sending the third gateway message to the second message forwarding component.

[0011] In one exemplary embodiment, sending a gateway message corresponding to the target message type to the second message forwarding component includes: determining a first memory load calculation component connected to the first event bus interaction component from among the other components; if it is determined that the gateway message corresponding to the target message type represents a fourth gateway message corresponding to a memory state, obtaining the fourth gateway message from the first memory load calculation component, wherein the first memory load calculation component is used to determine the fourth gateway message based on the monitored gateway memory; and sending the fourth gateway message to the second message forwarding component.

[0012] In one exemplary embodiment, sending a gateway message corresponding to the target message type to the second message forwarding component includes: determining a first scenario software development kit component connected to the first event bus interaction component from the other components; if it is determined that the gateway message corresponding to the target message type represents a fifth gateway message corresponding to a script state, obtaining the fifth gateway message from the first scenario software development kit component; and sending the fifth gateway message to the second message forwarding component.

[0013] In one exemplary embodiment, the method further includes: determining from the other components a first domain model component connected to the first event bus interaction component, and a first scene software development kit component connected to the first event bus interaction component; receiving a second gateway message corresponding to a domain state sent by the first domain model component; and, in response to a second acquisition request sent by the first scene software development kit component, sending the second gateway message indicated by the second acquisition request to the first scene software development kit component.

[0014] In one exemplary embodiment, the method further includes: determining from the other components a first domain model component connected to the first event bus interaction component, and a first memory load calculation component connected to the first event bus interaction component; receiving a fourth gateway message corresponding to a memory state sent by the first memory load calculation component; and, in response to a third acquisition request sent by the first domain model component, sending the fourth gateway message indicated by the third acquisition request to the first domain model component.

[0015] In one exemplary embodiment, the method further includes: determining from the other components a first master-slave database backup component connected to the first event bus interaction component, and a first scenario software development kit component connected to the first event bus interaction component; receiving a fifth gateway message corresponding to a script state sent by the first scenario software development kit component; and, in response to a fourth acquisition request sent by the first master-slave database backup component, sending the fifth gateway message indicated by the fourth acquisition request to the first master-slave database backup component.

[0016] According to another aspect of the embodiments of this application, a gateway message sending apparatus is also provided, comprising: a receiving module, configured to receive a first acquisition request sent by a second message forwarding component of a second service gateway through a first event bus interaction component of a first service gateway; a determining module, configured to determine a gateway message corresponding to a target message type indicated by the first acquisition request; and a forwarding module, configured to send the gateway message corresponding to the target message type to the second message forwarding component, so as to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway.

[0017] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described gateway message sending method when it runs.

[0018] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described gateway message sending method through the computer program.

[0019] In this embodiment, a first acquisition request sent by a second message forwarding component of a second service gateway is received by a first event bus interaction component of a first service gateway; a gateway message corresponding to the target message type indicated by the first acquisition request is determined; the gateway message corresponding to the target message type is sent to the second message forwarding component to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway; by adopting the above technical solution, the technical problem of how to improve the sending efficiency of gateway messages is solved, thereby improving the sending efficiency of gateway messages. Attached Figure Description

[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a schematic diagram of the hardware environment for a gateway message sending method according to an embodiment of this application;

[0023] Figure 2 This is a schematic diagram of the structure of a gateway message sending system according to an embodiment of this application;

[0024] Figure 3 This is a flowchart of a gateway message sending method according to an embodiment of this application;

[0025] Figure 4 This is a flowchart (I) illustrating a method for sending gateway messages according to an embodiment of this application;

[0026] Figure 5 This is a flowchart (II) illustrating a method for sending gateway messages according to an embodiment of this application;

[0027] Figure 6 This is a structural block diagram of a gateway message sending device according to an embodiment of this application. Detailed Implementation

[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0030] According to one aspect of the embodiments of this application, a method for sending gateway messages is provided. This method for sending gateway messages is widely applicable to edge scenarios of whole-house intelligent digital control applications such as smart homes, smart home ecosystems, and intelligence house ecosystems. Optionally, in this embodiment, the above-mentioned method for sending gateway messages can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0031] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0032] In one embodiment, combined Figure 2 To provide a better explanation of the aforementioned gateway message interaction system, Figure 2 This is a schematic diagram of the structure of a gateway message interaction system according to an embodiment of this application. For example... Figure 2 As shown, the gateway message interaction system includes Gateway A (equivalent to the first service gateway mentioned above) and Gateway B (equivalent to the second service gateway mentioned above). Gateway A and Gateway B have the same composition structure, and each of Gateway A and Gateway B has a corresponding user service channel.

[0033] Taking Gateway A as an example, the interaction process of gateway messages is explained. The CAE sends messages transmitted via the user service channel to the UCOM component, which then forwards the messages to the gateway message filter (i.e., the first gateway message filter mentioned above). The gateway message filter sends the filtered messages to the event bus broker (equivalent to the event bus interaction component mentioned above). There is a message interaction process between the event bus broker and each of the following modules: the scenario JSDK (equivalent to the first scenario software development kit component mentioned above), the domain model (equivalent to the first domain model component mentioned above), the CPU load statistics module (equivalent to the first memory load calculation component mentioned above), the SDL user side (equivalent to the first user side business module mentioned above), the master-slave database backup module, and the message forwarding module (equivalent to the first message forwarding component mentioned above). In response to a subscription request from any of the following subscription sides—the gateway message filter, scenario JSDK, domain model, CPU load statistics module, SDL user side, master-slave database backup module, or message forwarding module—the event bus broker publishes the gateway message indicated by the subscription request to that subscription side.

[0034] Among them, Figure 2 In this context, SDL (Smart Device Linux SDK) refers to an IoT software development kit used by devices based on the Linux platform.

[0035] CAE (Computer-Aided Engineering) uses computer technology and software tools to simulate, analyze, and optimize physical phenomena, thereby helping designers improve product performance and reliability, reduce product development cycles and costs, and achieve intelligent and digital production. In gateway systems, CAE can also be used for network connectivity modeling and simulation analysis.

[0036] UCOM components refer to a general-purpose type library under COM (Component Object Model) technology, which includes some basic interface and structure definitions. These interfaces and structures allow developers to share code in different development environments, thereby achieving more efficient and reliable software development. UCOM components are commonly used on the Microsoft .NET platform, through which unmanaged code or COM components can be easily called, and objects written on the .NET platform can be interacted with.

[0037] An event bus broker is a component in a messaging framework used to pass messages between different parts of an application or system. It simplifies application development by decoupling publishers and subscribers and enabling asynchronous communication. In an event bus system, the event bus broker acts as a central node, serving as the interaction point for all publishing and receiving messages. The broker ensures messages are sent to the correct destinations, provides data control to connectors, and performs operations such as buffering events. This simplifies application integration, logging of processing tasks, and problem tracking.

[0038] The Scene JSDK (Java Software Development Kit) is a software development kit used to create and manage artificial intelligence scene models in a Java environment. It provides a rich set of APIs and tools, enabling developers to easily create, train, test, and deploy their own machine learning models. This SDK can be used with various third-party frameworks and libraries (such as TensorFlow, Keras, etc.) and supports local or cloud execution. By using the Scene JSDK, developers can quickly build high-quality AI applications for enterprise or individual users.

[0039] This embodiment provides a method for sending gateway messages, applied to the aforementioned terminal device. Figure 3 This is a flowchart of a gateway message sending method according to an embodiment of this application, the process including the following steps:

[0040] Step S302: Receive a first acquisition request sent by the second message forwarding component of the second service gateway through the first event bus interaction component of the first service gateway;

[0041] Step S304: Determine the gateway message corresponding to the target message type indicated by the first acquisition request;

[0042] It should be noted that the target message types mentioned above include at least one of the following: a first gateway message corresponding to the device status, a second gateway message corresponding to the domain status, a third gateway message corresponding to the scene status, a fourth gateway message corresponding to the memory status, and a fifth gateway message corresponding to the script status.

[0043] For example, the first gateway message corresponding to the device status can be represented as the " / user / gatewayid / data" topic message, which includes the original basic messages such as device online / offline / binding / unbinding / subscription / unsubscription / attributes / alarms / event control.

[0044] The second gateway message corresponding to the domain state can be represented as the " / user / gatewayid / dm_data" topic message, including shadow device initialization messages, attribute / alarm message notifications, batch control command messages, domain model point-marking messages, and domain model whitelist messages.

[0045] The third gateway message corresponding to the scene status can be represented as the " / user / gatewayid / scene_data" topic message, including messages such as scene batch control command subscription, SDL device-side messages, SDL user-side messages, and scene tracking messages.

[0046] The fourth gateway message corresponding to the memory status can be represented as the " / user / gatewayid / cpuload_data" topic message, which includes the CPU load status of the gateway device and the IP information of the local area network gateway.

[0047] The fifth gateway message corresponding to the script status can be represented as the " / user / gatewayid / base data" topic message, which includes scene script information, input parameter information passed from the upper layer interface, backup data, etc.

[0048] Step S306: Send the gateway message corresponding to the target message type to the second message forwarding component to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway.

[0049] Through the above steps, the first event bus interaction component of the first service gateway receives a first acquisition request sent by the second message forwarding component of the second service gateway; determines the gateway message corresponding to the target message type indicated by the first acquisition request; and sends the gateway message corresponding to the target message type to the second message forwarding component, so as to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway. This solves the technical problem of how to improve the sending efficiency of gateway messages in related technologies, thereby improving the sending efficiency of gateway messages.

[0050] In an exemplary embodiment, to further illustrate the implementation process of determining the gateway message corresponding to the target message type indicated by the first acquisition request in step S304 above, the following implementation steps are proposed: Step S11, determine the other components in the first service gateway besides the first event bus interaction component; Step S12, receive gateway messages of different message types sent by the other components through the first event bus interaction component; Step S13, determine the gateway message corresponding to the target message type indicated by the first acquisition request from the gateway messages of different message types.

[0051] In an exemplary embodiment, the gateway message corresponding to the target message type can be further sent to the second message forwarding component using the following technical solution: Solution 1, wherein the implementation steps of Solution 1 include: Step S21, determining a first user-side service module connected to the first event bus interaction component from the other components; Step S22, obtaining the first gateway message from the first user-side service module when it is determined that the gateway message corresponding to the target message type represents a first gateway message corresponding to the device state; Step S23, sending the first gateway message to the second message forwarding component.

[0052] Scheme 2, the implementation steps include: step S31, determining a first domain model component connected to the first event bus interaction component from the other components; step S32, when the gateway message corresponding to the target message type represents a second gateway message corresponding to the domain state, obtaining the second gateway message from the first domain model component; step S33, sending the second gateway message to the second message forwarding component; wherein, the second gateway message corresponding to the domain state is generated by the first domain model component through the first gateway message corresponding to the device state obtained from the first event bus interaction component.

[0053] Optionally, before receiving the third gateway message corresponding to the domain state sent by the first domain model component, the system may also respond to the acquisition request sent by the first domain model component; if the gateway message corresponding to the target message type includes a first gateway message corresponding to the device state, the first gateway message corresponding to the device state indicated by the acquisition request may be sent to the first domain model component.

[0054] Alternatively, in response to an acquisition request sent by the first domain model component, if the gateway message corresponding to the target message type includes a third gateway message corresponding to the scene state, the third gateway message corresponding to the scene state indicated by the acquisition request is sent to the first domain model component.

[0055] Optionally, in response to a first acquisition request sent by other components, the first event bus interaction component can send a gateway message corresponding to the target message type indicated by the first acquisition request to the other components. The specific process includes the following steps: determining a first scenario software development kit component and a first domain model component from the other components; receiving a third gateway message corresponding to the scenario state sent by the first scenario software development kit component, and responding to an acquisition request sent by the first domain model component; if the gateway message corresponding to the target message type includes a third gateway message corresponding to the scenario state, sending the third gateway message corresponding to the scenario state indicated by the acquisition request to the first domain model component.

[0056] Scheme 3 includes the following steps: Step S41, determining from the other components a first scene software development kit component connected to the first event bus interaction component; Step S42, if it is determined that the gateway message corresponding to the target message type represents a third gateway message corresponding to the scene state, obtaining the third gateway message from the first scene software development kit component; Step S43, sending the third gateway message to the second message forwarding component.

[0057] Scheme 4, the implementation steps include: Step S51, determining from the other components a first memory load calculation component connected to the first event bus interaction component; Step S52, when determining that the gateway message corresponding to the target message type represents a fourth gateway message corresponding to the memory state, obtaining the fourth gateway message from the first memory load calculation component, wherein the first memory load calculation component is used to determine the fourth gateway message based on the monitored gateway memory; Step S53, sending the fourth gateway message to the second message forwarding component.

[0058] In an optional embodiment, a first memory load calculation component and a first domain model component may also be determined from the other components, and a fourth gateway message corresponding to the memory state sent by the first memory load calculation component may be received; and in response to an acquisition request sent by the first domain model component, if the gateway message corresponding to the target message type includes a fourth gateway message corresponding to the memory state, the fourth gateway message corresponding to the memory state indicated by the acquisition request may be sent to the first domain model component.

[0059] Scheme 5 includes the following steps: Step S61, determining from the other components a first scenario software development kit component connected to the first event bus interaction component; Step S62, if it is determined that the gateway message corresponding to the target message type represents a fifth gateway message corresponding to the script state, obtaining the fifth gateway message from the first scenario software development kit component; Step S63, sending the fifth gateway message to the second message forwarding component.

[0060] In an optional embodiment, a first memory load calculation component and a first scenario software development kit component are determined from the other components; a fourth gateway message corresponding to the memory state is received from the first memory load calculation component; and in response to an acquisition request sent by the first scenario software development kit component, if the gateway message corresponding to the target message type includes a fourth gateway message corresponding to the memory state, the fourth gateway message corresponding to the memory state indicated by the acquisition request is sent to the first scenario software development kit component.

[0061] Alternatively, in other embodiments, a first master-slave database backup component is determined from the other components, and an acquisition request is sent by the first master-slave database backup component; if the gateway message corresponding to the target message type includes a fifth gateway message corresponding to the script state, the fifth gateway message corresponding to the script state indicated by the acquisition request is sent to the first master-slave database backup component.

[0062] In one exemplary embodiment, other technical solutions may also be implemented, and the specific steps include: determining from the other components a first domain model component connected to the first event bus interaction component and a first scene software development kit component connected to the first event bus interaction component; receiving a second gateway message corresponding to the domain state sent by the first domain model component; and responding to a second acquisition request sent by the first scene software development kit component, sending the second gateway message indicated by the second acquisition request to the first scene software development kit component.

[0063] In one exemplary embodiment, further, a first domain model component connected to the first event bus interaction component and a first memory load calculation component connected to the first event bus interaction component may be determined from the other components; a fourth gateway message corresponding to the memory state sent by the first memory load calculation component is received; in response to a third acquisition request sent by the first domain model component, the fourth gateway message indicated by the third acquisition request is sent to the first domain model component.

[0064] In one exemplary embodiment, the following technical solution is further proposed, with specific steps including: determining from the other components a first master-slave database backup component connected to the first event bus interaction component, and a first scenario software development kit component connected to the first event bus interaction component; receiving a fifth gateway message corresponding to a script state sent by the first scenario software development kit component; and responding to a fourth acquisition request sent by the first master-slave database backup component, sending the fifth gateway message indicated by the fourth acquisition request to the first master-slave database backup component.

[0065] Optionally, a first scenario software development kit component connected to the first event bus interaction component and a first memory load calculation component connected to the first event bus interaction component may also be identified from the other components; a fourth gateway message corresponding to the memory state sent by the first memory load calculation component may be received; in response to an acquisition request sent by the first scenario software development kit component, the fourth gateway message indicated by the acquisition request may be sent to the first scenario software development kit component.

[0066] To better understand the process of sending gateway messages as described above, the implementation flow of sending gateway messages will be further explained below with reference to optional embodiments, but this is not intended to limit the technical solutions of the embodiments of this application.

[0067] This embodiment provides a method for sending gateway messages. Figure 4 This is a flowchart (I) illustrating a gateway message sending method according to an embodiment of this application, as shown below. Figure 4 As shown, the specific steps are as follows:

[0068] Step S401: Gateway A's gateway message filter receives JSON messages from the CAE size loop, filters them to get the / user / gatewayid / basedata topic message, and sends the / user / gatewayid / basedata topic message to Gateway A's event soft bus broker (i.e., event bus broker);

[0069] Step S402: The domain model of Gateway A sends a subscription request to the event soft bus broker of Gateway A to subscribe to the topic message / user / gatewayid / data;

[0070] Step S403: In response to the subscription request in step S402, the event soft bus broker of gateway A pushes the topic message / user / gatewayid / data to the domain model of gateway A.

[0071] Step S404: The event soft bus broker of gateway A sends a subscription request to the SDL user side of gateway A to subscribe to the / user / gatewayid / data topic message;

[0072] Step S405: The CPU load statistics module of gateway A publishes a message with the topic / user / gatewayid / cpuload to the event soft bus broker of gateway A;

[0073] Step S406: The SDL user side of gateway A pushes the topic message / user / gatewayid / data to the event soft bus broker of gateway A;

[0074] Step S407: The domain model of gateway A publishes a message on the topic / user / gatewayid / dm_data to the event soft bus broker of gateway A;

[0075] Step S408: The scene JSDK of Gateway A publishes the topic message / user / gatewayid / scene_data to the event soft bus broker of Gateway A;

[0076] Step S409: The domain model of Gateway A sends a subscription request to the event soft bus broker of Gateway A to subscribe to the topic message / user / gatewayid / scene_data;

[0077] Step S410: The event soft bus broker of gateway A pushes the topic message / user / gatewayid / scene_data to the domain model of gateway A;

[0078] Step S411: The scenario JSDK of Gateway A sends a subscription request to the event soft bus broker of Gateway A to subscribe to the topic message / user / gatewayid / dm_data;

[0079] Step S412: The event soft bus broker of gateway A pushes the topic message / user / gatewayid / dm_data to the scenario JSDK of gateway A;

[0080] Step S413: The scenario JSDK of Gateway A publishes a message on the topic / user / gatewayid / base_data to the event soft bus broker of Gateway A;

[0081] Step S414: The master-slave database backup module of Gateway A sends a subscription request to the event soft bus broker of Gateway A to subscribe to the / user / gatewayid / basedata topic message;

[0082] Step S415: The event soft bus broker of gateway A pushes the topic message / user / gatewayid / basedata to the master-slave database backup module of gateway A;

[0083] Step S416: The message forwarding module of Gateway A sends a subscription request to the event soft bus broker of Gateway A to subscribe to the / user / gatewayid / basedata topic message;

[0084] Step S417: The event soft bus broker of gateway A pushes the topic message / user / gatewayid / basedata to the message forwarding module of gateway A;

[0085] Step S418: The message forwarding module of Gateway A sends a subscription request to the event soft bus broker of Gateway A to subscribe to the topic message / user / gatewayid / scene_data;

[0086] Step S419: The event soft bus broker of gateway A pushes the topic message / user / gatewayid / scene_data to the message forwarding module of gateway A;

[0087] Step S420: The message forwarding module of Gateway A sends a subscription request to the event soft bus broker of Gateway A to subscribe to the topic message / user / gatewayid / dm_data;

[0088] Step S421: The event soft bus broker of gateway A pushes the topic message / user / gatewayid / dm_data to the message forwarding module of gateway A;

[0089] It should be noted that the interaction processes in steps S401 to S421 are all message interaction processes within gateway A.

[0090] Step S422: The message forwarding module of gateway A sends a subscription request to the event soft bus broker of gateway B to subscribe to the / user / gatewayid / basedata topic message;

[0091] Step S423: The event soft bus broker of gateway B pushes the topic message / user / gatewayid / basedata to the message forwarding module of gateway A;

[0092] Step S424: The message forwarding module of Gateway A publishes a message on the topic / user / gatewayid / basedata to the event soft bus broker of Gateway A;

[0093] Step S425: The message forwarding module of gateway A sends a subscription request to the event soft bus broker of gateway B to subscribe to the / user / gatewayid / dm_data topic message;

[0094] Step S426: The event soft bus broker of gateway B pushes the topic message / user / gatewayid / dm_data to the message forwarding module of gateway A;

[0095] Step S427: The message forwarding module of Gateway A publishes a message on the topic / user / gatewayid / dm_data to the event soft bus broker of Gateway A;

[0096] Step S428: The message forwarding module of gateway A sends a subscription request to the event soft bus broker of gateway B to subscribe to the topic message / user / gatewayid / scene_data;

[0097] Step S429: The event soft bus broker of gateway B pushes the topic message / user / gatewayid / scene_data to the message forwarding module of gateway A;

[0098] Step S430: The message forwarding module of Gateway A publishes the topic message / user / gatewayid / scenedata to the event soft bus broker of Gateway A;

[0099] Step S431: The message forwarding module of gateway A sends a subscription request to the event soft bus broker of gateway B to subscribe to the / user / gatewayid / cpuload topic message;

[0100] Step S432: The event soft bus broker of gateway B pushes the topic message / user / gatewayid / cpuload to the message forwarding module of gateway A;

[0101] Step S433: The message forwarding module of gateway A publishes the topic message / user / gatewayid / cpuload to the event soft bus broker of gateway A;

[0102] Step S434: The domain model of Gateway A sends a subscription request to the event soft bus broker of Gateway A to subscribe to the / user / gatewayid / cpuload topic message;

[0103] Step S435: The event soft bus broker of gateway A pushes the topic message / user / gatewayid / cpuload to the domain model of gateway A;

[0104] Step S436: The scenario JSDK of Gateway A sends a subscription request to the event soft bus broker of Gateway A to subscribe to the / user / gatewayid / cpuload topic message;

[0105] Step S437: The event soft bus broker of gateway A pushes the topic message / user / gatewayid / cpuload to the scenario JSDK of gateway A.

[0106] Through the above steps, steps S401 to S421 describe the message interaction process within a single gateway, and steps S422 to S437 describe the message interaction process between different gateways, thus providing an implementation process for sending gateway messages.

[0107] In one embodiment, further combination Figure 5 The message exchange process between different gateways is explained. Figure 5 This is a flowchart (II) illustrating the gateway message sending method according to an embodiment of this application, as shown below. Figure 5 As shown, the specific steps are as follows:

[0108] Step S501: The scene JSDK of gateway A publishes the topic message / user / gatewayid / scene_data to the event soft bus broker of gateway A;

[0109] Step S502: Gateway message forwarder of gateway A sends a subscription request to the event soft bus broker of gateway B for subscribing to the topic message / user / gatewayid / scene_data;

[0110] Step S503: The scene JSDK of Gateway B sends a subscription request to the event soft bus broker of Gateway B to subscribe to the topic message of / user / gatewayid / scene_data;

[0111] Step S504: Gateway message forwarder of gateway A sends a subscription request to the event soft bus broker of gateway A to subscribe to the topic message / user / gatewayid / scene_data;

[0112] Step S505: The event soft bus broker of gateway A pushes the topic message device_jsdk_scene_notify to the gateway message forwarder of gateway A on the topic / user / gatewayid / scene_data;

[0113] Step S506: Gateway message forwarder of gateway A pushes the topic message device_jsdk_scene_notify of / user / gatewayid / scene_data to event soft bus broker of gateway B;

[0114] Step S507: The event soft bus broker of gateway B pushes the topic message device_jsdk_scene_notify to the scene JSDK of gateway B on the topic of / user / gatewayid / scene_data;

[0115] Step S508: The scene JSDK of Gateway B pushes the topic message / user / gatewayid / scene_data to the event soft bus broker of Gateway B;

[0116] Step S509: The domain model module of gateway A sends a subscription request to the event soft bus broker of gateway A to subscribe to the topic message / user / gatewayid / scene_data;

[0117] Step S510: The event soft bus broker of gateway B pushes the topic message / user / gatewayid / scene_data to the gateway message forwarder of gateway A;

[0118] Step S511: Gateway message forwarder of gateway A pushes the topic message / user / gatewayid / scene_data to event soft bus broker of gateway A;

[0119] Step S512: The event soft bus broker of gateway A pushes the topic message device_jsdk_scene_resp to the scene JSDK of gateway A, which is / user / gatewayid / scene_data.

[0120] Step S513: The scene JSDK of gateway A pushes the topic message / user / gatewayid / scene_data to the event soft bus broker of gateway A;

[0121] Step S514: The event soft bus broker of gateway A pushes the topic message / user / gatewayid / scene_data to the domain model module of gateway A.

[0122] In the above embodiments, taking gateway A and gateway B as examples, the interaction process of gateway messages among multiple gateways is described. By adding an event bus broker inside each gateway, any component can directly interact with other components based on the event bus broker, thereby decoupling the business processing and message transmission processes of different components and solving the problem of long message transmission time caused by other components processing business.

[0123] Optionally, any message forwarding module (i.e., gateway message forwarder) included in any gateway can establish a connection with the event soft bus broker based on the MQTT client and send subscription requests to all gateways connected to the MQTT device server within the local area network. For example, the message forwarding module of gateway A can send subscription requests to the event soft bus broker of gateway B for subscribing to messages on different topics, and vice versa.

[0124] Alternatively, when a change is detected in the gateway list within the local area network (including changes in gateway IPs and the number of gateways), a ` / user / gatewayid / gatewayinfo` topic message is sent to the event soft bus broker. The message forwarding module can then send a subscription request to the event soft bus broker to subscribe to the ` / user / gatewayid / gatewayinfo` topic message, thereby subscribing to the gateway IPs in the device list. The ` / user / gatewayid / gatewayinfo` topic message contains device ID information within the local area network, represented in JSON format as follows:

[0125] {"device_gateway_info": {"gatewayidMsgList": [{"deviceId": "F0B0402CB1E", "ip": "192.168.1.xxx"]}}.

[0126] Optionally, the gateway message filter can filter out irrelevant gateway messages and forward gateway messages that meet the expected conditions to the event soft bus broker. For example, each JSON-formatted gateway message corresponds to a pre-agreed message name. The message filtering process can be implemented by matching message names with key-value pairs, which can be better adapted to gateways with lower configuration performance.

[0127] Based on the above embodiments, the problem of gateways being unable to perform scene linkage due to data loss caused by power outages or other reasons can be solved. Furthermore, the publish-subscribe process between the event bus broker and other modules, implemented using an event bus mechanism, can completely decouple messages and business logic, reducing the probability of message blocking and thus reducing the time consumption caused by multi-layered message interactions between modules. Additionally, it can monitor the CPU load of each gateway and distribute business processing to the gateway server on the other end.

[0128] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0129] Figure 6 This is a structural block diagram of a gateway message sending device according to an embodiment of this application; as shown... Figure 6 As shown, it includes:

[0130] The receiving module 62 is used to receive a first acquisition request sent by the second message forwarding component of the second service gateway through the first event bus interaction component of the first service gateway;

[0131] The determining module 64 is used to determine the gateway message corresponding to the target message type indicated by the first acquisition request;

[0132] The forwarding module 66 is used to send the gateway message corresponding to the target message type to the second message forwarding component, so as to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway.

[0133] The above-described device receives a first acquisition request from a second message forwarding component of a second service gateway via a first event bus interaction component of a first service gateway; determines a gateway message corresponding to the target message type indicated by the first acquisition request; and sends the gateway message corresponding to the target message type to the second message forwarding component, thereby instructing the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway. This solves the technical problem of how to improve the sending efficiency of gateway messages in related technologies, and thus improves the sending efficiency of gateway messages.

[0134] In an exemplary embodiment, the determining module 64 includes a determining unit for performing the following steps: step S11, determining other components in the first service gateway besides the first event bus interaction component; step S12, receiving gateway messages of different message types sent by the other components through the first event bus interaction component; step S13, determining the gateway message corresponding to the target message type indicated by the first acquisition request from the gateway messages of different message types.

[0135] In an exemplary embodiment, the forwarding module 66 further includes a first sending unit, configured to perform the following steps: step S21, determining from the other components a first user-side service module connected to the first event bus interaction component; step S22, if it is determined that the gateway message corresponding to the target message type represents a first gateway message corresponding to the device state, obtaining the first gateway message from the first user-side service module; step S23, sending the first gateway message to the second message forwarding component.

[0136] In an exemplary embodiment, the forwarding module 66 further includes a second sending unit, configured to perform the following steps: step S31, determining from the other components a first domain model component connected to the first event bus interaction component; step S32, if the gateway message corresponding to the target message type represents a second gateway message corresponding to the domain state, obtaining the second gateway message from the first domain model component; step S33, sending the second gateway message to the second message forwarding component; wherein the second gateway message corresponding to the domain state is generated by the first domain model component through the first gateway message corresponding to the device state obtained from the first event bus interaction component.

[0137] In an exemplary embodiment, the forwarding module 66 further includes a third sending unit, configured to perform the following steps: step S41, determining from the other components a first scene software development kit component connected to the first event bus interaction component; step S42, if it is determined that the gateway message corresponding to the target message type represents a third gateway message corresponding to the scene state, obtaining the third gateway message from the first scene software development kit component; step S43, sending the third gateway message to the second message forwarding component.

[0138] In an exemplary embodiment, the forwarding module 66 further includes a fourth sending unit, configured to perform the following steps: step S51, determining from the other components a first memory load calculation component connected to the first event bus interaction component; step S52, if it is determined that the gateway message corresponding to the target message type represents a fourth gateway message corresponding to the memory state, obtaining the fourth gateway message from the first memory load calculation component, wherein the first memory load calculation component is configured to determine the fourth gateway message based on the monitored gateway memory; step S53, sending the fourth gateway message to the second message forwarding component.

[0139] In an exemplary embodiment, the forwarding module 66 further includes a fifth sending unit, configured to perform the following steps: step S61, determining from the other components a first scenario software development kit component connected to the first event bus interaction component; step S62, if it is determined that the gateway message corresponding to the target message type represents a fifth gateway message corresponding to the script state, obtaining the fifth gateway message from the first scenario software development kit component; step S63, sending the fifth gateway message to the second message forwarding component.

[0140] In an exemplary embodiment, the gateway message sending device further includes a first sending module, configured to: determine from the other components a first domain model component connected to the first event bus interaction component and a first scene software development kit component connected to the first event bus interaction component; receive a second gateway message corresponding to a domain state sent by the first domain model component; and, in response to a second acquisition request sent by the first scene software development kit component, send the second gateway message indicated by the second acquisition request to the first scene software development kit component.

[0141] In an exemplary embodiment, the gateway message sending device further includes a second sending module, configured to: determine from the other components a first domain model component connected to the first event bus interaction component, and a first memory load calculation component connected to the first event bus interaction component; receive a fourth gateway message corresponding to a memory state sent by the first memory load calculation component; and, in response to a third acquisition request sent by the first domain model component, send the fourth gateway message indicated by the third acquisition request to the first domain model component.

[0142] In an exemplary embodiment, the gateway message sending device further includes a third sending module, configured to: determine from the other components a first master-slave database backup component connected to the first event bus interaction component, and a first scenario software development kit component connected to the first event bus interaction component; receive a fifth gateway message corresponding to a script state sent by the first scenario software development kit component; and, in response to a fourth acquisition request sent by the first master-slave database backup component, send the fifth gateway message indicated by the fourth acquisition request to the first master-slave database backup component.

[0143] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.

[0144] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:

[0145] S1, receive a first acquisition request sent by the second message forwarding component of the second service gateway through the first event bus interaction component of the first service gateway;

[0146] S2, determine the gateway message corresponding to the target message type indicated by the first acquisition request;

[0147] S3, send the gateway message corresponding to the target message type to the second message forwarding component, so as to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway.

[0148] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0149] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0150] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0151] S1, receive a first acquisition request sent by the second message forwarding component of the second service gateway through the first event bus interaction component of the first service gateway;

[0152] S2, determine the gateway message corresponding to the target message type indicated by the first acquisition request;

[0153] S3, send the gateway message corresponding to the target message type to the second message forwarding component, so as to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway.

[0154] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0155] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0156] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0157] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for sending gateway messages, characterized in that, include: The first event bus interaction component of the first service gateway receives the first acquisition request sent by the second message forwarding component of the second service gateway. Determine the gateway message corresponding to the target message type indicated by the first acquisition request; Send the gateway message corresponding to the target message type to the second message forwarding component to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway; Determining the gateway message corresponding to the target message type indicated by the first acquisition request includes: identifying other components in the first service gateway besides the first event bus interaction component; receiving gateway messages of different message types sent by the other components through the first event bus interaction component; and determining the gateway message corresponding to the target message type indicated by the first acquisition request from the gateway messages of different message types. The method further includes: determining from the other components a first master-slave database backup component connected to the first event bus interaction component, and a first scenario software development kit component connected to the first event bus interaction component; receiving a fifth gateway message corresponding to a script state sent by the first scenario software development kit component; and responding to a fourth acquisition request sent by the first master-slave database backup component, sending the fifth gateway message indicated by the fourth acquisition request to the first master-slave database backup component.

2. The method for sending gateway messages according to claim 1, characterized in that, Sending the gateway message corresponding to the target message type to the second message forwarding component includes: Identify the first user-side service module that is connected to the first event bus interaction component from the other components; If it is determined that the gateway message corresponding to the target message type is a first gateway message corresponding to the device state, the first gateway message is obtained from the first user-side service module; The first gateway message is sent to the second message forwarding component.

3. The method for sending gateway messages according to claim 1, characterized in that, Sending the gateway message corresponding to the target message type to the second message forwarding component includes: Identify the first domain model component that is connected to the first event bus interaction component from the other components; When the gateway message corresponding to the target message type represents a second gateway message corresponding to the domain state, the second gateway message is obtained from the first domain model component; Send the second gateway message to the second message forwarding component; The second gateway message corresponding to the domain state is generated by the first domain model component through the first gateway message corresponding to the device state obtained from the first event bus interaction component.

4. The method for sending gateway messages according to claim 1, characterized in that, Sending the gateway message corresponding to the target message type to the second message forwarding component includes: Identify the first scenario software development kit component that is connected to the first event bus interaction component from the other components; If it is determined that the gateway message corresponding to the target message type represents a third gateway message corresponding to the scene state, the third gateway message is obtained from the first scene software development kit component; The third gateway message is sent to the second message forwarding component.

5. The method for sending gateway messages according to claim 1, characterized in that, Sending the gateway message corresponding to the target message type to the second message forwarding component includes: Identify, from the other components, a first memory load computing component that is connected to the first event bus interaction component; When it is determined that the gateway message corresponding to the target message type represents the fourth gateway message corresponding to the memory state, the fourth gateway message is obtained from the first memory load calculation component, wherein the first memory load calculation component is used to determine the fourth gateway message based on the monitored gateway memory. The fourth gateway message is sent to the second message forwarding component.

6. The method for sending gateway messages according to claim 1, characterized in that, Sending the gateway message corresponding to the target message type to the second message forwarding component includes: Identify the first scenario software development kit component that is connected to the first event bus interaction component from the other components; If it is determined that the gateway message corresponding to the target message type is the fifth gateway message corresponding to the script state, the fifth gateway message is obtained from the first scenario software development kit component; The fifth gateway message is sent to the second message forwarding component.

7. The method for sending gateway messages according to claim 1, characterized in that, The method further includes: From the other components, a first domain model component connected to the first event bus interaction component and a first scene software development kit component connected to the first event bus interaction component are identified. Receive the second gateway message corresponding to the domain state sent by the first domain model component; In response to the second acquisition request sent by the first scenario software development kit component, the second gateway message indicated by the second acquisition request is sent to the first scenario software development kit component.

8. The method for sending gateway messages according to claim 1, characterized in that, The method further includes: From the other components, a first domain model component connected to the first event bus interaction component and a first memory load calculation component connected to the first event bus interaction component are determined. Receives a fourth gateway message corresponding to the memory state sent by the first memory load calculation component; In response to a third acquisition request sent by the first domain model component, the fourth gateway message indicated by the third acquisition request is sent to the first domain model component.

9. A gateway message sending device, characterized in that, include: The receiving module is used to receive a first acquisition request sent by the second message forwarding component of the second service gateway through the first event bus interaction component of the first service gateway; The determining module is used to determine the gateway message corresponding to the target message type indicated by the first acquisition request; The forwarding module is used to send the gateway message corresponding to the target message type to the second message forwarding component, so as to instruct the second message forwarding component to forward the gateway message corresponding to the target message type to the second event bus interaction component of the second service gateway; The determining module is further configured to determine other components in the first service gateway besides the first event bus interaction component; receive gateway messages of different message types sent by the other components through the first event bus interaction component; and determine the gateway message corresponding to the target message type indicated by the first acquisition request from the gateway messages of different message types. The device is further configured to identify from the other components a first master-slave database backup component connected to the first event bus interaction component, and a first scenario software development kit component connected to the first event bus interaction component; and to receive a fifth gateway message corresponding to the script state sent by the first scenario software development kit component; In response to the fourth acquisition request sent by the first master-slave database backup component, the fifth gateway message indicated by the fourth acquisition request is sent to the first master-slave database backup component.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 8.

11. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 8 through the computer program.