CN116545798A - Data interaction method and terminal of distributed gateway - Google Patents
Data interaction method and terminal of distributed gateway Download PDFInfo
- Publication number
- CN116545798A CN116545798A CN202310527084.3A CN202310527084A CN116545798A CN 116545798 A CN116545798 A CN 116545798A CN 202310527084 A CN202310527084 A CN 202310527084A CN 116545798 A CN116545798 A CN 116545798A
- Authority
- CN
- China
- Prior art keywords
- gateway
- data interaction
- message bus
- slave
- accessing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 209
- 230000003993 interaction Effects 0.000 title claims abstract description 52
- 238000004891 communication Methods 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 8
- 238000012544 monitoring process Methods 0.000 claims description 8
- 238000003032 molecular docking Methods 0.000 description 6
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000010276 construction Methods 0.000 description 2
- 238000005538 encapsulation Methods 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/403—Bus networks with centralised control, e.g. polling
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/2803—Home automation networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/66—Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Automation & Control Theory (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a data interaction method and a terminal of a distributed gateway, which divide a main gateway into a plurality of process components according to business logic, and access each process component to a message bus, and then access the process components of a slave gateway to the message bus to realize the data interaction of different processes in each gateway. In this way, by disassembling the gateway and accessing all disassembled components to the same message bus, the diversity of equipment access can be improved, and scene linkage and automation control can be realized through cross-gateway data interaction.
Description
Technical Field
The present invention relates to the field of distributed gateways, and in particular, to a data interaction method and a terminal for a distributed gateway.
Background
At present, intelligent home gateways are all in a single-user single-gateway working mode, but along with diversification of application scenes, a single gateway cannot meet actual requirements, a plurality of gateways are required to work cooperatively, the problem of interconnection and intercommunication of multiple gateways is faced, and how to realize scene linkage and automatic control of sub-equipment under the multiple gateways is a problem which needs to be solved at present.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: the data interaction method and the terminal of the distributed gateway are provided, and scene linkage and automatic control can be realized across the gateways under the condition of multiple gateways.
In order to solve the technical problems, the invention adopts the following technical scheme:
a data interaction method of a distributed gateway comprises the following steps:
splitting a main gateway into a plurality of process components according to business logic of the gateway;
building a message bus, and connecting a plurality of process components in the main gateway to the message bus;
and accessing a process component of the slave gateway into the message bus, and carrying out data interaction in the slave gateway.
In order to solve the technical problems, the invention adopts another technical scheme that:
a data interaction terminal of a distributed gateway, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
splitting a main gateway into a plurality of process components according to business logic of the gateway;
building a message bus, and connecting a plurality of process components in the main gateway to the message bus;
and accessing a process component of the slave gateway into the message bus, and carrying out data interaction in the slave gateway.
The invention has the beneficial effects that: splitting a main gateway into a plurality of process components according to service logic, accessing each process component to a message bus, and then accessing the process components of a slave gateway to the message bus to realize data interaction of different processes in each gateway. In this way, by disassembling the gateway and accessing all disassembled components to the same message bus, the diversity of equipment access can be improved, and scene linkage and automation control can be realized through cross-gateway data interaction.
Drawings
Fig. 1 is a flowchart of a data interaction method of a distributed gateway according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a data interaction terminal of a distributed gateway according to an embodiment of the present invention;
FIG. 3 is a diagram of a single gateway architecture according to an embodiment of the present invention;
fig. 4 is a distributed gateway architecture diagram according to an embodiment of the present invention.
Description of the reference numerals:
1. a data interaction terminal of a distributed gateway; 2. a memory; 3. a processor.
Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
Referring to fig. 1, an embodiment of the present invention provides a data interaction method for a distributed gateway, including the steps of:
splitting a main gateway into a plurality of process components according to business logic of the gateway;
building a message bus, and connecting a plurality of process components in the main gateway to the message bus;
and accessing a process component of the slave gateway into the message bus, and carrying out data interaction in the slave gateway.
From the above description, the beneficial effects of the invention are as follows: splitting a main gateway into a plurality of process components according to service logic, accessing each process component to a message bus, and then accessing the process components of a slave gateway to the message bus to realize data interaction of different processes in each gateway. In this way, by disassembling the gateway and accessing all disassembled components to the same message bus, the diversity of equipment access can be improved, and scene linkage and automation control can be realized through cross-gateway data interaction.
Further, splitting the primary gateway into a plurality of process components according to the business logic of the gateway includes:
and splitting the main gateway into a plurality of process components in a daemon process, a gateway process, a device process, a network process or an Internet of things process according to the business logic of the gateway.
As can be seen from the above description, after the primary gateway is split, the internet of things process has a standard interface for external encapsulation, and can be used for docking different internet of things platforms, so that docking of different ecological platforms can be quickly adapted; the equipment process encapsulates the access standard of the sub-equipment externally, and can support the access of equipment with different communication media; meanwhile, only the main gateway sets a gateway process and is responsible for main business logic processing of the gateway.
Further, accessing the message bus with the plurality of process components in the primary gateway includes:
and carrying out data interaction on a plurality of process components in the main gateway based on Socket communication through the message bus.
From the above description, each process performs data interaction based on Socket communication, so as to ensure real-time data interaction of each process of the gateway.
Further, the accessing the message bus from the process component of the gateway includes:
the process component of the slave gateway comprises a daemon process, a device process and a network process, and the daemon process of the slave gateway is in communication connection with the network process and the device process;
and directly accessing the equipment process and the network process of the slave gateway into the message bus.
From the above description, the daemon process, the device process and the network process are basic processes of the gateway, and the daemon process is used for monitoring whether other processes operate normally.
Further, the method further comprises the following steps:
and monitoring the running condition of the master gateway, and if the master gateway has faults, selecting a new master gateway according to the configuration information of the slave gateway.
From the above description, after the original primary gateway fails, a new primary gateway is timely selected, so as to avoid the situation that the distributed gateway cannot be used due to the failure of the primary gateway.
Referring to fig. 2, another embodiment of the present invention provides a data interaction terminal of a distributed gateway, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
splitting a main gateway into a plurality of process components according to business logic of the gateway;
building a message bus, and connecting a plurality of process components in the main gateway to the message bus;
and accessing a process component of the slave gateway into the message bus, and carrying out data interaction in the slave gateway.
From the above description, the beneficial effects of the invention are as follows: splitting a main gateway into a plurality of process components according to service logic, accessing each process component to a message bus, and then accessing the process components of a slave gateway to the message bus to realize data interaction of different processes in each gateway. In this way, by disassembling the gateway and accessing all disassembled components to the same message bus, the diversity of equipment access can be improved, and scene linkage and automation control can be realized through cross-gateway data interaction.
Further, splitting the primary gateway into a plurality of process components according to the business logic of the gateway includes:
and splitting the main gateway into a plurality of process components in a daemon process, a gateway process, a device process, a network process or an Internet of things process according to the business logic of the gateway.
As can be seen from the above description, after the primary gateway is split, the internet of things process has a standard interface for external encapsulation, and can be used for docking different internet of things platforms, so that docking of different ecological platforms can be quickly adapted; the equipment process encapsulates the access standard of the sub-equipment externally, and can support the access of equipment with different communication media; meanwhile, only the main gateway sets a gateway process and is responsible for main business logic processing of the gateway.
Further, accessing the message bus with the plurality of process components in the primary gateway includes:
and carrying out data interaction on a plurality of process components in the main gateway based on Socket communication through the message bus.
From the above description, each process performs data interaction based on Socket communication, so as to ensure real-time data interaction of each process of the gateway.
Further, the accessing the message bus from the process component of the gateway includes:
the process component of the slave gateway comprises a daemon process, a device process and a network process, and the daemon process of the slave gateway is in communication connection with the network process and the device process;
and directly accessing the equipment process and the network process of the slave gateway into the message bus.
From the above description, the daemon process, the device process and the network process are basic processes of the gateway, and the daemon process is used for monitoring whether other processes operate normally.
Further, the method further comprises the following steps:
and monitoring the running condition of the master gateway, and if the master gateway has faults, selecting a new master gateway according to the configuration information of the slave gateway.
From the above description, after the original primary gateway fails, a new primary gateway is timely selected, so as to avoid the situation that the distributed gateway cannot be used due to the failure of the primary gateway.
The data interaction method and the terminal of the distributed gateway are suitable for realizing scene linkage and automatic control across the gateways under the multi-gateway, and are described by specific embodiments below:
example 1
Referring to fig. 1, a data interaction method of a distributed gateway includes the steps of:
s1, splitting a main gateway into a plurality of process components according to business logic of the gateway.
Specifically, the main gateway is split into a daemon process, a gateway process, a device process, a network process or a plurality of process components in the internet of things process according to the business logic of the gateway.
In this embodiment, the gateway needs to have three basic processes, namely a daemon process, a network process and an equipment process, and each process is disassembled according to service logic and performs message interaction through standard Socket communication;
the equipment process is responsible for accessing the sub-equipment, and the sub-equipment access standard of external packaging standard can support the access of equipment with different communication media, such as zigbee, ble and the like;
the internet of things process is used for docking with platform services, and interfaces of external packaging standards can dock different internet of things platforms, so that docking of different ecological platforms can be quickly adapted;
the gateway process is used for main business logic processing of the gateway, and the gateway running the gateway process is the main gateway.
Thus, in this embodiment, the primary gateway may be split into a daemon process, a gateway process, a device process, and a network process, and in other embodiments, the primary gateway may be split into a daemon process, a gateway process, a device process, a network process, and an internet of things process.
S2, building a message bus, and accessing a plurality of process components in the main gateway into the message bus.
In this embodiment, a message bus based on Socket communication is set up, a soft bus with hardware platform independence is realized, and a plurality of process components in a main gateway perform data interaction based on Socket communication through the message bus.
Referring to fig. 3, a daemon process, an internet of things process, a gateway process and a device process are all connected to a message bus, so as to complete the construction of a single gateway architecture.
Meanwhile, the premise of interconnection of all process components is that: a unified product model is used for establishing a standard product database; a unified network communication Socket interface provides a standard subscription/notification mechanism; standard service interfaces and callback interfaces are provided between the components.
S3, accessing the process component of the slave gateway into the message bus, and carrying out data interaction in the slave gateway.
The process components of the slave gateway comprise a daemon process, a device process and a network process, wherein the daemon process of the slave gateway is in communication connection with the network process and the device process, and the device process and the network process of the slave gateway are directly accessed to a message bus.
Referring to fig. 4, the slave gateway is not provided with a gateway process and is accessed as a separate device process. Within a local area network, each device process represents access to a subsystem of devices. Therefore, as long as the construction of the architecture of the single gateway is completed, namely the normal operation environment of the master gateway, other slave gateways can be accessed through the message bus.
In addition, in this embodiment, the master gateway and the slave gateway belong to the same network, and when the local area network configures the network topology, the master gateway can be manually allocated, or one gateway can be determined to be the master gateway in an election mode, and the other gateways are slave gateways.
Specifically, determining the primary gateway by adopting an election mode specifically includes: and monitoring the running condition of the master gateway, and if the master gateway has faults, selecting a new master gateway according to the configuration information of the slave gateway. In this embodiment, a method of a type distributed microservice architecture is adopted, and an election strategy, such as a Raft algorithm, is adopted in the same local area network, so that only one gateway is ensured to be a master gateway at the same time, and distributed synchronous storage of data is realized. The newly elected master gateway can set its gateway process through hardware configuration.
Example two
Referring to fig. 2, a data interaction terminal 1 of a distributed gateway includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3, wherein the processor 3 implements the steps of the data interaction method of the distributed gateway according to the first embodiment when executing the computer program.
In summary, according to the data interaction method and terminal for the distributed gateway provided by the invention, the main gateway is split into the daemon process, the internet of things process, the gateway process, the equipment process and the network process according to the service logic, each process component is accessed to the message bus, then the network process and the equipment process of the slave gateway are also accessed to the message bus, and the data interaction of different processes in each gateway is realized through the network process and the equipment process accessed by each gateway. In this way, by disassembling the gateway and accessing all disassembled components to the same message bus, the diversity of equipment access can be improved, and scene linkage and automation control can be realized through cross-gateway data interaction. And meanwhile, a new main gateway is elected when the main gateway fails in a monitoring and electing mode, so that the reliability of the distributed gateway is ensured.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.
Claims (10)
1. The data interaction method of the distributed gateway is characterized by comprising the following steps:
splitting a main gateway into a plurality of process components according to business logic of the gateway;
building a message bus, and connecting a plurality of process components in the main gateway to the message bus;
and accessing a process component of the slave gateway into the message bus, and carrying out data interaction in the slave gateway.
2. The method for data interaction of a distributed gateway according to claim 1, wherein splitting the primary gateway into a plurality of process components according to service logic of the gateway comprises:
and splitting the main gateway into a plurality of process components in a daemon process, a gateway process, a device process, a network process or an Internet of things process according to the business logic of the gateway.
3. The method of claim 2, wherein accessing the message bus with the plurality of process components in the primary gateway comprises:
and carrying out data interaction on a plurality of process components in the main gateway based on Socket communication through the message bus.
4. The method of claim 1, wherein accessing the message bus from the process component of the gateway comprises:
the process component of the slave gateway comprises a daemon process, a device process and a network process, and the daemon process of the slave gateway is in communication connection with the network process and the device process;
and directly accessing the equipment process and the network process of the slave gateway into the message bus.
5. The method for data interaction in a distributed gateway of claim 1, further comprising:
and monitoring the running condition of the master gateway, and if the master gateway has faults, selecting a new master gateway according to the configuration information of the slave gateway.
6. A data interaction terminal of a distributed gateway, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor when executing the computer program implements the steps of:
splitting a main gateway into a plurality of process components according to business logic of the gateway;
building a message bus, and connecting a plurality of process components in the main gateway to the message bus;
and accessing a process component of the slave gateway into the message bus, and carrying out data interaction in the slave gateway.
7. The data interaction terminal of claim 6, wherein the splitting the primary gateway into a plurality of process components according to the business logic of the gateway comprises:
and splitting the main gateway into a plurality of process components in a daemon process, a gateway process, a device process, a network process or an Internet of things process according to the business logic of the gateway.
8. The data interaction terminal of claim 7, wherein accessing the message bus with the plurality of process components in the primary gateway comprises:
and carrying out data interaction on a plurality of process components in the main gateway based on Socket communication through the message bus.
9. The data interaction terminal of claim 6, wherein said accessing said message bus from a process component of the gateway comprises:
the process component of the slave gateway comprises a daemon process, a device process and a network process, and the daemon process of the slave gateway is in communication connection with the network process and the device process;
and directly accessing the equipment process and the network process of the slave gateway into the message bus.
10. The data interaction terminal of a distributed gateway of claim 6, further comprising:
and monitoring the running condition of the master gateway, and if the master gateway has faults, selecting a new master gateway according to the configuration information of the slave gateway.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310527084.3A CN116545798A (en) | 2023-05-11 | 2023-05-11 | Data interaction method and terminal of distributed gateway |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310527084.3A CN116545798A (en) | 2023-05-11 | 2023-05-11 | Data interaction method and terminal of distributed gateway |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116545798A true CN116545798A (en) | 2023-08-04 |
Family
ID=87453913
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310527084.3A Pending CN116545798A (en) | 2023-05-11 | 2023-05-11 | Data interaction method and terminal of distributed gateway |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116545798A (en) |
-
2023
- 2023-05-11 CN CN202310527084.3A patent/CN116545798A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108847979B (en) | Self-adaptive configuration system and method based on SCADA | |
EP2888858B1 (en) | Method and apparatus of generalized network controller for a software defined network (sdn) | |
CN112738060B (en) | Method and device for processing micro-service data, micro-service processing platform and medium | |
Thramboulidis | Development of distributed industrial control applications: The CORFU framework | |
US12013769B2 (en) | Hot-standby redundancy control system, method, control apparatus, and computer readable storage medium | |
WO2011150715A1 (en) | Method and device for collecting data of third-party equipment in distributed control system | |
CN210573263U (en) | Building system | |
CN103095565A (en) | Software definition network operating system and implement method thereof | |
CN110008005B (en) | Cloud platform-based power grid communication resource virtual machine migration system and method | |
CN103001843B (en) | Based on the OPC protocol converter of embedded VxWorks | |
CN101465773B (en) | Method and system for implementing interconnection between different isomery household network standards | |
EP3866393A1 (en) | Data center traffic exchange method and apparatus, device and storage medium | |
US11500690B2 (en) | Dynamic load balancing in network centric process control systems | |
CN114285695B (en) | Communication method, device, apparatus, system and storage medium | |
CN114584429A (en) | Industrial intelligent internet of things gateway | |
CN102402218B (en) | Intelligent industrial network monitoring system | |
CN104243172B (en) | The extension input/output unit and method of a kind of scattered control system | |
CN110658777A (en) | HMI-based method for realizing communication, interaction and alarm management between control terminals | |
Hung et al. | Development of an Ethernet-based equipment integration framework for factory automation | |
CN116545798A (en) | Data interaction method and terminal of distributed gateway | |
CN110247809B (en) | Communication control method of double-ring network control system | |
CN113342456A (en) | Connection method, device, equipment and storage medium | |
CN112953739A (en) | K8S platform-based method, system and storage medium for nanotube SDN | |
CN115426274A (en) | Resource early warning method and device, electronic equipment and storage medium | |
CN106304241A (en) | A kind of data transmission method, transponder and gateway |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |