Coroutine-based message synchronization method, device, equipment and storage medium

By adopting coroutial -based message synchronization methods in the server -side software architecture, the problem of poor flexibility and reliability in the existing technology synchronization mode in the existing technology, and realized the low latency and high reliability of the message transmission, which improved The overall performance and maintenance of the system.

CN118714148BActive Publication Date: 2025-01-28GUANGZHOU BAOLUN ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411199259.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2025-01-28
Estimated Expiration
2044-08-29

AI Technical Summary

Technical Problem

In the prior art, the message synchronization mode of the server-side software architecture has problems such as poor flexibility, reliability and availability, especially in microservice architectures, network latency and communication overhead lead to performance impacts, and data consistency management is complex.

Method used

Adopting coroutial -based message synchronization methods, the identity verification is used to treat the synchronous message through the core of the message synchronization, and the passing message is not asynchronous to the routing management module for a routing verification. Request content to ensure that each module performs actual operation only when necessary.

Benefits of technology

Improving the low latency and reliability of message transmission, ensuring the synchronous transmission and processing of the message between the modules, and enhancing the reliability and maintenance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118714148B_ABST
    Figure CN118714148B_ABST
Patent Text Reader

Abstract

The message synchronization method, device, equipment and storage medium based on coroutine provided by the present invention receive the message to be synchronized sent by the message source module; perform identity verification on the message to be synchronized by the message synchronization core; send the message to be synchronized that passes the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized; send the verification result that passes the routing verification to the target synchronization module corresponding to the target synchronization module identifier, so that the target synchronization module can execute the request content. The present invention ensures the synchronous transmission and processing of messages between modules, ensures the verification and forwarding process of requests, and ensures that each module performs actual operations only when necessary. Through strict verification and forwarding mechanisms, the reliability and maintainability of the system can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data transmission, and in particular to a message synchronization method, device, equipment and storage medium based on coroutine. Background Art

[0002] The existing server-side software architecture and its message synchronization mode are mainly traditional monolithic-based thread-level or memory-level message synchronization and microservice-based RPC or HTTP message synchronization.

[0003] Monolithic software architecture, in complex business scenarios, each functional module is tightly coupled, resulting in poor system flexibility. The failure of a functional module may cause the entire system to be unavailable, affecting the reliability and availability of the system. As the system functions increase, the code base becomes huge, making maintenance and expansion difficult.

[0004] Microservice software architecture, communication between microservices is usually carried out through the network, which may cause network delays and communication overhead, affecting performance. Network communication may cause packet loss, timeouts and other problems. Transaction management between microservices is relatively complex, and data consistency requires the use of distributed transactions or eventual consistency solutions. Each service may have an independent database, which makes data synchronization and management complicated. Integration testing and end-to-end testing are more difficult, and it is necessary to simulate the interactions and dependencies of multiple microservices.

[0005] In summary, the problems existing in the prior art need to be solved urgently. Summary of the invention

[0006] The present invention provides a message synchronization method, device, equipment and storage medium based on coroutine, which are used to solve the defects in the prior art and improve the low latency and reliability of message transmission.

[0007] The present invention provides a message synchronization method based on coroutine, comprising:

[0008] Receive a message to be synchronized sent by a message source module, wherein the message to be synchronized includes a request body identifier, a target synchronization module identifier, and a request content;

[0009] Performing identity verification on the message to be synchronized by the message synchronization core, wherein the identity verification is determined based on the request body identifier;

[0010] Sending the message to be synchronized that has passed the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized, wherein the routing verification is determined based on the request body identifier;

[0011] The verification result that passes the route verification is sent to the target synchronization module corresponding to the target synchronization module identifier, so that the target synchronization module executes the request content, and the verification result includes the request body identifier, the target synchronization module identifier, the request content and the execution method.

[0012] According to a coroutine-based message synchronization method provided by the present invention, after the step of performing identity verification on the message to be synchronized by the message synchronization core, the method further includes:

[0013] When the identity verification of the message to be synchronized fails, an identity verification failure result is generated, and the identity verification failure result is returned to the message source module.

[0014] According to a coroutine-based message synchronization method provided by the present invention, the step of sending the message to be synchronized that has passed the identity verification to the routing management module specifically includes:

[0015] Through the coroutine, the to-be-synchronized messages that have passed the identity verification are asynchronously sent to the routing management module.

[0016] According to a coroutine-based message synchronization method provided by the present invention, after the step of sending the message to be synchronized that has passed the identity verification to the routing management module so that the routing management module performs routing verification on the message to be synchronized, the method further includes:

[0017] When the routing verification of the message to be synchronized fails, a routing verification failure result is generated, and the routing verification failure result is sent to the message source module through the message synchronization core.

[0018] According to a coroutine-based message synchronization method provided by the present invention, after sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content, the method further includes:

[0019] Obtaining the execution result of the target synchronization module;

[0020] Inputting the execution result into a result evaluation model to obtain a message synchronization correction instruction;

[0021] The message synchronization correction instruction is sent to the routing management module, so that the routing management module controls the target synchronization module to execute the message synchronization correction instruction.

[0022] According to a coroutine-based message synchronization method provided by the present invention, after sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content, the method further includes:

[0023] Get thread crash signal;

[0024] According to the thread crash signal, the corresponding crashed thread is closed, and a thread recovery program is generated.

[0025] According to a coroutine-based message synchronization method provided by the present invention, after sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content, the method further includes:

[0026] Generate log files for the message synchronization core and the routing management module;

[0027] The log file is used to record the execution results of the message synchronization core and the routing management module.

[0028] The present invention also provides a message synchronization device based on a coroutine, comprising:

[0029] A message receiving module, used for receiving a message to be synchronized sent by a message source module, wherein the message to be synchronized includes a request body identifier, a target synchronization module identifier and a request content;

[0030] An identity verification module, used for performing identity verification on the message to be synchronized through a message synchronization core, wherein the identity verification is determined based on the request body identifier;

[0031] A routing verification module, used for sending the message to be synchronized that has passed the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized, wherein the routing verification is determined based on the request body identifier;

[0032] A message synchronization module is used to send the verification result that passes the routing verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module can execute the request content. The verification result includes a request body identifier, a target synchronization module identifier, a request content and an execution method.

[0033] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the message synchronization method based on coroutine as described above is implemented.

[0034] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the coroutine-based message synchronization method described in any one of the above is implemented.

[0035] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method for message synchronization based on coroutine as described above is implemented.

[0036] The message synchronization method, device, equipment and storage medium based on coroutine provided by the present invention receive the message to be synchronized sent by the message source module; perform identity verification on the message to be synchronized by the message synchronization core; send the message to be synchronized that passes the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized; send the verification result that passes the routing verification to the target synchronization module corresponding to the target synchronization module identifier, so that the target synchronization module can execute the request content. The present invention ensures the synchronous transmission and processing of messages between modules, ensures the verification and forwarding process of requests, and ensures that each module performs actual operations only when necessary. Through strict verification and forwarding mechanisms, the reliability and maintainability of the system can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 It is a flowchart of the message synchronization method based on coroutine provided by the present invention;

[0039] Figure 2 It is a signaling diagram of the coroutine-based message synchronization method provided by the present invention;

[0040] Figure 3 It is a structural schematic diagram of a message synchronization device based on coroutine provided by the present invention;

[0041] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0043] In order to solve the problems in the prior art, the present invention proposes a message synchronization method based on coroutines to improve the low latency and reliability of message transmission. The message synchronization method based on coroutines is described below. Figure 1 As shown, including but not limited to the following steps:

[0044] Step 110: Receive a message to be synchronized sent by a message source module, wherein the message to be synchronized includes a request body identifier, a target synchronization module identifier, and request content.

[0045] In step 110, after the message source module (ie, the module requesting to communicate with the target synchronization module) encapsulates the message to be synchronized, it transmits the message to the message synchronization core by calling the asynchronous sending method. The message to be synchronized includes the request body identifier, the target synchronization module identifier, and the request content.

[0046] In this process, the coroutine is used to asynchronously process the message receiving operation, so that the message source module can continue to perform other tasks while waiting for a response, improving the concurrent processing capability of the system.

[0047] Step 120: Perform identity verification on the message to be synchronized through the message synchronization core, wherein the identity verification is determined based on the request body identifier.

[0048] In step 120, after receiving the message to be synchronized, the message synchronization core first uses a coroutine to asynchronously perform identity verification. The identity verification is performed based on the request body identifier to ensure the legitimacy of the message source. The use of coroutines enables the message synchronization core to process identity verification operations for multiple messages in parallel, avoiding blocking the operation of the entire system due to a single verification operation, and improving verification efficiency.

[0049] Step 130: Send the message to be synchronized that has passed the identity verification to the routing management module, so that the routing management module performs routing verification on the message to be synchronized, and the routing verification is determined based on the request body identifier.

[0050] In step 130, the message that passes the identity verification will be asynchronously forwarded by the message synchronization core to the routing management module. The routing management module is responsible for further verifying the routing information of the message.

[0051] By asynchronously executing the message forwarding operation through the coroutine, the message synchronization core can continue to receive and process other messages to be synchronized, ensuring low latency of message processing.

[0052] Step 140: Send the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content. The verification result includes the request body identifier, the target synchronization module identifier, the request content and the execution method.

[0053] In step 140, after receiving the message to be synchronized, the routing management module uses a coroutine to asynchronously perform routing verification. The routing verification is performed based on the request body identifier to confirm whether the target synchronization module of the message has been registered.

[0054] For messages that pass the routing verification, the routing management module will carry the verification results (including the request body identifier, the target synchronization module identifier, the request content and the execution method) and asynchronously forward the message to the target synchronization module.

[0055] After receiving the message, the target synchronization module asynchronously parses the request content through the coroutine and executes the corresponding business logic operations, such as database operations, logging, and alarm processing.

[0056] The role of coroutines in the entire process is as follows:

[0057] Asynchronous reception and sending of messages: In the process of receiving, forwarding, and returning messages, coroutines are used to implement asynchronous operations to ensure low latency in message processing.

[0058] Parallel processing: The identity verification and routing verification operations of multiple messages are processed in parallel by coroutines to improve the concurrent processing capability and efficiency of the system.

[0059] Maximizing resource utilization: Coroutines allow switching to other tasks while waiting for I / O operations or other time-consuming operations, thereby maximizing the use of CPU resources and avoiding waste of system resources.

[0060] The message synchronization method based on coroutine provided by the present invention receives the message to be synchronized sent by the message source module; performs identity verification on the message to be synchronized by the message synchronization core; sends the message to be synchronized that passes the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized; sends the verification result that passes the routing verification to the target synchronization module corresponding to the target synchronization module identifier, so that the target synchronization module can execute the request content. The present invention ensures the synchronous transmission and processing of messages between various modules, ensures the verification and forwarding process of requests, and ensures that each module performs actual operations only when necessary. Through strict verification and forwarding mechanisms, the reliability and maintainability of the system can be effectively improved.

[0061] As a further optional embodiment, after the step of performing identity verification on the message to be synchronized by the message synchronization core, the method further includes:

[0062] When the identity verification of the message to be synchronized fails, an identity verification failure result is generated, and the identity verification failure result is returned to the message source module.

[0063] refer to Figure 2 When the identity verification of the message to be synchronized fails, the message synchronization core generates an identity verification failure result and returns the result to the message source module asynchronously through the coroutine. The failure result includes the error message "Source module is not registered". Using the coroutine to asynchronously return the failure result can ensure that the message synchronization core does not affect the processing of other messages when processing the failed message, further improving the system's response speed and concurrent processing capabilities.

[0064] As a further optional embodiment, the step of sending the to-be-synchronized message that has passed the identity verification to the routing management module specifically includes:

[0065] Through the coroutine, the to-be-synchronized messages that have passed the identity verification are asynchronously sent to the routing management module.

[0066] In this embodiment, the to-be-synchronized messages that have passed the identity verification are asynchronously sent to the routing management module through the coroutine. By utilizing the asynchronous characteristics of the coroutine, the message synchronization core can continue to process other tasks while sending messages, thereby avoiding blocking and delays, and improving the concurrent processing capability and response speed of the system. In addition, the use of coroutines can ensure the efficient transmission of messages between multiple modules, reduce waiting time, and further enhance the low latency and reliability of message transmission.

[0067] As a further optional embodiment, after the step of sending the message to be synchronized that has passed the identity verification to the routing management module so that the routing management module performs routing verification on the message to be synchronized, the method further includes:

[0068] When the routing verification of the message to be synchronized fails, a routing verification failure result is generated, and the routing verification failure result is sent to the message source module through the message synchronization core.

[0069] In this embodiment, when the routing verification of the message to be synchronized fails, a routing verification failure result is generated, and the routing verification failure result, that is, if it is not registered, the error "routing is not registered" is returned. It is sent to the message source module through the message synchronization core. The use of coroutines can achieve asynchronous sending, so that the message synchronization core can continue to process other tasks while processing routing verification failure results, ensuring the high concurrent processing capability and response speed of the system. In this way, the system can promptly feedback verification failure information and improve the reliability of message delivery and user experience.

[0070] As a further optional embodiment, after sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content, the method further includes:

[0071] Obtaining the execution result of the target synchronization module;

[0072] Inputting the execution result into a result evaluation model to obtain a message synchronization correction instruction;

[0073] The message synchronization correction instruction is sent to the routing management module, so that the routing management module controls the target synchronization module to execute the message synchronization correction instruction.

[0074] In this embodiment, after the target synchronization module completes the execution of the request content, the generated execution result is returned. The execution result of the target synchronization module is input into the pre-trained result evaluation model. The model can evaluate the execution result based on historical data and predetermined rules and generate corresponding message synchronization correction instructions. The message synchronization correction instructions are sent to the routing management module asynchronously through the coroutine. After receiving the correction instruction, the routing management module controls the target synchronization module to perform the corresponding correction operation according to the instruction content to ensure the accuracy and consistency of message synchronization.

[0075] Through the above steps, the system can dynamically evaluate the execution effect of the target synchronization module and make real-time corrections based on the evaluation results, further improving the reliability and accuracy of message transmission. The use of coroutines ensures that other tasks of the system will not be affected when processing and sending correction instructions, improving the overall performance and response speed of the system.

[0076] As a further optional embodiment, after sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content, the method further includes:

[0077] Get thread crash signal;

[0078] According to the thread crash signal, the corresponding crashed thread is closed, and a thread recovery program is generated.

[0079] In this embodiment, the system monitors the running status of all threads and generates a thread crash signal when a thread crash is detected. After receiving the thread crash signal, the system will immediately close the corresponding crashed thread to ensure the stability and security of the system. At the same time, a thread recovery program is generated, which can restart the crashed thread or start a new thread to take over the task of the crashed thread to ensure that the system can continue to operate normally.

[0080] Through the above steps, the system can respond to thread crash events in a timely manner and take recovery measures quickly to ensure the continuity and stability of the message synchronization process. The use of coroutines ensures that other operations of the system will not be blocked when processing thread crashes and recovery, thereby improving the system's fault tolerance and overall performance.

[0081] As a further optional embodiment, after sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content, the method further includes:

[0082] Generate log files for the message synchronization core and the routing management module;

[0083] The log file is used to record the execution results of the message synchronization core and the routing management module.

[0084] In this embodiment, when the message synchronization core and the routing management module perform related operations, the execution process and results are recorded in real time. These log files record in detail information such as message reception, identity verification, routing verification, message forwarding, and execution results. The information in the log files is used to track and analyze each step in the message synchronization process to ensure the transparency and traceability of the entire process. By recording logs, system administrators can quickly locate the fault point when a problem occurs, and perform corresponding troubleshooting and repairs.

[0085] Through the above steps, the system can generate detailed log files to record the execution results of the message synchronization core and routing management module. This not only helps to improve the transparency and maintainability of the system, but also provides strong support for subsequent system optimization and troubleshooting. The use of coroutines ensures that the logging process is efficient and has low latency, and will not affect other operations of the system.

[0086] The following is a description of the message synchronization device based on coroutine provided by the present invention. Figure 3 As shown, the coroutine-based message synchronization device described below and the coroutine-based message synchronization method described above can correspond to each other.

[0087] A message synchronization device based on coroutine, comprising:

[0088] The message receiving module 310 is used to receive a message to be synchronized sent by a message source module, wherein the message to be synchronized includes a request body identifier, a target synchronization module identifier and a request content;

[0089] An identity verification module 320, configured to perform identity verification on the message to be synchronized through a message synchronization core, wherein the identity verification is determined based on the request body identifier;

[0090] A route verification module 330, configured to send the message to be synchronized that has passed the identity verification to the route management module, so that the route management module can perform route verification on the message to be synchronized, wherein the route verification is determined based on the request body identifier;

[0091] The message synchronization module 340 is used to send the verification result of the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module can execute the request content. The verification result includes the request body identifier, the target synchronization module identifier, the request content and the execution method.

[0092] 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 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the message synchronization method based on the coroutine, and the method includes:

[0093] Receive a message to be synchronized sent by a message source module, wherein the message to be synchronized includes a request body identifier, a target synchronization module identifier, and a request content;

[0094] Performing identity verification on the message to be synchronized by the message synchronization core, wherein the identity verification is determined based on the request body identifier;

[0095] Sending the message to be synchronized that has passed the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized, wherein the routing verification is determined based on the request body identifier;

[0096] The verification result that passes the route verification is sent to the target synchronization module corresponding to the target synchronization module identifier, so that the target synchronization module executes the request content, and the verification result includes the request body identifier, the target synchronization module identifier, the request content and the execution method.

[0097] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions for 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 method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0098] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the message synchronization method based on coroutines provided by the above methods, the method comprising:

[0099] Receive a message to be synchronized sent by a message source module, wherein the message to be synchronized includes a request body identifier, a target synchronization module identifier, and a request content;

[0100] Performing identity verification on the message to be synchronized by the message synchronization core, wherein the identity verification is determined based on the request body identifier;

[0101] Sending the message to be synchronized that has passed the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized, wherein the routing verification is determined based on the request body identifier;

[0102] The verification result that passes the route verification is sent to the target synchronization module corresponding to the target synchronization module identifier, so that the target synchronization module executes the request content, and the verification result includes the request body identifier, the target synchronization module identifier, the request content and the execution method.

[0103] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the message synchronization method based on coroutines provided by the above methods, the method comprising:

[0104] Receive a message to be synchronized sent by a message source module, wherein the message to be synchronized includes a request body identifier, a target synchronization module identifier, and a request content;

[0105] Performing identity verification on the message to be synchronized by the message synchronization core, wherein the identity verification is determined based on the request body identifier;

[0106] Sending the message to be synchronized that has passed the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized, wherein the routing verification is determined based on the request body identifier;

[0107] The verification result that passes the route verification is sent to the target synchronization module corresponding to the target synchronization module identifier, so that the target synchronization module executes the request content, and the verification result includes the request body identifier, the target synchronization module identifier, the request content and the execution method.

[0108] 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 displayed as units may or may not be physical units, that is, 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. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0109] 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, it 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.

[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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 invention.

Claims

1. A message synchronization method based on coroutine, characterized in that: include: Receive a message to be synchronized sent by a message source module, wherein the message to be synchronized includes a request body identifier, a target synchronization module identifier, and a request content; Performing identity verification on the message to be synchronized by the message synchronization core, wherein the identity verification is determined based on the request body identifier; Sending the message to be synchronized that has passed the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized, wherein the routing verification is determined based on the request body identifier; Sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier, so that the target synchronization module executes the request content, the verification result includes the request body identifier, the target synchronization module identifier, the request content and the execution method; After the step of sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content, the method further includes: Obtaining the execution result of the target synchronization module; Inputting the execution result into a result evaluation model to obtain a message synchronization correction instruction; The message synchronization correction instruction is sent to the routing management module, so that the routing management module controls the target synchronization module to execute the message synchronization correction instruction.

2. The message synchronization method based on coroutine according to claim 1, characterized in that: After the step of performing identity verification on the message to be synchronized by the message synchronization core, the method further includes: When the identity verification of the message to be synchronized fails, an identity verification failure result is generated, and the identity verification failure result is returned to the message source module.

3. The message synchronization method based on coroutine according to claim 1, characterized in that: The step of sending the to-be-synchronized message that has passed the identity verification to the routing management module specifically includes: Through the coroutine, the to-be-synchronized messages that have passed the identity verification are asynchronously sent to the routing management module.

4. The message synchronization method based on coroutine according to claim 1, characterized in that: After the step of sending the to-be-synchronized message that has passed the identity verification to the routing management module so that the routing management module performs routing verification on the to-be-synchronized message, the method further includes: When the routing verification of the message to be synchronized fails, a routing verification failure result is generated, and the routing verification failure result is sent to the message source module through the message synchronization core.

5. The message synchronization method based on coroutine according to claim 1, characterized in that: After the step of sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content, the method further includes: Get thread crash signal; According to the thread crash signal, the corresponding crashed thread is closed, and a thread recovery program is generated.

6. The message synchronization method based on coroutine according to claim 1, characterized in that: After the step of sending the verification result that passes the route verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module executes the request content, the method further includes: Generate log files for the message synchronization core and the routing management module; The log file is used to record the execution results of the message synchronization core and the routing management module.

7. A message synchronization device based on coroutine, characterized in that: include: A message receiving module, used for receiving a message to be synchronized sent by a message source module, wherein the message to be synchronized includes a request body identifier, a target synchronization module identifier and a request content; An identity verification module, used for performing identity verification on the message to be synchronized through a message synchronization core, wherein the identity verification is determined based on the request body identifier; A routing verification module, used for sending the message to be synchronized that has passed the identity verification to the routing management module, so that the routing management module can perform routing verification on the message to be synchronized, wherein the routing verification is determined based on the request body identifier; A message synchronization module is used to send the verification result that passes the routing verification to the target synchronization module corresponding to the target synchronization module identifier so that the target synchronization module can execute the request content. The verification result includes a request body identifier, a target synchronization module identifier, a request content and an execution method.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the coroutine-based message synchronization method as described in any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the coroutine-based message synchronization method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Webpage-based webpage block safe synchronous browsing method and system

    CN102164145A

  • Medical data exchange platform

    CN112582036A