A routing and forwarding method, device, storage medium and routing and forwarding gateway
By introducing a routing forwarding gateway into the video surveillance system, recording the correspondence between device identification and service address, and realizing homologous routing forwarding, the problems of data interaction consistency and continuity are solved, and the stability of video surveillance services and data accuracy are improved.
Patent Information
- Application Number
- CN202411476838.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-10-22
AI Technical Summary
In the existing technology, the data interaction consistency and continuity between video surveillance devices and service instances are low, and the load balancer may cause inconsistent request distribution, affecting data accuracy and the normal operation of video surveillance services.
A routing forwarding gateway is introduced as the middle layer to record the forwarding correspondence between the device identification of the video surveillance device and the service address, determine the target service through load balancing rules, and perform homologous routing forwarding of data interaction requests based on the recorded relationship.
It improves the consistency and continuity of data interaction between video surveillance devices and services, ensures that requests from the same device are forwarded to the same service instance for processing, and improves data accuracy and the stability of video surveillance services.
Smart Images

Figure CN119363838B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video surveillance technology, and in particular to a routing and forwarding method, device, storage medium, and routing and forwarding gateway. Background Art
[0002] In the video surveillance field, video surveillance devices need to exchange data with video surveillance services to implement functions such as device registration, control, alarms, and video streaming. To enable communication with the corresponding video surveillance service, the video surveillance device is configured with a service address and multiple ports (such as HTTP ports and RTSP ports). Furthermore, within the front-end proxy service, each video surveillance device is manually bound to a video surveillance service instance. This allows requests from the same video surveillance device sent through different ports to be uniformly forwarded to the same video surveillance service instance, ensuring that once the video surveillance device is registered with the video surveillance service, the same video surveillance service instance can communicate with the device.
[0003] However, as more and more video surveillance devices come into use, the load capacity of a single video surveillance service instance may reach its upper limit, necessitating the deployment of more video surveillance service instances to share the load. In this case, a set of service addresses and ports can be set for each video surveillance service instance, and the specific service addresses and ports can be configured on each video surveillance device. However, this approach complicates the management of service instances, service addresses, and ports, and is prone to errors. In particular, the need to manually configure specific service addresses and ports for each video surveillance device exposes the user to single-point server failures and network security risks.
[0004] To address this situation, existing technologies typically use load balancing to meet the capacity expansion requirements of large-scale video surveillance systems. However, load balancers typically randomly distribute requests from video surveillance devices to video surveillance service instances. If a video surveillance device is successfully registered and connected, the load balancer may forward requests from the same device to different video surveillance service instances for processing. This affects the consistency and continuity of data exchange, which can reduce data accuracy and disrupt the normal operation of the video surveillance service. Summary of the Invention
[0005] The purpose of this application is to solve at least one of the above-mentioned technical deficiencies, especially the technical deficiencies of low consistency and continuity of data interaction in the prior art.
[0006] In a first aspect, the present application provides a routing forwarding method, applied to a routing forwarding gateway, the method comprising:
[0007] In response to the received device registration request, determine a first target service in at least one registered service, and forward the device registration request to the first target service; wherein the registered service is a video surveillance service registered with the routing forwarding gateway;
[0008] If a first registration success message returned by the first target service in response to the device registration request is received, recording a forwarding correspondence between a service address corresponding to the first target service and a device identifier of a registered monitoring device; wherein the registered monitoring device is a video monitoring device that sent the device registration request;
[0009] In response to the received data interaction request, query each of the forwarding correspondences according to the interaction device identifier and obtain an address query result; wherein the interaction device identifier is the device identifier of the interaction monitoring device, and the interaction monitoring device is the video monitoring device that sends the data interaction request;
[0010] If the address query result is a service address, the data interaction request is forwarded to a second target service; wherein the second target service is a registered service corresponding to the address query result.
[0011] In one embodiment, the routing forwarding gateway records the number of device registrations corresponding to the registered service;
[0012] The determining a first target service from at least one registered service includes:
[0013] The first target service is determined in each of the registered services according to the number of device registrations corresponding to each of the registered services and a preset load balancing rule.
[0014] In one embodiment, the method further comprises:
[0015] If a first registration success message is received from the first target service in response to the device registration request, the first registration success message is returned to the registration monitoring device to instruct the registration monitoring device to periodically send a device keepalive request to the routing forwarding gateway;
[0016] Determining whether the registered monitoring device is offline according to the reception of the device keep-alive request;
[0017] If the registered monitoring device is offline, the forwarding correspondence corresponding to the registered monitoring device is deleted, and the number of device registrations corresponding to the first target service is updated.
[0018] In one embodiment, the method further comprises:
[0019] If the address query result shows that the routing forwarding gateway does not record the forwarding correspondence corresponding to the interaction device identifier, a request failure message is returned to the interaction monitoring device;
[0020] The request failure message is used to instruct the interactive monitoring device to re-initiate a device registration request to the routing forwarding gateway.
[0021] In one embodiment, the step of registering the registered service in the routing forwarding gateway includes:
[0022] In response to the received service registration request, perform a registration verification on the target registered service, and if the registration verification passes, record the service address corresponding to the target registered service, and send a second registration success message to the target registered service;
[0023] The target registered service is the video surveillance service that sends the service registration request; and the second registration success message is used to instruct the target registered service to periodically send a service keep-alive request to the routing forwarding gateway.
[0024] In one embodiment, the method further comprises:
[0025] Determining whether the target registered service is faulty based on a receipt of the service keep-alive request;
[0026] If the target registered service fails, the forwarding correspondence corresponding to the target registered service and the registration information of the target registered service in the routing forwarding gateway are deleted.
[0027] In a second aspect, an embodiment of the present application provides a routing forwarding device, which is applied to a routing forwarding gateway, and the device includes:
[0028] a device registration request forwarding module, configured to, in response to a received device registration request, determine a first target service from at least one registered service and forward the device registration request to the first target service; wherein the registered service is a video surveillance service registered with the routing forwarding gateway;
[0029] a correspondence recording module configured to, upon receiving a first registration success message returned by the first target service in response to the device registration request, record a forwarding correspondence between a service address corresponding to the first target service and a device identifier of a registered monitoring device; wherein the registered monitoring device is the video monitoring device that sent the device registration request;
[0030] The address query module is configured to query each of the forwarding correspondence relationship according to the interaction device identifier in response to the received data interaction request, and obtain an address query result; wherein the interaction device identifier is a device identifier of an interaction monitoring device, and the interaction monitoring device is a video monitoring device that sends the data interaction request.
[0031] The data interaction request forwarding module is configured to forward the data interaction request to a second target service if the address query result is a service address; wherein the second target service is a registered service corresponding to the address query result.
[0032] In a third aspect, an embodiment of the present application provides a storage medium, the storage medium storing computer readable instructions, the computer readable instructions being executed by one or more processors to cause the one or more processors to perform the steps of the routing forwarding method according to any of the above embodiments.
[0033] In a fourth aspect, an embodiment of the present application provides a routing forwarding gateway, the routing forwarding gateway comprising: one or more processors, and a memory.
[0034] The memory stores computer readable instructions, the computer readable instructions being executed by the one or more processors to perform the steps of the routing forwarding method according to any of the above embodiments.
[0035] In a fifth aspect, an embodiment of the present application provides a video monitoring system, comprising:
[0036] The routing forwarding gateway according to any of the above embodiments;
[0037] A video monitoring device configured with gateway address and port information corresponding to the routing forwarding gateway, and communicatively connected to the routing forwarding gateway.
[0038] A video monitoring server communicatively connected to the routing forwarding gateway, and configured to provide a video monitoring service.
[0039] In the routing forwarding method and related devices provided by the present application, the routing forwarding gateway can receive a device registration request sent by a video monitoring device, and forward the request to a corresponding video monitoring service, so that the video monitoring device can register at the corresponding video monitoring service. In the case of successful registration, the routing forwarding gateway can generate and record the forwarding correspondence relationship between the device identifier of the video monitoring device and the corresponding service address, and accordingly forward the data interaction request.
[0040] In this way, by introducing a routing forwarding gateway as an intermediate layer, efficient and stable communication between video surveillance equipment and video surveillance services can be achieved, and thus, the communication interaction mode between the video surveillance equipment and the video surveillance service can be maintained without changing the communication interaction mode between the video surveillance equipment and the video surveillance service, while maintaining compatibility with existing communication protocols. On this basis, this application can implement homologous routing forwarding of data interaction requests based on the recorded forwarding correspondence, so as to forward requests sent by the same video surveillance device to the same video surveillance service instance for processing as much as possible. In this way, the consistency and continuity of data interaction can be improved, thereby improving the accuracy of data and affecting the normal operation of video surveillance services. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0042] Figure 1 is a system structure diagram of a video surveillance system in one embodiment;
[0043] Figure 2 This is one of the flowcharts of the routing and forwarding method in one embodiment;
[0044] Figure 3 This is a second flowchart of a routing and forwarding method in one embodiment;
[0045] Figure 4 A schematic structural diagram of a routing and forwarding device in one embodiment;
[0046] Figure 5 FIG. 1 is a diagram of the internal structure of a routing and forwarding gateway in one embodiment. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0048] The terms involved in this application are explained below.
[0049] Load balancing: A method of distributing traffic to multiple servers for processing, which can reduce request waiting time, thereby improving system response speed and effectively improving system availability and performance.
[0050] HTTP (Hypertext Transfer Protocol): a request-response protocol;
[0051] RTSP (Real Time Streaming Protocol): an application layer protocol in the TCP / IP protocol system.
[0052] TCP (Transmission Control Protocol): a connection-oriented, reliable, byte-stream-based transport layer communication protocol;
[0053] IP (Internet Protocol): a network layer protocol in the TCP / IP system.
[0054] Video monitoring service: a service providing video monitoring devices with corresponding business functions such as device registration, signaling control, media forwarding, etc.
[0055] It should be noted that the image / video collection, storage, use, processing, transmission, provision and disclosure, etc. involved in the present application comply with relevant laws and regulations and do not violate public order and good customs.
[0056] In one embodiment, as shown in FIG. 1, Figure 1 The present application provides a video monitoring system, which includes a routing forwarding gateway 102, video monitoring devices 104 and at least one video monitoring server 106. The routing forwarding gateway 102 is respectively connected with each video monitoring device 104 and each video monitoring server 106, and is used as an intermediate layer between the video monitoring devices 104 and the video monitoring servers 106.
[0057] Among them, the video monitoring server 106 is used to provide video monitoring services for the video monitoring devices 104, including but not limited to any one or any combination of services such as registration, control, alarm, video stream cloud storage, etc. of the video monitoring devices 104. It can be understood that the number of video monitoring servers 106 can be one or more, and the specific number can be determined according to the total number of video monitoring devices 104 and the data flow in the video monitoring system, which is not limited herein.
[0058] Video surveillance device 104 refers to a device used to capture video image information to implement surveillance functions. For example, video surveillance device 104 can be a camera. In the video surveillance system provided herein, video surveillance device 104 is configured with the gateway address and port information corresponding to routing and forwarding gateway 102. For example, routing and forwarding gateway 102 can provide a unified public network server IP address and port information, and each video surveillance device 104 in the system can be configured with this public network server IP address and port information.
[0059] Specifically, because the video surveillance device 104 is configured with the gateway address and port information corresponding to the routing forwarding gateway 102, the video surveillance device 104 will send a corresponding request to the routing forwarding gateway 102 during the device registration and data exchange process. The routing forwarding gateway 102 can forward the request from the video surveillance device 104 to the corresponding video surveillance server 106 based on the routing forwarding method of any of the following embodiments, so that the corresponding video surveillance server 106 can provide video surveillance services to the video surveillance device 104.
[0060] The routing forwarding method provided by this application is described below.
[0061] In one embodiment, Figure 2 As shown, the present application provides an application Figure 1 The routing forwarding method of the routing forwarding gateway shown includes the following steps:
[0062] S202: In response to the received device registration request, determine a first target service from at least one registered service, and forward the device registration request to the first target service.
[0063] The device registration request is issued by a video surveillance device to request that the video surveillance device be registered with a video surveillance service. After the video surveillance device is registered with the corresponding video surveillance service, the corresponding video surveillance service can provide video surveillance services to the video surveillance device. A registered service refers to a video surveillance service that has been registered with the routing and forwarding gateway. The first target service refers to the video surveillance service assigned to the video surveillance device that sent the device registration request.
[0064] In this step, since the video surveillance device is configured with the gateway address and port information corresponding to the routing and forwarding gateway, when the video surveillance device needs to register, it can send a device registration request to the routing and forwarding gateway. Upon receiving the device registration request, the routing and forwarding gateway can identify a first target service from at least one registered service and send the device registration request to the first target service to register the video surveillance device that sent the device registration request (i.e., the registered surveillance device) with the first target service.
[0065] S204: If a first registration success message returned by the first target service in response to the device registration request is received, a forwarding correspondence between a service address corresponding to the first target service and a device identifier of the registered monitoring device is recorded.
[0066] The registered monitoring device is a video monitoring device that sends a device registration request.
[0067] In this step, after forwarding the device registration request to the first target service, the first target service can perform registration verification based on the received device registration request, and if the registration verification passes, register the registration monitoring device to this service and return the first registration success message to the routing forwarding gateway.
[0068] Upon receiving the first registration success message, the routing and forwarding gateway may determine that the registered monitoring device has successfully registered with the first target service. In this case, the routing and forwarding gateway may record the registered service address corresponding to the registered monitoring device and generate a forwarding correspondence between the service address corresponding to the first target service and the device identifier of the registered monitoring device.
[0069] S206: In response to the received data interaction request, query each forwarding correspondence according to the interaction device identifier and obtain an address query result.
[0070] The data interaction request is sent by the video surveillance device to request data interaction with the video surveillance service. The interactive device identifier is the device identifier of the interactive monitoring device, which is the video surveillance device that sends the data interaction request.
[0071] In this step, when the routing forwarding gateway receives the data interaction request, it can determine the device identification of the video surveillance device that sent the data interaction request and obtain the interaction device identification. For example, the routing forwarding gateway can extract the interaction device identification from the data interaction request.
[0072] After obtaining the interaction device identifier, the routing forwarding gateway can query each recorded forwarding correspondence based on the interaction device identifier to attempt to find the registered service address corresponding to the interaction monitoring device. It is understood that if the routing forwarding gateway has recorded the registration service address of the interaction monitoring device, the address query result may be the registered service address. If the routing forwarding gateway does not have recorded the registration service address of the interaction monitoring device, the address query result is not the service address, for example, the address query result may be NULL or the query failed.
[0073] For example, if the routing forwarding gateway records a first forwarding correspondence and a second forwarding correspondence, and the first forwarding correspondence is device identifier 1 - service address 1, and the second forwarding correspondence is device identifier 2 - service address 2, then when the interactive device identifier is device identifier 1, the address query result is service address 1. Similarly, when the interactive device identifier is device identifier 2, the address query result is service address 2. When the interactive device identifier is device identifier 3, since the routing forwarding gateway does not record a forwarding correspondence corresponding to device identifier 3, the address query result may be NULL or the query may fail.
[0074] S208: If the address query result is a service address, forward the data interaction request to the second target service.
[0075] The second target service is a registered service corresponding to the address query result, that is, the video monitoring service to which the interactive monitoring device has been registered.
[0076] In this step, if the address query result is a service address, it indicates that the routing and forwarding gateway has recorded the registered service address corresponding to the interactive monitoring device. In this case, the routing and forwarding gateway can forward the data interaction request to the corresponding registered service (i.e., the second target service), allowing the interactive monitoring device to interact with the second target service.
[0077] It can be understood that when the forwarding correspondence remains unchanged, the routing forwarding gateway can forward each data interaction request sent by the same video surveillance device to the same registered service, thereby providing homologous address forwarding for the data interaction of the video surveillance device, thereby maintaining data consistency and continuity.
[0078] In this application, the routing and forwarding gateway can receive a device registration request from a video surveillance device and forward the request to the corresponding video surveillance service, allowing the video surveillance device to register with the corresponding video surveillance service. If the registration is successful, the routing and forwarding gateway can generate and record the forwarding correspondence between the device identifier of the video surveillance device and the corresponding service address, and forward the data exchange request accordingly.
[0079] In this way, by introducing a routing forwarding gateway as an intermediate layer, efficient and stable communication between video surveillance equipment and video surveillance services can be achieved, and thus, the communication interaction mode between the video surveillance equipment and the video surveillance service can be maintained without changing the communication interaction mode between the video surveillance equipment and the video surveillance service, while maintaining compatibility with existing communication protocols. On this basis, this application can implement homologous routing forwarding of data interaction requests based on the recorded forwarding correspondence, so as to forward requests sent by the same video surveillance device to the same video surveillance service instance for processing as much as possible. In this way, the consistency and continuity of data interaction can be improved, thereby improving the accuracy of data and affecting the normal operation of video surveillance services.
[0080] In one embodiment, the routing and forwarding gateway records the number of device registrations corresponding to a registered service. The number of device registrations refers to the number of video surveillance devices registered with the registered service. For example, if the number of device registrations corresponding to a video surveillance service is 10, it indicates that 10 video surveillance devices have successfully registered with the video surveillance service, and the video surveillance service is currently providing video surveillance services to 10 video surveillance devices.
[0081] Determining a first target service in at least one registered service includes: determining the first target service in each registered service according to a number of device registrations corresponding to each registered service and a preset load balancing rule.
[0082] In this embodiment, after receiving the device registration request, the routing forwarding gateway can allocate the backend video surveillance service to the registered monitoring device according to load balancing rules such as the minimum number of connections, so as to achieve load balancing function and flexible scheduling.
[0083] It is understood that the specific content of load balancing rules can be pre-set based on actual circumstances and is not specifically limited herein. For example, when the load balancing rule allocates services based on the minimum number of connections, upon receiving a device registration request, the routing and forwarding gateway can determine the minimum number of device registrations among the corresponding registered services and select the registered service with the minimum number of registrations as the first target service. This improves load balancing and thus accelerates the response time of the video surveillance service.
[0084] In one embodiment, the routing forwarding method provided by the present application further includes the following steps:
[0085] Step A1: If a first registration success message is received from the first target service in response to the device registration request, the first registration success message is returned to the registration monitoring device to instruct the registration monitoring device to periodically send a device keepalive request to the routing forwarding gateway;
[0086] Step A2: judging whether the registered monitoring device is offline based on the reception of the device keep-alive request;
[0087] Step A3: If the registered monitoring device is offline, the forwarding relationship corresponding to the registered monitoring device is deleted, and the number of device registrations corresponding to the first target service is updated.
[0088] In this embodiment, considering that after a video surveillance device is registered with a video surveillance service, it may be affected by power failure, communication obstruction, etc. and become offline, therefore, in this embodiment, the routing forwarding gateway can regularly monitor the online status of each registered video surveillance device, and when it is confirmed that the video surveillance device is offline, delete the forwarding correspondence corresponding to the video surveillance device and update the corresponding device registration number to reduce the service resources occupied by the offline device, thereby improving the utilization of service resources.
[0089] Specifically, upon receiving a first registration success message from the first target service in response to a device registration request, the routing and forwarding gateway may determine that the registration monitoring device has registered with the first target service. In this case, the routing and forwarding gateway may return the first registration success message to the registration monitoring device. After receiving the first registration success message, the registration monitoring device periodically sends a device keepalive request to the routing and forwarding gateway.
[0090] It is understood that when the registered monitoring device is online, the routing and forwarding gateway can receive the device keep-alive request sent regularly by the registered monitoring device. If the registered monitoring device is offline, the registered monitoring device cannot send the device keep-alive request, or the device keep-alive request sent by the registered monitoring device cannot be transmitted to the routing and forwarding gateway, resulting in the routing and forwarding gateway not receiving the device keep-alive request.
[0091] As can be seen from this, the routing and forwarding gateway can determine whether a registered monitoring device has gone offline based on the receipt of a device keepalive request. In one example, upon receiving a device keepalive request from a registered monitoring device, the routing and forwarding gateway can update the online activity time corresponding to the registered monitoring device in real time. For example, the online activity time can be updated to the latest time the device keepalive request was received. In this way, the routing and forwarding gateway can determine whether a video surveillance device has gone offline based on each online activity time.
[0092] If a registered monitoring device is determined to be offline, the routing and forwarding gateway can delete the corresponding forwarding relationship and update the device registration count for the first target service corresponding to the registered monitoring device. This can delete the offline device's registration information in the video surveillance system and reallocate the service resources occupied by the offline device.
[0093] In one embodiment, the routing forwarding method provided by the present application further includes the following steps: if the address query result reflects that the routing forwarding gateway does not record the forwarding correspondence corresponding to the interactive device identifier, a request failure message is returned to the interactive monitoring device.
[0094] The request failure message is used to instruct the interactive monitoring device to re-initiate a device registration request to the routing forwarding gateway.
[0095] In this embodiment, if the address query result indicates that the routing and forwarding gateway does not record the registration service address corresponding to the interactive monitoring device, the routing and forwarding gateway may return a request failure message to the interactive monitoring device. After receiving the request failure message, the interactive monitoring device may initiate a device registration request to the routing and forwarding gateway to request that the device be registered with the video surveillance system.
[0096] In one embodiment, the registration step of the registered service in the routing forwarding gateway includes:
[0097] In response to the received service registration request, perform a registration verification on the target registered service, and if the registration verification passes, record the service address corresponding to the target registered service, and send a second registration success message to the target registered service;
[0098] The target registered service is a video surveillance service that sends a service registration request; and the second registration success message is used to instruct the target registered service to periodically send a service keep-alive request to the routing forwarding gateway.
[0099] In this embodiment, considering that after the video surveillance service is registered with the routing and forwarding gateway, it is possible that the server may be disconnected due to reasons such as power outage and communication obstruction, thereby affecting the normal operation of the video surveillance service, therefore, in this embodiment, the routing and forwarding gateway can regularly monitor the service status of each registered service, so as to facilitate scheduling according to the service status of the registered service and ensure the normal operation of the video surveillance service.
[0100] Specifically, the video surveillance service can send a service registration request to the routing and forwarding gateway to request that the video surveillance service be registered with the routing and forwarding gateway. Upon receiving the service registration request, the routing and forwarding gateway can perform a registration verification on the registered service to which the service registration request was sent. If the registration verification passes, it will record the service address corresponding to the registered service to facilitate the subsequent forwarding of the request sent by the video surveillance device to the registered service.
[0101] If the target registered service registration verification passes, the routing forwarding gateway may also send a second registration success message to the target registered service. After receiving the second registration success message, the target registered service may periodically send a service keep-alive request to the routing forwarding gateway.
[0102] It is understood that when the target registered service is in normal working order, the routing forwarding gateway can receive the service keep-alive request sent by the target registered service at regular intervals. If the target registered service is in a faulty state, the target registered service cannot send the service keep-alive request, or the service keep-alive request sent by the target registered service cannot be transmitted to the routing forwarding gateway, resulting in the routing forwarding gateway not receiving the service keep-alive request.
[0103] This shows that the routing forwarding gateway can detect the service status of the target registered service based on the reception of the service keep-alive request.
[0104] Furthermore, in one embodiment, the routing and forwarding method provided by the present application may further include the following steps:
[0105] Determine whether the target registered service is faulty based on the receipt of the service keep-alive request;
[0106] If the target registered service fails, the forwarding correspondence of the target registered service and the registration information of the target registered service in the routing forwarding gateway are deleted.
[0107] In this embodiment, the routing and forwarding gateway can determine whether the target registered service has failed based on the receipt of the service keepalive request. In one example, upon receiving the service keepalive request from the target registered service, the routing and forwarding gateway can update the online activity time corresponding to the target registered service in real time. For example, the online activity time can be updated to the latest time the service keepalive request was received. In this way, the routing and forwarding gateway can determine whether each registered service has failed based on the online activity time.
[0108] If a target registered service is detected as faulty, the routing and forwarding gateway can delete all forwarding relationships corresponding to the target registered service, as well as the target registered service's registration information within the routing and forwarding gateway. This way, when a video surveillance device originally registered with the target registered service initiates a data exchange request, the routing and forwarding gateway will return a request failure message to the device, instructing it to re-initiate a device registration request, allowing the routing and forwarding gateway to reassign the video surveillance to another video surveillance service. This provides disaster recovery capabilities for the video surveillance system, ensuring that even if some registered services fail, video surveillance services can still be provided to the system's video surveillance devices through other, healthy registered services.
[0109] In one embodiment, Figure 3 As shown, the present application provides an application Figure 1 The routing and forwarding method of the video surveillance system shown in the figure specifically includes the following steps:
[0110] S301: The video surveillance service sends a service registration request to the routing forwarding gateway;
[0111] S302: In response to the received service registration request, the routing forwarding gateway performs a registration verification on the video surveillance service, and if the registration verification passes, records the service address corresponding to the video surveillance service;
[0112] S303: If the registration verification passes, the routing forwarding gateway sends a second registration success message to the video surveillance service;
[0113] S304: After receiving the second registration success message, the video surveillance service sends a service keep-alive request to the routing forwarding gateway at a regular interval;
[0114] S305: In response to the received service keep-alive request, the routing forwarding gateway updates the service online active time corresponding to the video surveillance service;
[0115] S306: The routing forwarding gateway sends a service update message to the video surveillance service;
[0116] S307: The video surveillance device sends a device registration request to the routing forwarding gateway each time it is powered on;
[0117] S308: The routing forwarding gateway allocates video surveillance services to the video surveillance device according to a preset load balancing rule in response to the received device registration request;
[0118] S309: The routing forwarding gateway forwards the device registration request to the corresponding video surveillance service;
[0119] S310: After receiving the device registration information, the video surveillance service performs a registration verification on the video surveillance device and generates a first registration success message if the registration verification passes;
[0120] S311: The video surveillance service returns a first registration success message to the routing forwarding gateway;
[0121] S312: In response to the received first registration success message, the routing forwarding gateway records the forwarding correspondence between the device identifier corresponding to the video surveillance device and the service address corresponding to the video surveillance service, updates the number of device registrations corresponding to the video surveillance service, and sets the online active time of the video surveillance device;
[0122] S313: The routing forwarding gateway returns a first registration success message to the video surveillance device;
[0123] S314: The video surveillance device sends a device keep-alive request to the routing forwarding gateway in response to the received first registration success message;
[0124] S315: In response to the received device keep-alive request, the routing forwarding gateway updates the device online active time corresponding to the video surveillance device;
[0125] S316: The routing forwarding gateway sends a device update message to the video surveillance device;
[0126] S317: The video surveillance device sends a data interaction request to the routing forwarding gateway;
[0127] S318: The routing forwarding gateway queries the registration service address according to the interaction device identifier in response to the received data interaction request;
[0128] S319: The routing forwarding gateway forwards the data interaction request to the video surveillance service corresponding to the registered service address;
[0129] S320: The video surveillance service performs service processing in response to the received data interaction request and obtains response data;
[0130] S321: The video surveillance service returns response data to the routing forwarding gateway;
[0131] S322: The routing forwarding gateway returns response data to the video surveillance device;
[0132] S323: When the video surveillance device goes offline / the video surveillance service fails, the device online active time / the service online active time times out, and the routing forwarding gateway clears the recorded forwarding correspondences and updates the number of device registrations for the video surveillance service.
[0133] S324: The routing forwarding gateway returns a response message to the video surveillance device / video surveillance service based on the cleanup / update result.
[0134] In this example, after the video surveillance service cluster is deployed and launched, it can register the service's intranet address, port, and other service address information with the routing and forwarding gateway, and support periodic reporting of service availability through the status keepalive function. In addition, after receiving the device registration request, the routing and forwarding gateway can forward the request to the backend video surveillance service for registration verification based on forwarding policies such as the minimum number of connections, thus implementing a scheduling function. In the event of a service failure or other failure to send a status keepalive request, the routing and forwarding gateway's online active time will detect a timeout and fail to update in a timely manner, triggering the routing and forwarding gateway to promptly clean up the corresponding device registration backend service address and the backend service's device registration data, allowing the video surveillance device to re-initiate the device registration request, thus providing disaster recovery capabilities.
[0135] The routing and forwarding device provided in an embodiment of the present application is described below. The routing and forwarding device described below and the routing and forwarding method described above can be referenced to each other.
[0136] In one embodiment, Figure 4 As shown, the present application provides a routing forwarding device 400 applied to a routing forwarding gateway, comprising:
[0137] The device registration request forwarding module 402 is configured to, in response to a received device registration request, determine a first target service from at least one registered service and forward the device registration request to the first target service; wherein the registered service is a video surveillance service registered with the routing forwarding gateway;
[0138] a correspondence recording module 404 configured to, upon receiving a first registration success message returned by the first target service in response to the device registration request, record a forwarding correspondence between a service address corresponding to the first target service and a device identifier of a registered monitoring device; wherein the registered monitoring device is the video monitoring device that sent the device registration request;
[0139] An address query module 406 is configured to query each forwarding correspondence according to an interactive device identifier in response to a received data interaction request, and obtain an address query result; wherein the interactive device identifier is a device identifier of an interactive monitoring device, and the interactive monitoring device is a video monitoring device that sends the data interaction request;
[0140] The data interaction request forwarding module 408 is configured to forward the data interaction request to a second target service if the address query result is a service address; wherein the second target service is a registered service corresponding to the address query result.
[0141] In one embodiment, the routing forwarding gateway records the number of device registrations corresponding to the registered service. The device registration request forwarding module 402 of the present application includes:
[0142] The load balancing unit is configured to determine the first target service among the registered services according to the number of device registrations corresponding to the registered services and a preset load balancing rule.
[0143] In one embodiment, the routing and forwarding device 400 of the present application further includes:
[0144] a device registration module configured to, upon receiving a first registration success message returned by the first target service in response to the device registration request, return the first registration success message to the registration monitoring device to instruct the registration monitoring device to periodically send a device keepalive request to the routing forwarding gateway;
[0145] An offline detection module, configured to determine whether the registered monitoring device is offline based on the reception of the device keep-alive request;
[0146] The first registration information updating module is configured to delete the forwarding correspondence corresponding to the registered monitoring device and update the number of device registrations corresponding to the first target service if the registered monitoring device is offline.
[0147] In one embodiment, the routing and forwarding device 400 of the present application further includes:
[0148] a request failure module, configured to return a request failure message to the interaction monitoring device if the address query result indicates that the routing forwarding gateway does not record a forwarding correspondence corresponding to the interaction device identifier;
[0149] The request failure message is used to instruct the interactive monitoring device to re-initiate a device registration request to the routing forwarding gateway.
[0150] In one embodiment, the routing and forwarding device 400 of the present application further includes:
[0151] a service registration module, configured to perform registration verification on a target registered service in response to a received service registration request, and if the registration verification passes, record a service address corresponding to the target registered service, and send a second registration success message to the target registered service;
[0152] The target registered service is the video surveillance service that sends the service registration request; and the second registration success message is used to instruct the target registered service to periodically send a service keep-alive request to the routing forwarding gateway.
[0153] In one embodiment, the routing and forwarding device 400 of the present application further includes:
[0154] a fault detection module, configured to determine whether the target registered service is faulty based on a receipt of the service keep-alive request;
[0155] The second registration information updating module is configured to delete the forwarding correspondence corresponding to the target registered service and the registration information of the target registered service in the routing forwarding gateway if the target registered service fails.
[0156] In one embodiment, the present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the routing forwarding method in any embodiment.
[0157] In one embodiment, the present application also provides a routing forwarding gateway, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the routing forwarding method in any embodiment.
[0158] Schematically, Figure 5This is a schematic diagram of the internal structure of a routing forwarding gateway provided in an embodiment of the present application. Figure 5 The routing and forwarding gateway 900 includes a processing component 902, which further includes one or more processors and a memory resource represented by a memory 901 for storing instructions executable by the processing component 902. The processing component 902 is configured to execute instructions to perform the steps of the routing and forwarding method described in any of the above embodiments.
[0159] The routing and forwarding gateway 900 may further include a power supply component 903 configured to perform power management of the routing and forwarding gateway 900 , a wired or wireless network interface 904 configured to connect the routing and forwarding gateway 900 to a network, and an input / output (I / O) interface 905 .
[0160] Those skilled in the art will understand that the internal structure of the routing and forwarding gateway shown in the present application is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the routing and forwarding gateway to which the solution of the present application is applied. The specific routing and forwarding gateway may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0161] Finally, it should be noted that, in this article, relational terms such as first and second are merely used to distinguish one entity or operation from another, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. Without further restriction, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element. Herein, "one," "said," "the," and "its" may also include plural forms unless the context clearly indicates otherwise. A plurality refers to at least two, such as 2, 3, 5, or 8. "And / or" includes any and all combinations of the relevant listed items.
[0162] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.
[0163] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A routing forwarding method, characterized in that: Applied to a routing and forwarding gateway, the method includes: In response to the received device registration request, determine a first target service from at least one registered service, and forward the device registration request to the first target service; wherein the registered service is a video surveillance service registered with the routing forwarding gateway, and the routing forwarding gateway records the number of device registrations corresponding to the registered service; If a first registration success message returned by the first target service in response to the device registration request is received, recording a forwarding correspondence between a service address corresponding to the first target service and a device identifier of a registered monitoring device; wherein the registered monitoring device is the video monitoring device that sent the device registration request; In response to the received data interaction request, query each of the forwarding correspondences according to the interaction device identifier and obtain an address query result; wherein the interaction device identifier is the device identifier of the interaction monitoring device, and the interaction monitoring device is the video monitoring device that sends the data interaction request; If the address query result is a service address, forwarding the data interaction request to a second target service; wherein the second target service is a registered service corresponding to the address query result; If a first registration success message is received from the first target service in response to the device registration request, the first registration success message is returned to the registration monitoring device to instruct the registration monitoring device to periodically send a device keep-alive request to the routing forwarding gateway; Determining whether the registered monitoring device is offline according to the reception of the device keep-alive request; If the registered monitoring device is offline, the forwarding correspondence corresponding to the registered monitoring device is deleted, and the number of device registrations corresponding to the first target service is updated.
2. The method according to claim 1, characterized in that The determining a first target service from at least one registered service includes: The first target service is determined in each of the registered services according to the number of device registrations corresponding to each of the registered services and a preset load balancing rule.
3. The method according to any one of claims 1 to 2, characterized in that The method further comprises: If the address query result shows that the routing forwarding gateway does not record the forwarding correspondence corresponding to the interaction device identifier, a request failure message is returned to the interaction monitoring device; The request failure message is used to instruct the interactive monitoring device to re-initiate a device registration request to the routing forwarding gateway.
4. The method according to claim 3, characterized in that The step of registering the registered service in the routing forwarding gateway includes: In response to the received service registration request, perform a registration verification on the target registered service, and if the registration verification passes, record the service address corresponding to the target registered service, and send a second registration success message to the target registered service; The target registered service is the video surveillance service that sends the service registration request; and the second registration success message is used to instruct the target registered service to periodically send a service keep-alive request to the routing forwarding gateway.
5. The method according to claim 4, characterized in that The method further comprises: Determining whether the target registered service is faulty based on a receipt of the service keep-alive request; If the target registered service fails, the forwarding correspondence corresponding to the target registered service and the registration information of the target registered service in the routing forwarding gateway are deleted.
6. A routing forwarding device, characterized in that: Applied to a routing and forwarding gateway, the device includes: a device registration request forwarding module, configured to, in response to a received device registration request, determine a first target service from at least one registered service and forward the device registration request to the first target service; wherein the registered service is a video surveillance service registered with the routing forwarding gateway, and the routing forwarding gateway records the number of device registrations corresponding to the registered service; a correspondence recording module configured to, upon receiving a first registration success message returned by the first target service in response to the device registration request, record a forwarding correspondence between a service address corresponding to the first target service and a device identifier of a registered monitoring device; wherein the registered monitoring device is the video monitoring device that sent the device registration request; An address query module, configured to query each forwarding correspondence according to an interactive device identifier in response to a received data interaction request, and obtain an address query result; wherein the interactive device identifier is a device identifier of an interactive monitoring device, and the interactive monitoring device is a video monitoring device that sends the data interaction request; a data interaction request forwarding module, configured to forward the data interaction request to a second target service if the address query result is a service address; wherein the second target service is a registered service corresponding to the address query result; a device registration module configured to, upon receiving a first registration success message returned by the first target service in response to the device registration request, return the first registration success message to the registration monitoring device to instruct the registration monitoring device to periodically send a device keepalive request to the routing forwarding gateway; An offline detection module, configured to determine whether the registered monitoring device is offline based on the reception of the device keep-alive request; The first registration information updating module is configured to delete the forwarding correspondence corresponding to the registered monitoring device and update the number of device registrations corresponding to the first target service if the registered monitoring device is offline.
7. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the routing and forwarding method according to any one of claims 1 to 5.
8. A routing forwarding gateway, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the routing and forwarding method according to any one of claims 1 to 5 are performed.
9. A video surveillance system, characterized in that: include: The routing forwarding gateway according to claim 8; A video surveillance device is configured with the gateway address and port information corresponding to the routing forwarding gateway and is communicatively connected to the routing forwarding gateway; The video surveillance server is communicatively connected to the routing forwarding gateway and is used to provide video surveillance services.
Citation Information
Patent Citations
Message routing method, device and system and storage medium
CN110661836A
Service request forwarding method and system
CN113259492A