Data asynchronous updating method and device based on message queue

文档序号:7558 发布日期:2021-09-17 浏览:27次 中文

1. A data asynchronous updating method based on a message queue is characterized by comprising the following steps:

the modeling service module receives a data updating instruction and determines initial data to be updated according to the data updating instruction;

the message service module writes the target data determined according to the initial data into a first message queue;

the cache service module reads the target data from the first message queue, loads the target data read from the first message queue into a predetermined memory, and the data loaded into the memory is used for being released to a display terminal for displaying;

and the library writing service module reads the target data from the first message queue and writes the target data read from the first message queue into a corresponding database.

2. The asynchronous update method of data based on message queue according to claim 1, wherein the message service module writes the target data determined according to the initial data into the first message queue, including:

performing preprocessing operation on the initial data determined by the modeling service module to obtain target data needing to be updated, and writing the target data into a first message queue;

wherein the preprocessing operation comprises at least one of a data checking operation, a data merging operation and a data locking operation.

3. The message queue-based asynchronous update method of data as claimed in claim 1, wherein the method further comprises:

and the undo redo service module constructs an undo message corresponding to the target data and writes the undo message corresponding to the target data into a pre-generated snapshot table.

4. The asynchronous update method of data based on message queue according to claim 3, wherein after the message service module writes the target data determined according to the initial data into the first message queue, the method further comprises:

the message service module sends a data updating prompt to the cache service module and/or the write library service module to prompt that data needing to be updated currently exists;

and after the cache service module reads the target data from the first message queue and loads the target data read from the first message queue into a predetermined memory, the method further includes:

and the cache service module publishes the target data in a vector slice mode.

5. The message queue-based asynchronous update method of data according to claim 3, further comprising:

the undo redo service module receives an undo redo instruction, reads undo reset data generated historically from the snapshot table according to the undo redo instruction, and sends the undo reset data to the message service module;

the message service module determines data to be changed according to the reset canceling data and writes the data to be changed into a second message queue;

the cache service module reads the data to be changed in the second message queue, loads the data to be changed increment read from the second message queue into a corresponding memory, and releases the data to be changed in a vector slice mode;

and the database writing service module reads the data to be changed in the second message queue and writes the data to be changed into the database.

6. The message queue-based asynchronous update method of data according to any of claims 1-5, characterized in that the method further comprises:

the work order completion service module receives a work order completion instruction sent by an external service, calls a completion script according to the work order completion instruction to operate the database so as to complete corresponding work order data to an operation state, and sends a first work order completion message to the message service module;

the message service module writes the first work order completion message into a third message queue;

the cache service module reads the first work order completion information in the third message queue, loads first work order completion data corresponding to the first work order completion information from the database, and issues the first work order completion data in a vector slice manner.

7. The message queue-based asynchronous update method of data according to any of claims 1-5, characterized in that the method further comprises:

the data synchronization service module executes the work order completion data synchronization operation and sends second work order completion information to the work order completion service module after receiving the synchronization completion indication message;

the work order completion service module sending the second work order completion message to the message service module;

the message service module writes the second work order completion information into a fourth message queue;

the cache service module reads the second order completion information in the fourth message queue, loads second order completion data corresponding to the second order completion information from the database, and issues the second order completion data in a vector slice format.

8. The asynchronous data updating method based on message queue according to claim 3, wherein before the undo redo service module constructs the undo message corresponding to the target data and writes the undo message corresponding to the target data into the pre-generated snapshot table, the method further comprises:

the redo withdrawing service module determines target information corresponding to the target data and judges whether the target data meet redo withdrawing conditions or not according to the target information;

and when the target data is judged to meet the withdrawal redo condition, the withdrawal redo service module executes the operation of constructing the withdrawal message corresponding to the target data and writing the withdrawal message corresponding to the target data into a pre-generated snapshot table.

9. The message queue-based asynchronous update method of data according to any of claims 1-5, characterized in that the method further comprises:

the fluency processing module acquires the processing duration of at least two target service modules in the target data updating process;

the fluency processing module calculates the update fluency of the target data according to the processing duration of each service module in the target data updating process and the influence degree of each service module in the target data updating process;

the fluency processing module judges whether the update fluency of the target data meets a preset update fluency condition, and when the update fluency of the target data meets the update fluency condition, generates an update flow table corresponding to the target data and sets the data attribute of the target data for the update flow table.

10. The data asynchronous updating device based on the message queue is characterized by comprising a modeling service module, a message service module, a cache service module and a write library service module, wherein:

the modeling service module is used for receiving a data updating instruction and determining initial data to be updated according to the data updating instruction;

the message service module is used for writing the target data determined according to the initial data into a first message queue;

the cache service module is configured to read the target data from the first message queue, load the target data read from the first message queue into a predetermined memory, and release the data loaded into the memory to a display terminal for display;

and the library writing service module is used for reading the target data from the first message queue and writing the target data read from the first message queue into a corresponding database.

Background

At present, a large amount of data is generated every day in a field (such as a power grid field) with a large number of users, the data includes but is not limited to submitted data, data to be modified and automatically acquired data, and related personnel can also actively access newly generated data according to actual needs or acquire the newly generated data in real time in a subscription manner.

In practical applications, newly generated data needs to be fetched after it is successfully written to the database and loaded into the cache. However, practice shows that the process of writing data into the database is slow, and related personnel use related terminals (such as modeling clients) to perform data updating, so that the data updating is blocked.

Disclosure of Invention

The technical problem to be solved by the present invention is to provide a method and an apparatus for asynchronously updating data based on a message queue, which can reduce the pause phenomenon during data updating and improve the data updating efficiency.

In order to solve the above technical problem, a first aspect of the present invention discloses a data asynchronous updating method based on a message queue, where the method includes:

the modeling service module receives a data updating instruction and determines initial data to be updated according to the data updating instruction;

the message service module writes the target data determined according to the initial data into a first message queue;

the cache service module reads the target data from the first message queue, loads the target data read from the first message queue into a predetermined memory, and the data loaded into the memory is used for being released to a display terminal for displaying;

and the library writing service module reads the target data from the first message queue and writes the target data read from the first message queue into a corresponding database.

As an optional implementation manner, in the first aspect of the present invention, the writing, by the message service module, target data determined according to the initial data into a first message queue includes:

performing preprocessing operation on the initial data determined by the modeling service module to obtain target data needing to be updated, and writing the target data into a first message queue;

wherein the preprocessing operation comprises at least one of a data checking operation, a data merging operation and a data locking operation.

As an alternative implementation, in the first aspect of the present invention, the method further includes:

and the undo redo service module constructs an undo message corresponding to the target data and writes the undo message corresponding to the target data into a pre-generated snapshot table.

As an optional implementation manner, in the first aspect of the present invention, after the message service module writes the target data determined according to the initial data into the first message queue, the method further includes:

the message service module sends a data updating prompt to the cache service module and/or the write library service module to prompt that data needing to be updated currently exists;

and after the cache service module reads the target data from the first message queue and loads the target data read from the first message queue into a predetermined memory, the method further includes:

and the cache service module publishes the target data in a vector slice mode.

As an alternative implementation, in the first aspect of the present invention, the method further includes:

the undo redo service module receives an undo redo instruction, reads undo reset data generated historically from the snapshot table according to the undo redo instruction, and sends the undo reset data to the message service module;

the message service module determines data to be changed according to the reset canceling data and writes the data to be changed into a second message queue;

the cache service module reads the data to be changed in the second message queue, loads the data to be changed increment read from the second message queue into a corresponding memory, and releases the data to be changed in a vector slice mode;

and the database writing service module reads the data to be changed in the second message queue and writes the data to be changed into the database.

As an alternative implementation, in the first aspect of the present invention, the method further includes:

the work order completion service module receives a work order completion instruction sent by an external service, calls a completion script according to the work order completion instruction to operate the database so as to complete corresponding work order data to an operation state, and sends a first work order completion message to the message service module;

the message service module writes the first work order completion message into a third message queue;

the cache service module reads the first work order completion information in the third message queue, loads first work order completion data corresponding to the first work order completion information from the database, and issues the first work order completion data in a vector slice manner.

As an alternative implementation, in the first aspect of the present invention, the method further includes:

the data synchronization service module executes the work order completion data synchronization operation and sends second work order completion information to the work order completion service module after receiving the synchronization completion indication message;

the work order completion service module sending the second work order completion message to the message service module;

the message service module writes the second work order completion information into a fourth message queue;

the cache service module reads the second order completion information in the fourth message queue, loads second order completion data corresponding to the second order completion information from the database, and issues the second order completion data in a vector slice format.

As an optional implementation manner, in the first aspect of the present invention, before the revocation service module constructs a revocation message corresponding to the target data and writes the revocation message corresponding to the target data into a pre-generated snapshot table, the method further includes:

the redo withdrawing service module determines target information corresponding to the target data and judges whether the target data meet redo withdrawing conditions or not according to the target information;

and when the target data is judged to meet the withdrawal redo condition, the withdrawal redo service module executes the operation of constructing the withdrawal message corresponding to the target data and writing the withdrawal message corresponding to the target data into a pre-generated snapshot table.

As an alternative implementation, in the first aspect of the present invention, the method further includes:

the fluency processing module acquires the processing duration of at least two target service modules in the target data updating process;

the fluency processing module calculates the update fluency of the target data according to the processing duration of each service module in the target data updating process and the influence degree of each service module in the target data updating process;

the fluency processing module judges whether the update fluency of the target data meets a preset update fluency condition, and when the update fluency of the target data meets the update fluency condition, generates an update flow table corresponding to the target data and sets the data attribute of the target data for the update flow table.

The invention discloses a data asynchronous updating device based on a message queue, which comprises a modeling service module, a message service module, a cache service module and a library writing service module, wherein:

the modeling service module is used for receiving a data updating instruction and determining initial data to be updated according to the data updating instruction;

the message service module is used for writing the target data determined according to the initial data into a first message queue;

the cache service module is configured to read the target data from the first message queue, load the target data read from the first message queue into a predetermined memory, and release the data loaded into the memory to a display terminal for display;

and the library writing service module is used for reading the target data from the first message queue and writing the target data read from the first message queue into a corresponding database.

As an optional implementation manner, in the second aspect of the present invention, a specific manner in which the message service module writes the target data determined according to the initial data into the first message queue includes:

performing preprocessing operation on the initial data determined by the modeling service module to obtain target data needing to be updated, and writing the target data into a first message queue;

wherein the preprocessing operation comprises at least one of a data checking operation, a data merging operation and a data locking operation.

As an optional implementation manner, in the second aspect of the present invention, the apparatus further includes a redo service revocation module, wherein:

and the undo and redo service module is used for constructing an undo message corresponding to the target data and writing the undo message corresponding to the target data into a pre-generated snapshot table.

As an optional implementation manner, in the second aspect of the present invention, the message service module is further configured to send a data update prompt to the cache service module and/or the write library service module after writing the target data determined according to the initial data into the first message queue, so as to prompt that data that needs to be updated currently exists;

and the cache service module is further configured to release the target data in a vector slice form after reading the target data from the first message queue and loading the target data read from the first message queue into a predetermined memory.

As an optional implementation manner, in the second aspect of the present invention, the undo redo service module is further configured to receive an undo redo instruction, read, according to the undo redo instruction, undo reset data that is generated historically from the snapshot table, and send the undo reset data to the message service module;

the message service module is further configured to determine data to be changed according to the revocation reset data, and write the data to be changed into a second message queue;

the cache service module is further configured to read the data to be changed in the second message queue, load the increment of the data to be changed read from the second message queue into a corresponding memory, and issue the data to be changed in a vector slice manner;

the database writing service module is further configured to read the data to be changed in the second message queue, and write the data to be changed in the database.

As an alternative embodiment, in the second aspect of the present invention, the apparatus further comprises a work order completion service module, wherein:

the work order completion service module is used for receiving a work order completion instruction sent by an external service, calling a completion script according to the work order completion instruction to operate the database so as to complete corresponding work order data to an operation state, and sending a first work order completion message to the message service module;

the message service module is further configured to write the first work order completion message into a third message queue;

the cache service module is further configured to read the first work order completion information in the third message queue, load first work order completion data corresponding to the first work order completion information from the database, and issue the first work order completion data in a vector slice manner.

As an optional implementation manner, in the second aspect of the present invention, the apparatus further includes a data synchronization service module, wherein:

the data synchronization service module is used for executing work order completion data synchronization operation and sending second work order completion information to the work order completion service module after receiving the synchronization completion indication message;

the work order completion service module is used for sending the second work order completion message to the message service module;

the message service module is further configured to write the second work order completion information into a fourth message queue;

the cache service module is further configured to read the second order completion information in the fourth message queue, load second order completion data corresponding to the second order completion information from the database, and issue the second order completion data in a vector slice format.

As an optional implementation manner, in the second aspect of the present invention, the revocation redo service module is further configured to, before constructing a revocation message corresponding to the target data and writing the revocation message corresponding to the target data into a pre-generated snapshot table, determine target information corresponding to the target data, determine whether the target data meets a revocation redo condition according to the target information, and when it is determined that the target data meets the revocation redo condition, trigger execution of the operation of constructing the revocation message corresponding to the target data and writing the revocation message corresponding to the target data into the pre-generated snapshot table.

As an alternative implementation, in the second aspect of the present invention, the apparatus further includes a fluency processing module, wherein:

the fluency processing module is used for acquiring the processing time of at least two target service modules in the target data updating process;

the fluency processing module is further used for calculating the update fluency of the target data according to the processing duration of each service module in the target data update process and the influence degree of each service module in the target data update process;

the fluency processing module is further configured to determine whether the update fluency of the target data meets a preset update fluency condition, and when it is determined that the update fluency of the target data meets the update fluency condition, generate an update flow table corresponding to the target data and set a data attribute of the target data for the update flow table.

The third aspect of the present invention discloses another asynchronous data updating device based on a message queue, which includes:

a memory storing executable program code;

a processor coupled with the memory;

the processor calls the executable program code stored in the memory to execute part or all of the steps of the message queue-based data asynchronous updating method disclosed by the first aspect of the invention.

In a fourth aspect of the present invention, a computer-readable storage medium is disclosed, which stores computer instructions for performing part or all of the steps of the message queue based data asynchronous update method disclosed in the first aspect of the present invention when the computer instructions are called.

Compared with the prior art, the embodiment of the invention has the following beneficial effects:

the modeling service module determines initial data needing to be updated according to the data updating instruction; the message service module writes target data determined by the initial data into a first message queue; the cache service module reads target data from the first message queue and loads the target data into the memory, and the data loaded into the memory is used for issuing; and the library writing service module writes the target data read from the first message queue into the database. Therefore, the method can receive the data through the message queue and persistently store the data to the local, avoids the process that the data is firstly written into the database, pushes the data to the cache service and releases the data by the cache service, reduces the process of directly reading the data from the database, and finally asynchronously writes the data into the database by the database writing service, reduces the data volume written into the database.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.

Fig. 1 is a schematic structural diagram of an architecture to which a message queue-based asynchronous data update method is applicable according to an embodiment of the present invention;

FIG. 2 is a schematic flow chart of a method for asynchronous update of data based on a message queue according to an embodiment of the present invention;

fig. 3 is a schematic flowchart of a undo/redo method based on a message queue according to an embodiment of the present invention;

FIG. 4 is a flow chart diagram illustrating a method for work order completion based on a message queue as disclosed in an embodiment of the present invention;

FIG. 5 is a flowchart illustrating a method for data synchronization based on a message queue according to an embodiment of the present invention;

fig. 6 is a schematic structural diagram of a data asynchronous updating apparatus based on a message queue according to an embodiment of the present invention;

FIG. 7 is a schematic structural diagram of another asynchronous message queue-based data updating apparatus according to an embodiment of the present disclosure;

fig. 8 is a schematic structural diagram of another asynchronous data updating apparatus based on a message queue according to an embodiment of the disclosure.

Detailed Description

In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

The terms "first," "second," and the like in the description and claims of the present invention and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, article, or article that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or article.

Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.

The invention discloses a data asynchronous updating method and device based on a message queue, which can receive data through the message queue and persistently store the data to the local, thereby avoiding the process that the data is firstly written into a database, pushing the data to a cache service and issuing the data by the cache service, reducing the process of directly reading the data from the database, and finally asynchronously writing the data into the database by a database writing service, reducing the data amount written into the database. The following are detailed below.

In order to better understand the message queue-based data asynchronous update method and apparatus described in the present invention, an architecture to which the method described in the present invention is applied is first described, and a specific architecture may be as shown in fig. 1, where fig. 1 is a schematic diagram of an architecture to which a message queue-based data asynchronous update method disclosed in an embodiment of the present invention is applied. As shown in fig. 1, the architecture may include at least an application server, and further, may further include a user terminal (e.g., a client) and/or a data server, where the client may be a modeling client and is responsible for front-end operation and viewing; the application server side comprises a modeling service, a redo canceling service, a caching service, a work order completion service, a message queue, a library writing service and a data synchronization service, and is responsible for processing a data updating instruction (such as an editing equipment instruction), processing a work order completion instruction, processing a redo canceling instruction, generating redo canceling data, writing a library of incremental data, issuing latest data and the like; the data server is responsible for executing data warehousing instructions and providing full data for the data service. Among these, DB1 and DB2 are two exemplary databases.

Furthermore, the modeling client may include a power grid equipment modeling function and a function of graphically displaying power grid data, and the power grid data editing and the power grid data displaying are realized by depending on the functions of the modeling service, the undo redo service and the cache service provided by the application server.

It can be seen that, the architecture described in fig. 1 can be synchronously written into the cache region when relevant personnel operate data at the front end, and when the result obtained by calculation is written into the persistent database, the result can be obtained by calculation in the memory through the service, so that the data in the cache region and the data in the physical database are ensured to be consistent, and the data required to be obtained by the operation interface is directly obtained from the cache region, thereby reducing the steps from the physical database to the cache region, improving the response time of the front-end operation interface for displaying the latest data, and further being beneficial to improving the efficiency of relevant personnel for obtaining the latest data. More specific flow and functional structure will be described in detail by the following examples.

Example one

Referring to fig. 2, fig. 2 is a flowchart illustrating a method for asynchronous data update based on a message queue according to an embodiment of the present invention. The method described in fig. 2 may be applied to an application server, and the application server may at least include a modeling service module, a message service module, a cache service module, and a library writing service module, which is not limited in the embodiment of the present invention. As shown in fig. 2, the asynchronous data update method based on the message queue may include the following operations:

201. and the modeling service module receives the data updating instruction and determines initial data needing to be updated according to the data updating instruction.

In the embodiment of the present invention, the data update instruction may specifically be an editing device instruction, which is generated after a user uses a modeling client to trigger an operation of an editing device, and the modeling client sends the generated editing device instruction to the modeling service module. Specifically, the modeling service module responds to the operation of the editing device after receiving the instruction of the editing device, generates the changed device data as the initial data needing to be updated, and sends the initial data needing to be updated to the message service module.

202. And the message service module writes the target data determined according to the initial data into the first message queue.

Optionally, after the target data is written into the first message queue, the message service module may send a notification message to the modeling client indicating that the updated data has been written.

203. The cache service module reads the target data from the first message queue, loads the target data read from the first message queue into a predetermined memory, and the data loaded into the memory is used for being released to a display terminal for displaying.

Optionally, the data loaded into the memory (i.e., the latest grid data) can be specifically released by the cache service module in the form of vector slices.

204. And the library writing service module reads the target data from the first message queue and writes the target data read from the first message queue into the corresponding database.

Optionally, the database writing service module may perform data verification on the target data after reading the target data from the first message queue, and write the target data into the corresponding database after the verification is passed, which is beneficial to improving the security and the validity of the data written into the database.

It can be seen that, by implementing the method described in fig. 1, data can be received through the message queue and persistently stored locally, a process that the data is written into the database first is avoided, the data is also pushed to the cache service and issued by the cache service, a process of directly reading the data from the database is reduced, and finally the data is asynchronously written into the database by the database writing service, so that the data amount written into the database is reduced.

In an optional embodiment, the writing, by the message service module, the target data determined according to the initial data into the first message queue includes:

and performing preprocessing operation on the initial data determined by the modeling service module to obtain target data needing to be updated, and writing the target data into the first message queue.

The preprocessing operation may include at least one of a data checking operation, a data merging operation, and a data locking operation.

Therefore, in the optional embodiment, before writing the data to be updated into the message queue, the accuracy of the data written into the message queue can be improved by performing the data checking operation, the data amount written into the message queue can be reduced by performing the data merging operation, and the accuracy and efficiency of the data written into the message queue can be improved by performing the data locking operation.

In another optional embodiment, the method may further comprise the operations of:

and the undo redo service module constructs an undo message corresponding to the target data and writes the undo message corresponding to the target data into a pre-generated snapshot table.

Further optionally, after writing the target data determined according to the initial data into the first message queue, the message service module may further send a prompt message to the undo redo service module to prompt that the data which needs to be updated currently exists, so as to facilitate the undo redo service module to construct a corresponding undo message timely and quickly.

It can be seen that this alternative embodiment can construct a corresponding Undo (Undo) message by the Undo redo service module after the data that needs to be updated is written into the message queue, and can further provide for a quick response to a Undo redo instruction triggered by a user through a modeling client.

In yet another optional embodiment, after the message service module writes the target data determined according to the initial data into the first message queue, the method further includes the following operations:

and the message service module sends a data updating prompt to the cache service module and/or the library writing service module to prompt that the data needing to be updated currently exists.

In other alternative embodiments, the data update hint may also be sent directly from the message queue to the cache service module and/or the write bank service module.

As can be seen, in this alternative embodiment, after the message service module writes the target data determined according to the initial data into the first message queue, the update prompt is sent to the cache service module and/or the write library service module, so as to improve the response speed of the cache service module and/or the write library service module.

In yet another alternative embodiment, the method may further include the operations of:

after reading the target data from the first message queue and loading the target data read from the first message queue into the predetermined memory, the method may further include the following operations:

the cache service module publishes the target data in the form of vector slices.

Therefore, the optional embodiment can directly issue the latest data by the cache service module, so that the process of directly reading data from the database is reduced, the reading and writing pressure of the database is reduced, and the response time of issuing the latest data is prolonged.

Still further optionally, the method may further include at least one of a message queue-based undo flow, a message queue-based work order completion flow, and a message queue-based data synchronization flow, which is not limited in the embodiments of the present invention. Specifically, the undo and redo flow based on the message queue, the work order completion flow based on the message queue, and the data synchronization flow based on the message queue may specifically refer to the detailed descriptions of the second to fourth embodiments, respectively. It should be noted that the undo and redo flow based on the message queue, the work order completion flow based on the message queue, and the data synchronization flow based on the message queue may also be laid out as separate embodiments.

In yet another optional embodiment, before the undo redo service module constructs an undo message corresponding to the target data and writes the undo message corresponding to the target data into the pre-generated snapshot table, the method may further include the following operations:

the redo withdrawing service module determines target information corresponding to the target data and judges whether the target data meet redo withdrawing conditions or not according to the target information;

and when the target data is judged to meet the withdrawal redo condition, the withdrawal redo service module executes the withdrawal message corresponding to the constructed target data, and writes the withdrawal message corresponding to the target data into a pre-generated snapshot table.

Optionally, the target information corresponding to the target data may include one or more of trigger personnel information for triggering target data to be updated, an importance level of the target data, an emergency degree of the target data, a historical update frequency of the target data, a security level of the target data, and the like.

Therefore, the optional embodiment can intelligently judge whether the target data meets the withdrawal redo condition after the update data is written into the message queue and before the corresponding withdrawal message is constructed, and if the target data meets the withdrawal redo condition, the withdrawal message is constructed again, so that unnecessary withdrawal message construction operations of the withdrawal redo service module can be reduced.

In yet another alternative embodiment, the method may further include the operations of:

the fluency processing module acquires the processing duration of at least two target service modules in the target data updating process;

the fluency processing module calculates the update fluency of the target data according to the processing duration of each service module in the target data updating process and the influence degree of each service module in the target data updating process;

the fluency processing module judges whether the update fluency of the target data meets a preset update fluency condition, and when the update fluency of the target data meets the update fluency condition, generates an update flow table corresponding to the target data and sets a data attribute of the target data for the update flow table.

Therefore, the optional embodiment can also comprehensively calculate the updating fluency of the data updating according to the processing duration of each service module in the data updating process and the influence degree of each service module in the data updating process after the data updating, and is favorable for improving the accuracy of the calculated updating fluency. In addition, when the update fluency of the current update data is judged to meet the update fluency condition, a corresponding update flow table is generated, and the data attribute of the target data is set for the update flow table, so that an update flow basis is provided for other data with the same or similar attributes during updating, and the update fluency of other data with the same or similar attributes during updating is improved.

Example two

Referring to fig. 3, fig. 3 is a flowchart illustrating a undo/redo method based on a message queue according to an embodiment of the present invention. The method described in fig. 3 may be applied to an application server, and the application server may at least include a undo redo service module, a message service module, a cache service module, and a library writing service module, and further may further include a modeling service module and/or a fluency processing module, which is not limited in the embodiment of the present invention. As shown in fig. 3, the message queue based undo redo method may include the following operations:

301. and the undo redo service module receives the undo redo command, reads the undo reset data generated historically from the snapshot table according to the undo redo command, and sends the undo reset data to the message service module.

In the embodiment of the present invention, the redo command cancellation may be triggered by the user through the modeling client according to actual requirements after triggering the data update command.

302. And the message service module determines the data to be changed according to the reset canceling data and writes the data to be changed into the second message queue.

Optionally, the determining, by the message service module, the data to be changed according to the revocation reset data may include:

and the message service module executes corresponding preprocessing operation on the reset data to obtain the data to be changed.

Optionally, the preprocessing operation may specifically include one or a combination of multiple data checking operations, data merging operations, and data locking/unlocking operations.

Optionally, the message service module feeds back a data write completion notification message to the modeling client after writing the data to be changed into the second message queue.

Optionally, after the message service module writes the data to be changed into the second message queue, the message service module may further send a data update prompt to the cache service module and/or the write library service module.

In other alternative embodiments, the data update hint may also be sent directly from the message queue to the cache service module and/or the write bank service module.

303. And the cache service module reads the data to be changed in the second message queue, loads the data increment to be changed read from the second message queue into a corresponding memory, and releases the data to be changed in a vector slice mode.

304. And the database writing service module reads the data to be changed in the second message queue and writes the data to be changed into the database.

Optionally, after the database writing service module reads the data to be changed in the second message queue, the data to be changed may be checked first, and the data to be changed is written into the database after the check is passed.

It should be noted that, for other descriptions of the message service module, the cache service module, the library writing service module, the modeling service module, and the fluency processing module, please refer to the detailed description in the first embodiment, which is not repeated herein.

Therefore, the method described by the embodiment of the invention can provide data undo and redo service, so that relevant personnel can trigger the undo and redo command through the modeling client according to actual needs, and the pre-generated snapshot table can improve the response speed for the undo and redo command.

EXAMPLE III

Referring to fig. 4, fig. 4 is a flowchart illustrating a method for completing a work order based on a message queue according to an embodiment of the present invention. The method described in fig. 4 may be applied to an application server, and the application server may include at least a work order completion service module, a message service module, a cache service module, and a library writing service module, and further may include at least one of a modeling service module, a undo redo service module, and a fluency processing module, which is not limited in the embodiment of the present invention. As shown in fig. 4, the message queue-based work order completion method may include the operations of:

401. the work order completion service module receives a work order completion instruction sent by an external service, calls a completion script operation database according to the work order completion instruction to complete corresponding work order data to an operating state, and sends a first work order completion message to the message service module.

In the embodiment of the invention, the work order completion service module calls the completion script operation database according to the work order completion instruction to complete the corresponding work order data to the operating state, and further releases the data locked by the locking editing equipment instruction.

402. The message service module writes the first work order completion message in a third message queue.

Optionally, after the message service module writes the first work order completion message into the third message queue, the message service module may further notify the cache service module. In other alternative embodiments, the message service module may also notify the cache service module directly from the message queue after the first work order completion message is written into the third message queue.

403. The cache service module reads the first work order completion information in the third message queue, loads first work order completion data corresponding to the first work order completion information from the database, and issues the first work order completion data in a vector slice mode.

Optionally, the work order completion service module may also feed back an completion prompt to the external service.

It should be noted that, for other descriptions of the message service module, the cache service module, the library writing service module, the modeling service module, and the fluency processing module, please refer to the detailed description in the first embodiment, which is not repeated herein.

Therefore, the method provided by the embodiment of the invention provides the work order completion service based on the message queue, not only enriches the functions of the application server, but also can realize quick and accurate response to the external service.

Example four

Referring to fig. 5, fig. 5 is a flowchart illustrating a data synchronization method based on a message queue according to an embodiment of the present invention. The method described in fig. 5 may be applied to an application server, and the application server may include at least a data synchronization service module, a work order completion service module, a message service module, a cache service module, and a library writing service module, and further may include at least one of a modeling service module, a undo redo service module, and a fluency processing module, which is not limited in the embodiment of the present invention. As shown in fig. 5, the message queue-based data synchronization method may include the following operations:

501. the data synchronization service module executes the work order completion data synchronization operation, and transmits second work order completion information to the work order completion service module after receiving the synchronization completion indication message.

502. The work order completion service module sends a second work order completion message to the message service module.

503. The message service module writes the second work order completion information into a fourth message queue.

504. The cache service module reads the second work order completion information in the fourth message queue, loads second work order completion data corresponding to the second work order completion information from the database, and issues the second work order completion data in a vector slice manner.

It should be noted that, for other descriptions of the message service module, the cache service module, the library writing service module, the modeling service module, and the fluency processing module, please refer to the detailed description in the first embodiment, which is not repeated herein.

Therefore, the method provided by the embodiment of the invention provides the data synchronization service based on the message queue, not only enriches the functions of the application server, but also can realize the synchronization of the work order completion data among the databases, and ensures the consistency of the work order completion data among the databases.

EXAMPLE five

Referring to fig. 6, fig. 6 is a schematic structural diagram of a data asynchronous update device based on a message queue according to an embodiment of the present invention. The apparatus described in fig. 6 may be applied to an application server. As shown in fig. 6, the apparatus may include:

the modeling service module 601 is configured to receive a data update instruction, and determine initial data to be updated according to the data update instruction;

a message service module 602, configured to write target data determined according to the initial data into a first message queue;

the cache service module 603 is configured to read target data from the first message queue, load the target data read from the first message queue into a predetermined memory, and use the data loaded into the memory to be published to a display terminal for display;

and the library writing service module 604 is configured to read the target data from the first message queue, and write the target data read from the first message queue into the corresponding database.

It can be seen that, the implementation of the apparatus described in fig. 6 can receive data through the message queue and persistently store the data to the local, thereby avoiding the process of writing the data into the database first, pushing the data to the cache service and issuing the data by the cache service, reducing the process of directly reading the data from the database, and finally asynchronously writing the data into the database by the database writing service, reducing the data amount written into the database.

In an optional embodiment, a specific manner for the message service module 602 to write the target data determined according to the initial data into the first message queue includes:

and executing preprocessing operation on the initial data determined by the modeling service module 601 to obtain target data needing to be updated, and writing the target data into the first message queue.

The preprocessing operation comprises at least one of a data checking operation, a data merging operation and a data locking operation.

Therefore, in the optional embodiment, before writing the data to be updated into the message queue, the accuracy of the data written into the message queue can be improved by performing the data checking operation, the data amount written into the message queue can be reduced by performing the data merging operation, and the accuracy and efficiency of the data written into the message queue can be improved by performing the data locking operation.

In another alternative embodiment, as shown in fig. 7, the apparatus may further include:

the undo redo service module 605 is configured to construct an undo message corresponding to the target data, and write the undo message corresponding to the target data into a pre-generated snapshot table.

It can be seen that this alternative embodiment can construct a corresponding Undo (Undo) message by the Undo redo service module after the data that needs to be updated is written into the message queue, and can further provide for a quick response to a Undo redo instruction triggered by a user through a modeling client.

In yet another optional embodiment, the message service module 602 is further configured to send a data update prompt to the cache service module 603 and/or the write library service module 604 after writing the target data determined according to the initial data into the first message queue, so as to prompt that there is currently data that needs to be updated.

As can be seen, in this alternative embodiment, after the message service module writes the target data determined according to the initial data into the first message queue, the update prompt is sent to the cache service module and/or the write library service module, so as to improve the response speed of the cache service module and/or the write library service module.

In yet another optional embodiment, the cache service module 603 is further configured to publish the target data in the form of vector slices after reading the target data from the first message queue and loading the target data read from the first message queue into a predetermined memory.

Therefore, the optional embodiment can directly issue the latest data by the cache service module, so that the process of directly reading data from the database is reduced, the reading and writing pressure of the database is reduced, and the response time of issuing the latest data is prolonged.

In yet another alternative embodiment, the undo redo service module 605 is further configured to receive an undo redo instruction, read the historically generated undo reset data from the snapshot table according to the undo redo instruction, and send the undo reset data to the message service module 602;

the message service module 602 is further configured to determine data to be changed according to the reset cancellation data, and write the data to be changed into the second message queue;

the cache service module 603 is further configured to read data to be changed in the second message queue, load the increment of the data to be changed read from the second message queue into a corresponding memory, and issue the data to be changed in a vector slice manner;

the library writing service module 604 is further configured to read the data to be changed in the second message queue, and write the data to be changed into the database.

Therefore, the optional embodiment can also provide data undo and redo service, so that relevant personnel can trigger the undo and redo instruction through the modeling client according to actual needs, and the pre-generated snapshot table can improve the response speed for the undo and redo instruction.

In yet another alternative embodiment, as shown in fig. 7, the apparatus may further include:

a work order completion service module 606 for receiving a work order completion instruction sent by an external service, calling a completion script operation database according to the work order completion instruction to complete corresponding work order data to an operational state, and sending a first work order completion message to the message service module 602;

the message service module 602 is further configured to write the first work order completion message into a third message queue;

the cache service module 603 is further configured to read the first work order completion information in the third message queue, load the first work order completion data corresponding to the first work order completion information from the database, and issue the first work order completion data in a vector slice manner.

Therefore, the optional embodiment also provides a work order completion service based on the message queue, so that the functions of the application server are enriched, and quick and accurate response to external services can be realized.

In yet another alternative embodiment, as shown in fig. 7, the apparatus may further include:

a data synchronization service module 607 for performing a work order completion data synchronization operation and transmitting second work order completion information to the work order completion service module after receiving the synchronization completion instruction message;

a work order completion service module 606, further configured to send a second work order completion message to the message service module 602;

the message service module 602 is further configured to write the second work order completion information into a fourth message queue;

the cache service module 603 is further configured to read the second work order completion information in the fourth message queue, load second work order completion data corresponding to the second work order completion information from the database, and issue the second work order completion data in a vector slice manner.

Therefore, the optional embodiment also provides a data synchronization service based on the message queue, not only enriches the functions of the application server, but also can realize the synchronization of the work order completion data among the databases, and ensures the consistency of the work order completion data among the databases.

In yet another optional embodiment, the revocation redo service module 605 is further configured to, before constructing a revocation message corresponding to the target data and writing the revocation message corresponding to the target data into the pre-generated snapshot table, determine target information corresponding to the target data, determine whether the target data meets a revocation redo condition according to the target information, and when it is determined that the target data meets the revocation redo condition, trigger execution of the operation of constructing the revocation message corresponding to the target data and writing the revocation message corresponding to the target data into the pre-generated snapshot table.

Therefore, the optional embodiment can intelligently judge whether the target data meets the withdrawal redo condition after the update data is written into the message queue and before the corresponding withdrawal message is constructed, and if the target data meets the withdrawal redo condition, the withdrawal message is constructed again, so that unnecessary withdrawal message construction operations of the withdrawal redo service module can be reduced.

In yet another alternative embodiment, as shown in fig. 7, the apparatus may further include a fluency processing module 608, wherein:

the fluency processing module 608 is configured to obtain processing durations of the at least two target service modules in a target data updating process;

the fluency processing module 608 is further configured to calculate an update fluency of the target data according to a processing duration of each service module in the target data update process and an influence degree of each service module in the target data update process;

the fluency processing module 608 is further configured to determine whether the update fluency of the target data meets a preset update fluency condition, and when it is determined that the update fluency of the target data meets the update fluency condition, generate an update flow table corresponding to the target data and set a data attribute of the target data for the update flow table.

It can be seen that, by implementing the apparatus described in fig. 7, after data update, the update fluency of the current update data can be comprehensively calculated according to the processing duration of each service module in the data update process and the influence degree of each service module in the data update process, which is beneficial to improving the accuracy of the calculated update fluency. In addition, when the update fluency of the current update data is judged to meet the update fluency condition, a corresponding update flow table is generated, and the data attribute of the target data is set for the update flow table, so that an update flow basis is provided for other data with the same or similar attributes during updating, and the update fluency of other data with the same or similar attributes during updating is improved.

EXAMPLE six

Referring to fig. 8, fig. 8 is a schematic structural diagram of another asynchronous data updating apparatus based on a message queue according to an embodiment of the disclosure. The apparatus described in fig. 8 may be applied in an application server. As shown in fig. 8, the apparatus may include:

a memory 701 in which executable program code is stored;

a processor 702 coupled to the memory 701;

the processor 702 calls the executable program code stored in the memory 701 to execute the steps of the method described in any one of the first to fourth embodiments of the present invention.

EXAMPLE seven

The embodiment of the invention discloses a computer storage medium, which stores computer instructions, and the computer instructions are used for executing the steps of the method described in any one of the first embodiment to the fourth embodiment of the invention when being called.

Example eight

The embodiment of the invention discloses a computer program product, which comprises a non-transitory computer readable storage medium storing a computer program, wherein the computer program is operable to make a computer execute the steps of the method described in any one of the first embodiment to the fourth embodiment of the invention.

The above-described embodiments of the apparatus are merely illustrative, and the modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.

Through the above detailed description of the embodiments, those skilled in the art will clearly understand that the embodiments may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. Based on such understanding, the above technical solutions may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, where the storage medium includes a Read-Only Memory (ROM), a Random Access Memory (RAM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), a One-time Programmable Read-Only Memory (OTPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc-Read-Only Memory (CD-ROM), or other disk memories, CD-ROMs, or other magnetic disks, A tape memory, or any other medium readable by a computer that can be used to carry or store data.

Finally, it should be noted that: the data asynchronous updating device and device based on message queue disclosed in the embodiments of the present invention are only the preferred embodiments of the present invention, and are only used for illustrating the technical solutions of the present invention, not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art; the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:资源更新方法及装置、电子设备、存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!