Reservoir monitoring data synchronization method and device
By using message queues to synchronize the registration and history of monitoring equipment in the reservoir monitoring system, the problem of failed synchronization of history records after the monitoring equipment is replaced is solved, and the reliability of synchronization is improved.
Patent Information
- Application Number
- CN202411884978.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-12-20
AI Technical Summary
In the reservoir monitoring system, after the monitoring equipment is replaced, the synchronization of historical monitoring records fails, resulting in the successful registration of monitoring equipment that cannot obtain historical monitoring records, affecting the reliability of synchronization.
By responding to the registration request of the monitoring device, the registration transaction is executed and recorded in the message queue, the monitoring platform enables the synchronization transactions based on the registration transactions obtained by the message queue and provides feedback on the processing results. Get the processing results of synchronous transactions from the message queue and update the processing results of the registration transactions to make the processing results of the registration transactions consistent with the processing results of the synchronization transactions of the historical monitoring record.
Ensure that the monitoring equipment can obtain historical monitoring records after successfully registering, improve the reliability of historical monitoring records synchronization, and avoid successful registration but synchronization failure.
Smart Images

Figure CN119342063B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method and device for synchronizing reservoir monitoring data. Background Art
[0002] In order to improve the safety of the reservoir, monitoring equipment is usually deployed in a certain area of the reservoir to monitor the area. The monitoring equipment can store the monitoring data of the area to facilitate users to view the changes in the area through the monitoring equipment. At the same time, the monitoring equipment will also upload the monitoring data to the monitoring platform, and the monitoring platform will store the monitoring data of each area of the reservoir, so as to facilitate remote viewing of the changes in each area of the reservoir.
[0003] When the monitoring equipment in a certain area is replaced due to damage or other reasons, in order to view the historical monitoring records of the area on the replaced monitoring equipment, it is necessary to trigger the synchronization operation of the historical monitoring records when the replaced monitoring equipment completes the equipment registration, and synchronize the historical monitoring records of the area to the replaced monitoring equipment. However, since the equipment registration and historical record synchronization are operations performed by different nodes, such as equipment registration is performed by the server, and historical monitoring record synchronization is performed by the monitoring platform, it may happen that the server completes the registration of the monitoring equipment, but the monitoring platform fails to synchronize the historical monitoring records, resulting in the inability of the registered monitoring equipment to obtain the historical monitoring records of the reservoir area it monitors, affecting the reliability of the synchronization of historical monitoring records. Summary of the invention
[0004] The present application aims to solve at least one of the technical problems existing in the related art. To this end, the present application proposes a reservoir monitoring data synchronization method, which can improve the reliability of historical monitoring record synchronization.
[0005] The present application also proposes a reservoir monitoring data synchronization device.
[0006] The application also provides an electronic device.
[0007] The present application also proposes a computer-readable storage medium.
[0008] A method for synchronizing reservoir monitoring data according to an embodiment of the first aspect of the present application includes:
[0009] In response to a registration request of any monitoring device, executing a registration transaction of the monitoring device according to device information of the monitoring device and a reservoir area monitored by the monitoring device;
[0010] Recording the registration transaction to a message queue, so that the monitoring platform executes a corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back a processing result of the historical monitoring record synchronization transaction to the message queue;
[0011] Obtaining, from the message queue, a processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so as to make the processing result of the registration transaction consistent with that of the historical monitoring record synchronization transaction;
[0012] Among them, the registration transaction includes caching the device information and the corresponding reservoir area, and the historical monitoring record synchronization transaction includes obtaining the historical monitoring records of the reservoir area according to the reservoir area and device information in the registration transaction, and synchronizing them to the monitoring device corresponding to the device information.
[0013] By responding to the registration request of any monitoring device, the registration transaction of the monitoring device is executed according to the device information of the monitoring device and the reservoir area monitored by the monitoring device, so as to record the registration transaction to the message queue, so that the monitoring platform executes the corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and after feeding back the processing result of the historical monitoring record synchronization transaction to the message queue, the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction is obtained from the message queue, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction. Since the processing result of the registration transaction is synchronized with the processing result of the historical monitoring record synchronization transaction, it is possible to avoid the situation where the monitoring device is successfully registered but the synchronization of the historical monitoring record fails, resulting in the monitoring device being unable to trigger the acquisition of the historical monitoring record again because the monitoring device has completed the registration, causing the monitoring device that has successfully registered to be unable to obtain the historical monitoring record, thereby improving the reliability of the synchronization of the historical monitoring record.
[0014] According to one embodiment of the present application, recording the registration transaction to a message queue includes:
[0015] Determine that the registration transaction is executed successfully, and record the registration transaction in the message queue.
[0016] According to an embodiment of the present application, updating the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction includes:
[0017] Determine that the processing result of the historical monitoring record synchronization transaction is that the historical monitoring record synchronization is successful, update the processing result of the registration transaction to that the registration transaction is successfully executed, and store the device information and the corresponding reservoir area from the cache to the disk storage.
[0018] According to an embodiment of the present application, updating the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction includes:
[0019] Determine that the processing result of the historical monitoring record synchronization transaction is the failure of the historical monitoring record synchronization, update the processing result of the registration transaction to the failure of the registration transaction execution, and delete the device information and the corresponding reservoir area from the cache.
[0020] According to one embodiment of the present application, the registration transaction is recorded in a message queue so that the monitoring platform executes a corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back the processing result of the historical monitoring record synchronization transaction to the message queue, including:
[0021] The registration transaction is recorded in a message queue so that the monitoring platform obtains the historical monitoring records of the reservoir area based on the reservoir area and equipment information in the registration transaction obtained from the message queue, generates a data link corresponding to the historical monitoring record and synchronizes it to the monitoring device corresponding to the equipment information, and feeds back the synchronization result of the data link to the message queue.
[0022] According to an embodiment of the present application, after obtaining the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction from the message queue, it also includes:
[0023] The registration transaction and the processing result of the historical monitoring record synchronization transaction are deleted from the message queue.
[0024] According to one embodiment of the present application, it also includes:
[0025] Determine that the monitoring platform has not obtained the registration transaction in the message queue within a preset time period, delete the registration transaction from the message queue, update the processing result of the registration transaction to the failure of the registration transaction execution, and delete the device information and the corresponding reservoir area from the cache.
[0026] A reservoir monitoring data synchronization device according to an embodiment of the second aspect of the present application includes:
[0027] A device registration module, used to respond to a registration request of any monitoring device and execute a registration transaction of the monitoring device according to the device information of the monitoring device and the reservoir area monitored by the monitoring device;
[0028] A record synchronization module, used to record the registration transaction to a message queue, so that the monitoring platform executes a corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back the processing result of the historical monitoring record synchronization transaction to the message queue;
[0029] A message update module, used to obtain the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction from the message queue, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction;
[0030] Among them, the registration transaction includes caching the device information and the corresponding reservoir area, and the historical monitoring record synchronization transaction includes obtaining the historical monitoring records of the reservoir area according to the reservoir area and device information in the registration transaction, and synchronizing them to the monitoring device corresponding to the device information.
[0031] According to an electronic device of an embodiment of the third aspect of the present application, the electronic device includes a processor and a memory storing a computer program, and when the processor executes the computer program, the reservoir monitoring data synchronization method described in any of the above embodiments is implemented.
[0032] According to the computer-readable storage medium of the fourth aspect of the present application, a computer program is stored thereon, and when the computer program is executed by a processor, the reservoir monitoring data synchronization method described in any of the above embodiments is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are 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 work.
[0034] Figure 1 A schematic diagram of an application environment of a reservoir monitoring data synchronization method according to some embodiments of the present application;
[0035] Figure 2 A flowchart of a method for synchronizing reservoir monitoring data according to some embodiments of the present application;
[0036] Figure 3It is a structural schematic diagram of a reservoir monitoring data synchronization device provided in an embodiment of the present application;
[0037] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0039] Below, the reservoir monitoring data synchronization method and device provided in the embodiments of the present application will be introduced and explained in detail through several specific embodiments.
[0040] The reservoir monitoring data synchronization method disclosed in the embodiment of the present application can be applied to the monitoring record synchronization system. Figure 1 As shown, the monitoring record synchronization system includes at least one monitoring device 10 , a server 20 and a monitoring platform 30 .
[0041] Among them, at least one monitoring device 10 may be provided for any reservoir area of the reservoir. The monitoring device may be a monitoring device for monitoring any water environment element, such as a water quality monitoring device, a water level monitoring device or a monitoring camera device, etc. The monitoring device includes a sensing part for monitoring water environment elements, as well as a processor and a memory, such as a water quality monitoring device includes a water quality sensor, a processor and a memory; a monitoring camera device includes a camera, a processor and a memory. The memory may be used to store the monitoring data of the monitoring device, and the monitoring device may also be a monitoring device with a display screen, so that the user can view the changes in the corresponding reservoir area through the monitoring device.
[0042] In order to ensure the monitoring safety of the reservoir, each monitoring device 10 must be registered before monitoring and data upload can be performed. The registration of the monitoring device 10 is performed by the server 20. That is, the server 20 is used to obtain the registration request sent by the monitoring device, including its device information and the monitored reservoir area, verify the registration request, and after successful verification, record the device information of the monitoring device and the reservoir area corresponding to the device information. Among them, the server 20 can be an independent server or a server cluster composed of multiple servers, and can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence sampling point equipment.
[0043] The monitoring platform 30 can be any terminal such as a mobile terminal, a desktop terminal or a central server. The central server can be an independent server or a server cluster composed of multiple servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence sampling point equipment. The monitoring platform is used to receive the monitoring data uploaded by each registered monitoring device in the reservoir and store it to facilitate remote viewing of changes in each area of the reservoir and facilitate overall management of the reservoir.
[0044] When the monitoring equipment 10 in a reservoir area is replaced due to damage or other reasons, it is necessary to register the replaced monitoring equipment 10. At the same time, in order to be able to view the historical monitoring records of the area on the replaced monitoring equipment, it is necessary to trigger the synchronization operation of the historical monitoring records when the replaced monitoring equipment completes the equipment registration, and synchronize the historical monitoring records of the area to the replaced monitoring equipment 10.
[0045] According to some embodiments of the present application, a method for synchronizing monitoring data of a reservoir is provided, which can be applied to the aforementioned server 20, and is used to synchronize the historical monitoring records of the reservoir to the replaced monitoring equipment. The server can be an independent server or a server cluster composed of multiple servers, and can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence sampling point equipment.
[0046] like Figure 1 As shown, a reservoir monitoring data synchronization method provided in this embodiment includes:
[0047] Step 101, in response to a registration request of any monitoring device, executing a registration transaction of the monitoring device according to the device information of the monitoring device and the reservoir area monitored by the monitoring device;
[0048] Step 102, recording the registration transaction to a message queue, so that the monitoring platform executes a corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back the processing result of the historical monitoring record synchronization transaction to the message queue;
[0049] Step 103, obtaining the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction from the message queue, and updating the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction;
[0050] Among them, the registration transaction includes caching the device information and the corresponding reservoir area, and the historical monitoring record synchronization transaction includes obtaining the historical monitoring records of the reservoir area according to the reservoir area and device information in the registration transaction, and synchronizing them to the monitoring device corresponding to the device information.
[0051] In some embodiments, the monitoring device may be a replaced monitoring device for monitoring a certain reservoir area. When the monitoring device needs to monitor the reservoir area, it may first generate a registration request based on the reservoir area it monitors and its device information. Among them, the device information may be the device ID and device type of the monitoring device. When the server receives the registration request sent by the monitoring device, it executes the registration transaction for the monitoring device. The registration transaction includes verifying the registration request, and after the verification is completed, the device information of the monitoring device and its corresponding reservoir area are stored in the cache of the server to record the corresponding relationship between the device information and the reservoir area. For example, the device information of the monitoring device and its corresponding reservoir area can be stored in the cached message list, so that the message list records the device information of the monitoring device, the reservoir area monitored by the monitoring device, and the corresponding relationship between the device information and the reservoir area. Exemplarily, assuming that the device information of the monitoring device is device 1, and the reservoir area it monitors is reservoir area A, then device 1, reservoir area A, and the corresponding relationship between the two can be recorded in the cached message list.
[0052] When executing the registration transaction of the monitoring device, the server may also record the registration transaction of the monitoring device into the message queue, and mark the registration transaction as pending consumption in the message queue. For example, the device information of the monitoring device and the corresponding reservoir area composition may be stored in the message queue to represent the registration transaction, and the message may be marked as pending consumption in the message queue.
[0053] After the registration transaction is stored in the message queue, the registration transaction in the message queue can be sent to the monitoring platform in sequence. When the monitoring platform obtains a registration transaction from the message queue, it can obtain the reservoir area and device information in the registration transaction to execute the historical monitoring record synchronization transaction according to the reservoir area and device information in the registration transaction.
[0054] Exemplarily, the execution of the historical monitoring record synchronization transaction may be: first, according to the device type in the device information, all monitoring records corresponding to the device type are obtained from the database as each target monitoring record. If the device type is a water quality monitoring device, the water quality monitoring record is obtained from the database as each target monitoring record. After obtaining all monitoring records corresponding to the device type, the historical monitoring records of the reservoir area can be obtained from each target monitoring record according to the reservoir area in the registration transaction, and then the monitoring device that needs to receive the historical monitoring record is determined according to the device ID in the device information, so as to synchronize the historical monitoring record to the monitoring device.
[0055] After completing the execution of the historical monitoring record synchronization transaction, the monitoring platform can generate the processing result of the historical monitoring record synchronization transaction, which includes the success or failure of the historical monitoring record synchronization transaction. For example, when the monitoring platform successfully synchronizes the historical monitoring records to the monitoring device, the processing result of the historical monitoring record synchronization transaction can be determined to be a successful execution; otherwise, the processing result of the historical monitoring record synchronization transaction can be determined to be a failed execution.
[0056] After the monitoring platform generates the processing result of the historical monitoring record synchronization transaction, it can mark the registration transaction with the processing result and then feed it back to the message queue of the server. If the registration transaction obtained by the monitoring platform is transaction 1, then after responding to transaction 1 and executing the corresponding historical monitoring record synchronization transaction, it can mark transaction 1 with the processing result of the historical monitoring record synchronization transaction and feed it back to the message queue of the server.
[0057] The server can obtain the registration transaction marked with the processing result of the historical monitoring record synchronization transaction from the message queue to update the processing result of the historical monitoring record synchronization transaction to the processing result of the registration transaction. If the processing result of the historical monitoring record synchronization transaction of the registration transaction is marked as success, the processing result of the registration transaction is updated to success; if the processing result of the historical monitoring record synchronization transaction of the registration transaction is marked as failure, the processing result of the registration transaction is updated to failure.
[0058] When the processing result of the registration transaction is updated to failure, a prompt message indicating registration failure may be sent to the monitoring device, so that the monitoring device re-initiates a registration request.
[0059] By responding to the registration request of any monitoring device, the registration transaction of the monitoring device is executed according to the device information of the monitoring device and the reservoir area monitored by the monitoring device, so as to record the registration transaction to the message queue, so that the monitoring platform executes the corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and after feeding back the processing result of the historical monitoring record synchronization transaction to the message queue, the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction is obtained from the message queue, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction. Since the processing result of the registration transaction is synchronized with the processing result of the historical monitoring record synchronization transaction, it is possible to avoid the situation where the monitoring device is successfully registered but the synchronization of the historical monitoring record fails, resulting in the monitoring device being unable to trigger the acquisition of the historical monitoring record again because the monitoring device has completed the registration, causing the monitoring device that has successfully registered to be unable to obtain the historical monitoring record, thereby improving the reliability of the synchronization of the historical monitoring record.
[0060] To further improve the reliability of historical monitoring record synchronization, in some embodiments, recording the registration transaction to a message queue includes:
[0061] Determine that the registration transaction is executed successfully, and record the registration transaction in the message queue.
[0062] In some embodiments, when the server receives a registration request sent by a monitoring device, it executes a registration transaction for the monitoring device, verifies the registration request, and after the verification is completed, stores the device information of the monitoring device and its corresponding reservoir area in the server's cache to record the correspondence between the device information and the reservoir area. If the verification of the registration request fails, or the storage of the device information of the monitoring device and the corresponding reservoir area in the server's cache fails, it indicates that the registration transaction execution has failed. At this time, a prompt message indicating that the registration has failed is sent to the monitoring device, so that the monitoring device re-initiates the registration request, and at the same time stops writing the registration transaction including the device information and its corresponding reservoir area into the message queue, that is, the message formed by the device information and its corresponding reservoir area is not written into the message queue.
[0063] If the registration request verification is completed and the device information of the monitoring device and the corresponding reservoir area are stored in the server's cache, it means that the registration transaction is executed successfully. At this time, the registration transaction is written into the message queue, that is, the message formed by the device information and its corresponding reservoir area is written into the message queue for the monitoring platform to obtain.
[0064] By recording the registration transaction to the message queue after determining that the registration transaction is successfully executed, it is possible to ensure that the device registration and historical monitoring record synchronization succeed or fail at the same time, thereby avoiding the situation where the registration transaction fails to execute but the historical monitoring record synchronization transaction succeeds, resulting in the historical monitoring records being re-synchronized to the monitoring device when the monitoring device is re-registered, causing duplication of historical monitoring records stored in the monitoring device and wasting the storage resources of the monitoring device, thereby further improving the reliability of the synchronization of historical monitoring records.
[0065] In some embodiments, updating the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction includes:
[0066] Determine that the processing result of the historical monitoring record synchronization transaction is that the historical monitoring record synchronization is successful, update the processing result of the registration transaction to that the registration transaction is successfully executed, and store the device information and the corresponding reservoir area from the cache to the disk storage.
[0067] In some embodiments, after the server completes the registration transaction of the monitoring device, that is, stores the device information of the monitoring device and the corresponding reservoir area in the cache, the server can record the registration transaction in the message queue for the monitoring platform to obtain. When receiving the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction fed back by the monitoring platform, if the processing result is successful, it means that the historical monitoring record has been synchronized to the monitoring device, and the processing result of the registration transaction is updated to the successful execution of the registration transaction. If it is detected that the processing result of the registration transaction is updated to the successful execution of the registration transaction, the device information of the registration transaction and the corresponding reservoir area are stored from the server's cache to the server's disk storage, so as to reduce the frequency of reading and writing to the disk storage, and reduce the possibility of losing the registration information of the detection device that has completed the registration and synchronized the historical detection record.
[0068] After the device information of the registration transaction and the corresponding reservoir area are stored from the server's cache to the server's disk storage, the device information of the registration transaction and the corresponding reservoir area can also be deleted from the cache to reduce the storage pressure of the cache.
[0069] In some embodiments, if it is determined that the processing result of the historical monitoring record synchronization transaction is the failure of the historical monitoring record synchronization, the processing result of the registration transaction is updated to the failure of the registration transaction execution, and the device information and the corresponding reservoir area are deleted from the cache.
[0070] When receiving the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction from the monitoring platform, if the processing result is a failure, it means that the historical monitoring record cannot be synchronized to the monitoring device. At this time, the processing result of the registration transaction is updated to the registration transaction execution failure. If it is detected that the processing result of the registration transaction is updated to the registration transaction execution failure, the device information of the registration transaction and the corresponding reservoir area can be deleted from the server cache to avoid the erroneous recording of the device information of the monitoring device that failed to register and the reservoir area it monitors, while reducing the storage pressure of the cache.
[0071] Considering that if all historical monitoring records of the monitoring platform are directly synchronized to the monitoring device, the synchronization time may be too long due to the excessive amount of data in the historical monitoring records. Since the registration result of the monitoring device depends on the determination of the synchronization result, if the synchronization time is too long, it will affect the registration efficiency of the monitoring result, and the long synchronization time also increases the risk of failure in synchronization of historical monitoring records. To this end, in some embodiments, the registration transaction is recorded in a message queue so that the monitoring platform executes the corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back the processing result of the historical monitoring record synchronization transaction to the message queue, including:
[0072] The registration transaction is recorded in a message queue so that the monitoring platform obtains the historical monitoring records of the reservoir area based on the reservoir area and equipment information in the registration transaction obtained from the message queue, generates a data link corresponding to the historical monitoring record and synchronizes it to the monitoring device corresponding to the equipment information, and feeds back the synchronization result of the data link to the message queue.
[0073] In some embodiments, when the monitoring platform obtains a certain registration transaction from the message queue, the reservoir area and equipment information in the registration transaction can be obtained, and then all monitoring records corresponding to the equipment type are obtained from the database as each target monitoring record according to the equipment type in the equipment information. After obtaining all monitoring records corresponding to the equipment type, the historical monitoring records of the reservoir area can be obtained from each target monitoring record according to the reservoir area in the registration transaction, and then all historical monitoring records are packaged to form a file recording all historical monitoring records, and a data link representing the network address of the file is generated to synchronize the data link to the monitoring device. In this way, the monitoring device can access the corresponding historical monitoring records through the data link after successful registration, thereby reducing the synchronization time of the historical monitoring records, thereby shortening the registration time of the monitoring device, improving the reliability of the synchronization of the historical monitoring records, and the registration efficiency of the monitoring device.
[0074] If the monitoring platform successfully synchronizes the data link to the monitoring device, it can generate a processing result indicating that the historical monitoring record synchronization transaction is successful; otherwise, it can generate a processing result indicating that the historical monitoring record synchronization transaction has failed. After generating the processing result of the historical monitoring record synchronization transaction, the monitoring platform can mark the registration transaction with the processing result and then feed it back to the message queue of the server, so that the server can obtain the registration transaction marked with the processing result of the historical monitoring record synchronization transaction from the message queue, so as to update the processing result of the historical monitoring record synchronization transaction to the processing result of the registration transaction.
[0075] In order to reduce repeated consumption of messages in the message queue, in some embodiments, after obtaining the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction from the message queue, the method further includes:
[0076] The registration transaction and the processing result of the historical monitoring record synchronization transaction are deleted from the message queue.
[0077] In some embodiments, when the server obtains a registration transaction marked with the processing results of a historical monitoring record synchronization transaction from the message queue, it means that the registration transaction has been consumed by the monitoring platform. At this time, the registration transaction and the processing results of the historical monitoring record synchronization transaction marked by it can be deleted from the message queue, so that the messages in the message queue will not be consumed repeatedly, and the reliability of the messages in the message queue can also be improved.
[0078] In order to reduce the impact of monitoring record synchronization on the registration of the monitoring device, in some embodiments, the method further includes:
[0079] Determine that the monitoring platform has not obtained the registration transaction in the message queue within a preset time period, delete the registration transaction from the message queue, update the processing result of the registration transaction to the failure of the registration transaction execution, and delete the device information and the corresponding reservoir area from the cache.
[0080] In some embodiments, after storing a registration transaction in a message queue, it is possible to detect whether the registration transaction is acquired by the monitoring platform within a preset time period. The preset time period can be set according to actual conditions, such as 15 seconds, 30 seconds, or 60 seconds. If it is detected that the registration transaction is not acquired by the monitoring platform within the preset time period, the registration transaction can be deleted from the message queue.
[0081] The processing result of the registration transaction is directly updated to the registration transaction execution failure, so as to avoid the registration result of the monitoring device being unable to be determined for a long time due to the registration transaction in the message queue not being consumed for a long time, and to avoid the registration transaction determined to be executed failed being mistakenly consumed by the monitoring platform, resulting in inconsistent processing results of the registration transaction and the historical monitoring record synchronization transaction. In addition, if it is detected that the registration transaction has not been obtained by the monitoring platform within the preset time, the device information and the corresponding reservoir area can also be deleted from the cache to avoid the device information of the monitoring device that failed to register and the reservoir area it monitors being mistakenly recorded, while reducing the storage pressure of the cache.
[0082] The following is a description of the reservoir monitoring data synchronization device provided in the present application. The reservoir monitoring data synchronization device described below and the reservoir monitoring data synchronization method described above can be referenced to each other.
[0083] In one embodiment, if Figure 3 As shown, a reservoir monitoring data synchronization device is provided, comprising:
[0084] The device registration module 210 is used to respond to a registration request of any monitoring device and execute a registration transaction of the monitoring device according to the device information of the monitoring device and the reservoir area monitored by the monitoring device;
[0085] The record synchronization module 220 is used to record the registration transaction to the message queue, so that the monitoring platform executes the corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back the processing result of the historical monitoring record synchronization transaction to the message queue;
[0086] The message update module 230 is used to obtain the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction from the message queue, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction;
[0087] Among them, the registration transaction includes caching the device information and the corresponding reservoir area, and the historical monitoring record synchronization transaction includes obtaining the historical monitoring records of the reservoir area according to the reservoir area and device information in the registration transaction, and synchronizing them to the monitoring device corresponding to the device information.
[0088] By responding to the registration request of any monitoring device, the registration transaction of the monitoring device is executed according to the device information of the monitoring device and the reservoir area monitored by the monitoring device, so as to record the registration transaction to the message queue, so that the monitoring platform executes the corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and after feeding back the processing result of the historical monitoring record synchronization transaction to the message queue, the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction is obtained from the message queue, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction. Since the processing result of the registration transaction is synchronized with the processing result of the historical monitoring record synchronization transaction, it is possible to avoid the situation where the monitoring device is successfully registered but the synchronization of the historical monitoring record fails, resulting in the monitoring device being unable to trigger the acquisition of the historical monitoring record again because the monitoring device has completed the registration, causing the monitoring device that has successfully registered to be unable to obtain the historical monitoring record, thereby improving the reliability of the synchronization of the historical monitoring record.
[0089] In one embodiment, the record synchronization module 220 is specifically used for:
[0090] Determine that the registration transaction is executed successfully, and record the registration transaction in the message queue.
[0091] In one embodiment, the message updating module 230 is specifically used for:
[0092] Determine that the processing result of the historical monitoring record synchronization transaction is that the historical monitoring record synchronization is successful, update the processing result of the registration transaction to that the registration transaction is successfully executed, and store the device information and the corresponding reservoir area from the cache to the disk storage.
[0093] In one embodiment, the message updating module 230 is specifically used for:
[0094] Determine that the processing result of the historical monitoring record synchronization transaction is the failure of the historical monitoring record synchronization, update the processing result of the registration transaction to the failure of the registration transaction execution, and delete the device information and the corresponding reservoir area from the cache.
[0095] In one embodiment, the record synchronization module 220 is specifically used for:
[0096] The registration transaction is recorded in a message queue so that the monitoring platform obtains the historical monitoring records of the reservoir area based on the reservoir area and equipment information in the registration transaction obtained from the message queue, generates a data link corresponding to the historical monitoring record and synchronizes it to the monitoring device corresponding to the equipment information, and feeds back the synchronization result of the data link to the message queue.
[0097] In one embodiment, the message updating module 230 is further configured to:
[0098] After obtaining the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction from the message queue, the registration transaction and the processing result of the historical monitoring record synchronization transaction are deleted from the message queue.
[0099] In one embodiment, the message updating module 230 is further configured to:
[0100] Determine that the monitoring platform has not obtained the registration transaction in the message queue within a preset time period, delete the registration transaction from the message queue, update the processing result of the registration transaction to the failure of the registration transaction execution, and delete the device information and the corresponding reservoir area from the cache.
[0101] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call a computer program in the memory 830 to execute a method for synchronizing monitoring data of a reservoir, for example, including:
[0102] In response to a registration request of any monitoring device, executing a registration transaction of the monitoring device according to device information of the monitoring device and a reservoir area monitored by the monitoring device;
[0103] Recording the registration transaction to a message queue, so that the monitoring platform executes a corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back a processing result of the historical monitoring record synchronization transaction to the message queue;
[0104] Obtaining, from the message queue, a processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so as to make the processing result of the registration transaction consistent with that of the historical monitoring record synchronization transaction;
[0105] Among them, the registration transaction includes caching the device information and the corresponding reservoir area, and the historical monitoring record synchronization transaction includes obtaining the historical monitoring records of the reservoir area according to the reservoir area and device information in the registration transaction, and synchronizing them to the monitoring device corresponding to the device information.
[0106] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0107] On the other hand, an embodiment of the present application further provides a storage medium, the storage medium includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the reservoir monitoring data synchronization method provided by the above embodiments, for example, including:
[0108] In response to a registration request of any monitoring device, executing a registration transaction of the monitoring device according to device information of the monitoring device and a reservoir area monitored by the monitoring device;
[0109] Recording the registration transaction to a message queue, so that the monitoring platform executes a corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back a processing result of the historical monitoring record synchronization transaction to the message queue;
[0110] Obtaining, from the message queue, a processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so as to make the processing result of the registration transaction consistent with that of the historical monitoring record synchronization transaction;
[0111] Among them, the registration transaction includes caching the device information and the corresponding reservoir area, and the historical monitoring record synchronization transaction includes obtaining the historical monitoring records of the reservoir area according to the reservoir area and device information in the registration transaction, and synchronizing them to the monitoring device corresponding to the device information.
[0112] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0113] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A reservoir monitoring data synchronization method, characterized in that: Applicable to servers, including: In response to a registration request of any monitoring device, executing a registration transaction of the monitoring device according to device information of the monitoring device and a reservoir area monitored by the monitoring device; Recording the registration transaction to a message queue, so that the monitoring platform executes a corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back the processing result of the historical monitoring record synchronization transaction to the message queue; Obtaining, from the message queue, a processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so as to make the processing result of the registration transaction consistent with that of the historical monitoring record synchronization transaction; Among them, the registration transaction includes caching the device information and the corresponding reservoir area, and the historical monitoring record synchronization transaction includes obtaining the historical monitoring records of the reservoir area according to the reservoir area and device information in the registration transaction, and synchronizing them to the monitoring device corresponding to the device information.
2. The reservoir monitoring data synchronization method according to claim 1, characterized in that: Recording the registration transaction to a message queue includes: Determine that the registration transaction is executed successfully, and record the registration transaction in the message queue.
3. The reservoir monitoring data synchronization method according to claim 1, characterized in that: According to the processing result of the historical monitoring record synchronization transaction, updating the processing result of the registration transaction so that the processing result of the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction, including: Determine that the processing result of the historical monitoring record synchronization transaction is that the historical monitoring record synchronization is successful, update the processing result of the registration transaction to that the registration transaction is successfully executed, and store the device information and the corresponding reservoir area from the cache to the disk storage.
4. The reservoir monitoring data synchronization method according to claim 1 or 3, characterized in that: According to the processing result of the historical monitoring record synchronization transaction, updating the processing result of the registration transaction so that the processing result of the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction, including: Determine that the processing result of the historical monitoring record synchronization transaction is the failure of the historical monitoring record synchronization, update the processing result of the registration transaction to the failure of the registration transaction execution, and delete the device information and the corresponding reservoir area from the cache.
5. The reservoir monitoring data synchronization method according to any one of claims 1 to 3, characterized in that: Recording the registration transaction to a message queue, so that the monitoring platform executes a corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeding back the processing result of the historical monitoring record synchronization transaction to the message queue, including: The registration transaction is recorded in a message queue so that the monitoring platform obtains the historical monitoring records of the reservoir area based on the reservoir area and equipment information in the registration transaction obtained from the message queue, generates a data link corresponding to the historical monitoring record and synchronizes it to the monitoring device corresponding to the equipment information, and feeds back the synchronization result of the data link to the message queue.
6. The reservoir monitoring data synchronization method according to any one of claims 1 to 3, characterized in that: After obtaining the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction from the message queue, the method further includes: The registration transaction and the processing result of the historical monitoring record synchronization transaction are deleted from the message queue.
7. The reservoir monitoring data synchronization method according to any one of claims 1 to 3, characterized in that: Also includes: Determine that the monitoring platform has not obtained the registration transaction in the message queue within a preset time period, delete the registration transaction from the message queue, update the processing result of the registration transaction to the failure of the registration transaction execution, and delete the device information and the corresponding reservoir area from the cache.
8. A reservoir monitoring data synchronization device, characterized in that: include: A device registration module, used to respond to a registration request of any monitoring device and execute a registration transaction of the monitoring device according to the device information of the monitoring device and the reservoir area monitored by the monitoring device; A record synchronization module, used to record the registration transaction to a message queue, so that the monitoring platform executes a corresponding historical monitoring record synchronization transaction according to the registration transaction obtained from the message queue, and feeds back the processing result of the historical monitoring record synchronization transaction to the message queue; A message update module, used to obtain the processing result of the historical monitoring record synchronization transaction corresponding to the registration transaction from the message queue, so as to update the processing result of the registration transaction according to the processing result of the historical monitoring record synchronization transaction, so that the registration transaction is consistent with the processing result of the historical monitoring record synchronization transaction; Among them, the registration transaction includes caching the device information and the corresponding reservoir area, and the historical monitoring record synchronization transaction includes obtaining the historical monitoring records of the reservoir area according to the reservoir area and device information in the registration transaction, and synchronizing them to the monitoring device corresponding to the device information.
9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the reservoir monitoring data synchronization method described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the reservoir monitoring data synchronization method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data processing method and device based on message queue middleware
CN110601903A
Message processing method and device
CN112822091A