An automatic synchronization method
By abstracting the preconditions and tasks themselves into events and rules, and managing them under the drive of an event composition model, the high failure rate and resource waste of traditional automatic synchronization tasks are solved, achieving more efficient task execution and system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 百望股份有限公司
- Filing Date
- 2021-12-18
- Publication Date
- 2026-07-03
AI Technical Summary
Traditional automatic synchronization tasks suffer from high failure rates, high system pressure, increased concurrency, and resource waste in large enterprise systems, especially when they depend on multiple preconditions and cannot guarantee successful task execution.
The preconditions for scheduling tasks are abstracted as events, and the scheduling tasks themselves are abstracted as rules. These are managed through an event composition model-driven SDK package, which persistently stores and retryes failed tasks. Tasks are executed only when all preconditions are met, and an alarm is issued after the number of retries reaches a threshold.
It reduces the failure rate of task invocation, reduces system resource consumption, lowers time and manpower costs, and improves system stability and reliability.
Smart Images

Figure CN114463076B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically to an automatic synchronization method. Background Technology
[0002] As enterprise systems expand, scheduled automatic synchronization tasks play a crucial role. Examples include the synchronization of invoicing terminals and hardware devices. Without automatic synchronization task scheduling, significant manpower is required for manual operation, which also carries risks of data inaccuracy and network transmission instability. Even with scheduled synchronization tasks enabled, taking automatic terminal synchronization as an example: if a user has installed hardware but hasn't registered on Baiwang Cloud, automatic terminal synchronization will fail due to the lack of user registration. The reverse is also true. While reducing manual operation is beneficial when a large number of hardware devices are installed, it increases system overhead, the failure rate of synchronization tasks, and the number of concurrent requests to the server, significantly increasing the pressure on the enterprise system. Scheduled synchronization tasks are a vital component of enterprise business systems, primarily aimed at reducing system load and minimizing user manpower costs. However, as enterprises grow and business scenarios expand, the drawbacks of scheduled synchronization tasks become apparent. For example, when a synchronization task depends on multiple preconditions, and it cannot be guaranteed that the preconditions will be completed before the synchronization task execution time, the synchronization task will fail, wasting system resources. If the task volume is huge, the pressure on the enterprise system will also increase. Automatic synchronization tasks are common in large enterprise systems. Reasonable scheduling of automatic synchronization tasks can significantly reduce labor costs and improve the accuracy and reliability of data in the system, bringing great convenience to system users. Automatic synchronization tasks do not refer to a specific business function, but rather to a general term for all tasks that the system can independently complete to save labor costs. Examples include: automatic terminal synchronization, automatic invoice repair, data synchronization between systems, and acquisition of invoicing hardware device information. Traditional automatic synchronization tasks include the following types: (i) timed / delayed triggered scheduling tasks; (ii) scheduling tasks triggered based on specific return values.
[0003] In summary, traditional automatic synchronization tasks, because they do not consider the dependencies of synchronization tasks on other system operations, are problematic when the amount of data to be automatically scheduled is very large, and each scheduled task depends on one or more preconditions, and can still execute automatically even when the preconditions are not met. While traditional automatic synchronization tasks offer convenience, they also face increased system overhead, higher failure rates, significantly increased concurrency, and can even lead to the paralysis of the entire system. They also present difficulties in troubleshooting problems after execution failures. Summary of the Invention
[0004] The object of this invention is to provide an automatic synchronization method. To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general description, nor is it intended to identify key / important components or to describe the scope of protection of these embodiments. Its sole purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.
[0005] According to one aspect of the present invention, an automatic synchronization method is provided, comprising:
[0006] Abstract the preconditions on which the scheduled task depends into an event;
[0007] Each scheduling task is abstracted into a rule.
[0008] Furthermore, before abstracting the preconditions upon which the scheduling task depends into an event, the method also includes defining an event model and a rule model.
[0009] Furthermore, the event model includes a unique identifier for the event, the event type, the event's business data, the generation time, the update time, and extended event information.
[0010] Furthermore, the method also includes:
[0011] Persistently store each event;
[0012] Each rule is persistently stored.
[0013] Furthermore, the method also includes: persisting the return information of the scheduled tasks under each rule.
[0014] Furthermore, the method also includes:
[0015] Retry the request that fails for each rule-scheduled task;
[0016] The number of retries is recorded, and an alarm message is sent to the communication device when a certain threshold is reached.
[0017] According to another aspect of the present invention, an automatic synchronization method is provided, comprising:
[0018] S1, perform the initialization rule operation.
[0019] Furthermore, the method also includes:
[0020] S2, Design an SDK package driven by an event composition model;
[0021] S3 assigns values to the event type and the business data contained in the event;
[0022] S4 sends each event to the server of the event composition model driven system. After receiving the request, the server checks whether the event already exists. If it already exists, it does not perform any processing and returns a success message. If it does not exist, it performs a persistence operation to save the event.
[0023] S5: After the server completes the persistence operation, it retrieves all rules containing the event.
[0024] S6: Retrieve all events under a given rule and check if all events under that unique identifier already exist. If they do not exist, do nothing. If they all exist, execute S7.
[0025] S7 assembles the request template data in the rule model and performs automatic task scheduling based on the service name, service address, and request method in the rule model; if the execution is successful, the automatic task invocation ends; if it fails, execute S8.
[0026] S8 will persist failed scheduled tasks and then retry them at fixed intervals, recording the number of retries. If the number of retries reaches a specified threshold, the program will send an alarm message to the communication device.
[0027] According to another aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described automatic synchronization method.
[0028] According to another aspect of the present invention, a non-transitory computer-readable storage medium is provided, on which a computer program is stored, which is executed by a processor to implement the above-described automatic synchronization method.
[0029] Compared with the prior art, the technical solution provided by the embodiments of the present invention may include the following beneficial effects:
[0030] The automatic synchronization method provided in this invention reduces the failure rate of request task invocation, reduces the impact of interference factors such as network fluctuations and service circuit breakers, greatly reduces time costs, and saves manpower costs.
[0031] Other features and advantages of the invention will be set forth in the following description and will be apparent in part from the description, or some features and advantages may be inferred from the description or determined without question, or may be learned by practicing embodiments of the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 A schematic diagram illustrating a business scenario of an automatic synchronization method according to one embodiment of this application;
[0034] Figure 2 This is a flowchart of an automatic synchronization method according to one embodiment of this application.
[0035] Figure 3 This is a schematic diagram of an event model for one embodiment of this application;
[0036] Figure 4 This is a schematic diagram of a rule model for one implementation of this application. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.
[0038] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0039] One embodiment of this application provides an automatic synchronization method, including the following steps:
[0040] S1 performs the rule initialization operation, storing information such as the rule name, the events the rule depends on, the service name and address requested during task scheduling, and the request data template.
[0041] S2, design an event composition model-driven SDK package. The SDK package contains abstract operations on the preconditions for each call. The preconditions are abstracted into an event model; and a unique identifier is extracted from each event, then categorized and processed; ensuring that all events under each scheduled task generate the same unique identifier.
[0042] S3, after generating the event, will assign values to the event type and the business data contained in the event.
[0043] S4 sends each event to the server of the event composition model driven system (hereinafter referred to as the server) via the SDK package. After receiving the request, the server checks whether the event already exists. If it already exists, it does not perform any processing and returns a success return. If it does not exist, it performs a persistence operation to save it.
[0044] S5: After the server completes the persistence operation, it retrieves all rules containing the event. It then polls each rule in turn.
[0045] S6: Retrieve all events under a given rule and check if all events under that unique identifier already exist. If they do not exist, do nothing. If they all exist, execute S7.
[0046] S7 assembles the request template data in the rule model and performs automatic task scheduling based on the service name, service address, and request method in the rule model. If successful, the automatic task invocation ends; if it fails, proceed to S8.
[0047] S8 will persist failed scheduled tasks and then retry them at fixed intervals, recording the number of retries. If the number of retries reaches a specified threshold, the program will send an alarm message to the communication device.
[0048] S9 allows system administrators to troubleshoot errors in specific business systems based on alarm information.
[0049] like Figure 1 The diagram shown is a business scenario schematic of an automatic synchronization method according to one embodiment of this application. Figure 2This is a flowchart illustrating an automatic synchronization method according to one embodiment of this application. For example, when synchronizing terminals for invoice processing, the prerequisites for automatic terminal synchronization are: 1. User registration; 2. Device installation. Executing automatic terminal synchronization requires requesting the terminal management service to trigger the terminal synchronization function. This task can be abstracted into a rule model as follows:
[0050] Rule Name: Synchronization Terminal
[0051] The rule relies on the following events: user registration, device listing.
[0052] Business System Name: Terminal Management System
[0053] Call type: RPC call
[0054] Request method: POST
[0055] Request address: IP address: port / .. / ..
[0056] Request data template; JSON template
[0057] Execution order; 0
[0058] When a user registers, the user registration event is saved and the rule is retrieved. The rule contains the device listing event. The device listing event is retrieved based on the time ID when the user registered. If the event is found, the rule is executed; otherwise, no action is taken.
[0059] Event composition model-driven approaches are an optimization and upgrade of timed task scheduling. The event composition mechanism abstracts each request task as an event, and each business rule is composed of multiple events. Triggering a business rule requires fulfilling multiple preconditions and events. Once all required preconditions for the business rule have been met, the logic for executing the business rule is automatically triggered. This model reduces the overhead on system resources and is a high-performance, highly scalable implementation mechanism.
[0060] The preconditions upon which a request scheduling task depends are abstracted into an event model; the specific request scheduling task is abstracted into a rule model; the decision to execute a rule task is made based on whether all scheduling dependencies have been sent to the server. The scheduling process and return results of events and rule tasks are persisted to facilitate later troubleshooting by administrators. Returned error messages are persistently recorded and retried periodically; when a retry reaches a custom threshold, an alarm is sent to the communication device and software.
[0061] Because this mechanism only executes rules after all events are met, it reduces failed request task calls and significantly lowers the concurrency of service requests.
[0062] By adopting a retry approach after a task scheduling error, the impact of interference factors such as network fluctuations and service interruptions on the system has been reduced.
[0063] Alarms were sent to communication devices. This significantly reduced the time and manpower costs for system administrators when troubleshooting errors based on the alarm information.
[0064] Another embodiment of this application provides an automatic synchronization method, including:
[0065] S01. Define the concepts of event model and rule model;
[0066] like Figure 3 The diagram shown is an event model illustration of one embodiment of this application; as follows: Figure 4 The diagram shown is a rule model schematic of one embodiment of this application.
[0067] S02. Abstract the preconditions on which the scheduling task depends into an event;
[0068] S03. Abstract each scheduling task into a rule.
[0069] The event model includes: a unique identifier for the event, the event type, the business data for the event, the generation time, the update time, and extended event information.
[0070] S04. The program persists and retrieves each event.
[0071] The rules include: rule name, list of dependent events, server address when the call is triggered, calling method, network transmission type, calling address, request data template during transmission, and order of rules.
[0072] S05. Persistently store and retrieve each rule through the program;
[0073] S06. Persist the return information of the scheduled tasks under each rule;
[0074] S07. Retry the request that failed for each rule-scheduled task;
[0075] S08. Record the number of retries, and send an alarm message to the communication device after reaching a certain threshold.
[0076] The template type for storing data can be defined by the user, but is not limited to formats such as XML, JSON, and strings.
[0077] The invocation methods include local invocation and remote RPC invocation.
[0078] The request type can be POST, GET, or other request methods.
[0079] Persistence operations for events and rules can be performed on relational databases, non-relational databases, and file system disks.
[0080] The program sends alarm information to communication devices and communication software.
[0081] The automatic synchronization method provided in this invention reduces the failure rate of request task invocation, reduces the impact of interference factors such as network fluctuations and service circuit breakers, greatly reduces time costs, and saves manpower costs.
[0082] Another embodiment of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described automatic synchronization method.
[0083] Another embodiment of this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement the above-described automatic synchronization method.
[0084] It should be noted that:
[0085] The algorithms and displays provided herein are not inherently related to any particular computer, virtual device, or other equipment. Various general-purpose devices can also be used in conjunction with the teachings herein. The required structure for constructing such devices is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the invention.
[0086] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0087] Similarly, it should be understood that, in order to simplify this disclosure and aid in understanding one or more of the various aspects of the invention, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, this method of disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into this detailed description, wherein each claim itself is a separate embodiment of the invention.
[0088] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0089] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features but not others included in other embodiments, combinations of features from different embodiments are intended to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
[0090] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the virtual machine creation apparatus according to embodiments of the present invention. The present invention can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such programs implementing the present invention can be stored on a computer-readable medium or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0091] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0092] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0093] The embodiments described above are merely illustrative of implementation methods of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. An automatic synchronization method, characterized by, include: Abstract the preconditions on which the scheduled task depends into an event; Abstract each scheduling task into a rule; Before abstracting the preconditions on which the scheduling task depends into an event, the method also includes defining an event model and a rule model; The event model includes a unique identifier for the event, the event type, the event's business data, the generation time, the update time, and extended event information; S1, perform initialization rule operations; S2, Design an event composition model-driven SDK package; the SDK package contains abstract operations on the preconditions for each call; The preconditions are abstracted into an event model, and a unique identifier is extracted from all events, which are then categorized and processed. This ensures that all events under each scheduled task generate the same unique identifier; S3 assigns values to the event type and the business data contained in the event; S4 sends each event to the server of the event composition model driven system. After receiving the request, the server checks whether the event already exists. If it already exists, it does not perform any processing and returns a success message. If it does not exist, it performs a persistence operation to save the event. S5: After the server completes the persistence operation, it retrieves all rules containing the event. S6: Retrieve all events under a given rule and check if all events under that unique identifier already exist. If they do not exist, do nothing. If they all exist, execute S7. S7 assembles the request template data in the rule model and performs automatic task scheduling based on the service name, service address, and request method in the rule model. If the execution is successful, this automatic task will end. If it fails, execute S8; S8 will persist failed scheduled tasks and then retry them at fixed intervals, recording the number of retries. If the number of retries reaches a specified threshold, the program will send an alarm message to the communication device.
2. The method of claim 1, wherein, The method further includes: Persistently store each event; Each rule is persistently stored.
3. The method of claim 2, wherein, The method further includes: persisting the return information of the scheduled tasks under each rule.
4. The method of claim 3, wherein, The method further includes: Retry the request that fails for each rule-scheduled task; The number of retries is recorded, and an alarm message is sent to the communication device when a certain threshold is reached.
5. An electronic device, comprising: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the automatic synchronization method as described in any one of claims 1-4.
6. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the automatic synchronization method as described in any one of claims 1-4.