A method and apparatus for synchronizing merchant data
By introducing event listeners and event components, and using event broadcasting, the coupling dependency problem between the main system and third-party systems was solved, and the asynchronous decoupling of the data synchronization process and the main process was achieved, improving processing efficiency and stability.
Patent Information
- Application Number
- CN202311248185.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-09-26
AI Technical Summary
During data synchronization, if the coupling dependency between the main system and the third-party system causes synchronization failure, multiple rollbacks are required, which affects the execution of subsequent processes, increases interface response latency, and reduces processing efficiency.
By introducing event listeners and event components, messages to be synchronized are sent to various third-party platforms through event broadcasting, thereby achieving asynchronous decoupling between the synchronization process and the main process, simplifying it into a one-way information broadcasting process.
It improves the processing efficiency of the main system, avoids the impact of synchronization results on the sequential execution of the main process, reduces interface response latency, and enhances the stability and efficiency of data synchronization.
Smart Images

Figure CN117290441B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for data synchronization. Background Technology
[0002] In the existing data synchronization process, due to the data interaction and data synchronization between different systems, there is often a coupling dependency relationship between the main system and the third-party system. That is, the main process executed independently in the main system will be affected by the interaction results of the third party.
[0003] For example, a user can purchase a merchant's product on various third-party platforms (such as Meituan, Ele.me, and JD.com). When a user places an order on any of these platforms, the platform sends the order information to the merchant's system, which then processes the order (e.g., deducting inventory). The merchant's system then synchronizes the processed result (e.g., the actual inventory after deduction) to each third-party platform and determines whether to proceed with subsequent steps based on the received synchronization results. Throughout this process, the merchant's system's order processing and its interactions with the third-party platforms are executed sequentially. If synchronization fails due to an anomaly in the interaction with a third-party platform, the merchant's system will repeatedly roll back the synchronization process (i.e., re-execute the synchronization process), thus failing to obtain a successful synchronization result and impacting the execution of subsequent main processes. Furthermore, synchronizing with multiple third-party platforms increases interface response latency and reduces processing efficiency. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a data synchronization method and apparatus. By introducing an event listener and an event creation component into the main system, the synchronization messages processed by the main system can be sent to various third-party platforms in the form of event broadcasts. This avoids the problem in the prior art that subsequent processes can only proceed after receiving the synchronization results returned by the third party. In other words, the bidirectional information interaction process is simplified into a one-way information broadcast process, and the received broadcast messages are processed asynchronously by each third-party platform, thus achieving asynchronous decoupling between the synchronization process and the main process.
[0005] To achieve the above objectives, according to one aspect of the present invention, a data synchronization method is provided.
[0006] An embodiment of the present invention provides a data synchronization method comprising: receiving an order to be processed from a third-party platform; processing the order to be processed using a pre-encapsulated event listener corresponding to the order to be processed to obtain information to be synchronized; creating an event corresponding to the information to be synchronized; and broadcasting the event to the third-party platform, so that the third-party platform can synchronize the information to be synchronized by listening to the broadcast message of the event and according to the broadcast message.
[0007] Optionally, before receiving the pending orders from the third-party platform, the method further includes: starting a lightweight container and obtaining one or more event listeners; the event listeners indicate the implementation method for processing the pending orders; encapsulating the event listeners using a publisher component and determining a first interface corresponding to the event listeners.
[0008] Optionally, processing the order to be processed using a pre-encapsulated event listener corresponding to the order to be processed includes: calling the first interface to obtain the pre-encapsulated event listener corresponding to the order to be processed; and processing the order to be processed using the implementation method in the event listener.
[0009] Optionally, after creating the event corresponding to the information to be synchronized, the method further includes: storing the event in a Redis cache and marking the execution status of the event.
[0010] Optionally, the method further includes: querying the execution status of each event in the Redis cache at preset time intervals; deleting the event from the Redis cache if the execution status is successful; and repeating the execution of the event if the execution status is unsuccessful.
[0011] Optionally, after the event is repeatedly executed, the method further includes: sending an alarm message to the user when the number of repeated executions reaches a preset number, so that the user can process the event according to the alarm message; wherein the alarm message indicates the reason for the failure of the event processing.
[0012] Optionally, the one or more event listeners can be stored in a local cache.
[0013] To achieve the above objectives, according to another aspect of the present invention, a data synchronization apparatus is provided.
[0014] An embodiment of the present invention provides a data synchronization apparatus comprising: an acquisition module for receiving orders to be processed from a third-party platform; a processing module for processing the orders to be processed using a pre-encapsulated event listener corresponding to the orders to be processed, thereby obtaining information to be synchronized; a creation module for creating an event corresponding to the information to be synchronized; and a broadcasting module for broadcasting the event to the third-party platform, so that the third-party platform can synchronize the information to be synchronized by listening to the broadcast message of the event and according to the broadcast message.
[0015] To achieve the above objectives, according to another aspect of the present invention, an electronic device for data synchronization is provided.
[0016] An electronic device for data synchronization according to an embodiment of the present invention includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a data synchronization method according to an embodiment of the present invention.
[0017] To achieve the above objectives, according to another aspect of the present invention, a computer-readable storage medium is provided.
[0018] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements a data synchronization method according to an embodiment of the present invention.
[0019] One embodiment of the above invention has the following advantages or beneficial effects: by introducing an event listener and an event creation component into the main system, the messages to be synchronized processed by the main system can be sent to various third-party platforms in the form of event broadcasting. This avoids the problem in the prior art that subsequent processes can only proceed after receiving the synchronization results returned by the third party. In other words, the bidirectional information interaction process is simplified into a one-way information broadcasting process, and the received broadcast messages are processed asynchronously by various third-party platforms, thus realizing asynchronous decoupling between the synchronization process and the main process.
[0020] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0021] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein: Figure 1 This is a schematic diagram of the main flow of the data synchronization method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the main process of encapsulating an event listener according to an embodiment of the present invention; Figure 3This is a schematic diagram of the main process of invoking the event listener according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the main process of querying the execution status of an event through a scheduled task according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the main modules of a data synchronization device according to an embodiment of the present invention; Figure 6 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied; Figure 7 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0022] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0023] It should be noted that, unless otherwise specified, the embodiments of the present invention and the technical features thereof can be combined with each other.
[0024] It should be noted that the collection, gathering, updating, analysis, processing, use, transmission, and storage of user personal information involved in this disclosed technical solution all comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken to prevent unauthorized access to user personal information data and to safeguard user personal information security, network security, and national security.
[0025] Figure 1 This is a schematic diagram of the main flow of a data synchronization method according to an embodiment of the present invention.
[0026] like Figure 1 As shown, the data synchronization method of this invention mainly includes the following steps: Step S101: Receive pending orders from a third-party platform; Step S102: Use the pre-encapsulated event listener corresponding to the order to be processed to process the order and obtain the information to be synchronized; Step S103: Create an event corresponding to the information to be synchronized; Step S104: Broadcast the event to a third-party platform so that the third-party platform can listen to the broadcast message of the event and synchronize the information to be synchronized according to the broadcast message.
[0027] In the application scenario of this invention embodiment, the main program (e.g., a merchant system) that actually processes the order is the executing entity of the above process, while the third-party platform merely acts as a platform for receiving user orders. Taking a user order scenario as an example, if a user places an order to purchase items from merchant A through a third-party platform, the third-party platform will generate a purchase order based on the quantity and type of items selected by the user, and then send the purchase order to the main program. After receiving the purchase order, the main program will deduct the item inventory based on the purchase order to obtain a new inventory quantity (i.e., information to be synchronized), and then synchronize the new inventory quantity to all third-party platforms so that the third-party platforms can update the displayed item quantity. Typically, there are multiple third-party platforms, and there is no data interaction between them. Therefore, after each third-party platform receives a user order, it needs to interact with the main program, and after the main program processes the order, it will synchronize the information to be synchronized to all third-party platforms to ensure the consistency of inventory data.
[0028] In existing technologies, no event component is introduced. Instead, the information to be synchronized is sequentially synchronized to each third-party platform, and the task is considered complete only after all synchronizations are successful. For example, if there are three third-party platforms, namely Platform A, Platform B, and Platform C, the main program, after processing the information to be synchronized, first synchronizes to Platform A and receives the data synchronization result returned by Platform A. If the synchronization is successful, it continues to synchronize the information to be synchronized to Platform B and receives the data synchronization result returned by Platform B. If the synchronization fails, it will repeatedly roll back the data synchronization process with Platform B, or roll back the entire synchronization task (i.e., resynchronize from Platform A), resulting in low synchronization efficiency. In contrast, this invention broadcasts the information to be synchronized to the third-party platforms in the form of events, asynchronously decomposing the synchronization and result acquisition processes. In the embodiments of this invention, the data synchronization process is not affected by the data synchronization result; only event broadcasting is required, effectively improving the processing efficiency of the main program.
[0029] In this invention, the event creation process in step S103 can be performed using an event component developed based on the Spring framework. Compared to other open-source frameworks, the Spring framework offers finer-grained event support and a more complete event mechanism, significantly reducing development costs. Furthermore, the Spring framework has a large open-source community, facilitating troubleshooting when problems arise. Additionally, since most mainstream Java backend service frameworks currently use Spring Boot, from a general perspective, using Spring framework components makes it easier for other projects to use them, increasing the overall versatility of the components.
[0030] In one optional embodiment, before step S101, as follows: Figure 2 As shown, it also includes: Step S201: Start the lightweight container and obtain one or more event listeners; the event listeners indicate the implementation methods for processing the orders to be processed; Step S202: Use the publisher component to encapsulate the event listener and determine the first interface corresponding to the event listener.
[0031] The lightweight container refers to the container in the Spring framework, used to manage event listeners and events. In practical applications, different event listeners can be encapsulated into different implementation methods for different processing stages of an order to listen for different events. For example, an inventory deduction event listener is used to listen for inventory deduction events, and a status change event listener is used to listen for status change events.
[0032] In a further optional embodiment, after configuring the event listener to correspond with the first interface, step S102 is as follows: Figure 3 As shown, it specifically includes: Step S301: Call the first interface to obtain the pre-encapsulated event listener corresponding to the order to be processed; Step S302: Process the order to be processed using the implementation methods in the event listener.
[0033] Each event listener corresponds to only one first interface. By calling the first interface, you can obtain the corresponding event listener and the encapsulated implementation method for processing pending orders.
[0034] In this embodiment of the invention, there may be situations where Spring events encounter exceptions during transmission. For example, there may be a mismatch in the SKU relationship between the third-party platform and the main program, resulting in the inability to find the corresponding product for which inventory needs to be deducted in the third-party platform. In other words, the Spring event cannot be successfully processed after being broadcast to the third-party platform. To address this, this embodiment of the invention further includes: after creating the event corresponding to the information to be synchronized, storing the event in a Redis cache and marking the event's execution status. It should be noted that since this invention changes the bidirectional data interaction of the prior art to a unidirectional data interaction, if a separate cache is set up to mark and store the event's execution status, the invention cannot obtain the event processing result in a timely manner after broadcasting the event, and therefore cannot promptly detect event exceptions. Therefore, by storing the event in a Redis cache and recording its execution status immediately after creation, this invention can effectively avoid the potential problem of event loss.
[0035] Redis caching can be set up locally and used to store event listeners. Calling event listeners from the local cache is more efficient than calling them remotely, with a lower probability of exceptions and better stability.
[0036] In a further optional embodiment, a scheduled task can be used to query the execution status of the event to determine whether manual processing is required, such as... Figure 4 As shown, it specifically includes: Step S401: Query the execution status of each event in the Redis cache according to the preset time interval; Step S402: If the execution status is successful, delete the event from the Redis cache; Step S403: If the execution status is "execution failed", repeat the execution event.
[0037] Through the above process, successfully executed events can be promptly removed from the Redis cache, ensuring sufficient cache space. Failed events can be re-executed, allowing for re-execution even when temporary failures due to network issues occur, ensuring execution resumes once the network is restored. Understandably, events in the "in progress" state can be skipped and not re-processed.
[0038] In a further optional embodiment, step S403 may further include: sending an alarm message to the user when the number of repeated executions reaches a preset number, so that the user can handle the event according to the alarm message; wherein, the alarm message indicates the reason for the event handling failure. By sending alarm messages to the user, timely manual intervention can be performed on events that cannot be handled automatically to determine whether manual configuration modifications are required. For example, when the SKU of the third-party platform does not match that of the main program, it will fail to execute successfully no matter how many times it is repeated. In this case, the user needs to reconfigure the third-party SKU for successful execution.
[0039] According to the data synchronization method of the present invention, by introducing an event listener and an event creation component into the main system, the synchronization message processed by the main system can be sent to various third-party platforms in the form of event broadcast. This avoids the problem in the prior art that the subsequent process can only be carried out after receiving the synchronization result returned by the third party. That is, the two-way information interaction process is simplified into a one-way information broadcast process, and the received broadcast message is processed asynchronously by each third-party platform, thereby realizing the asynchronous decoupling between the synchronization process and the main process.
[0040] Figure 5 This is a schematic diagram of the main modules of a data synchronization device according to an embodiment of the present invention.
[0041] like Figure 1 As shown, the data synchronization device 500 of this embodiment includes: Module 501 is used to receive pending orders from a third-party platform; Processing module 502 is used to process the order to be processed using a pre-encapsulated event listener corresponding to the order to be processed, and obtain information to be synchronized; Module 503 is used to create an event corresponding to the information to be synchronized. The broadcast module 504 is used to broadcast the event to the third-party platform, so that the third-party platform can listen to the broadcast message of the event and synchronize the information to be synchronized according to the broadcast message.
[0042] In an optional embodiment of the present invention, the invention further includes: a configuration module, configured to start a lightweight container and obtain one or more event listeners before receiving the pending order from the third-party platform; the event listener indicates an implementation method for processing the pending order; and to encapsulate the event listener using a publisher component to determine a first interface corresponding to the event listener.
[0043] In an optional embodiment of the present invention, the processing module 502 is further configured to call the first interface to obtain the pre-encapsulated event listener corresponding to the order to be processed; and process the order to be processed using the implementation method in the event listener.
[0044] In an optional embodiment of the present invention, the creation module 503 is further configured to, after creating the event corresponding to the information to be synchronized, store the event in a Redis cache and mark the execution status of the event.
[0045] In an optional embodiment of the present invention, the creation module 503 is further configured to query the execution status of each event in the Redis cache at preset time intervals; if the execution status is successful, delete the event from the Redis cache; if the execution status is failed, repeat the execution of the event.
[0046] In an optional embodiment of the present invention, the creation module 503 is further configured to send an alarm message to the user after the event is repeatedly executed, when the number of repeated executions reaches a preset number, so that the user can process the event according to the alarm message; wherein the alarm message indicates the reason for the failure of the event processing.
[0047] In an optional embodiment of the invention, the one or more event listeners are stored in a local cache.
[0048] As can be seen from the data synchronization apparatus according to the embodiments of the present invention, by introducing an event listener and an event creation component into the main system, the synchronization messages processed by the main system can be sent to various third-party platforms in the form of event broadcasting. This avoids the problem in the prior art that subsequent processes can only proceed after receiving the synchronization results returned by the third party. In other words, the bidirectional information interaction process is simplified into a one-way information broadcasting process, and the received broadcast messages are processed asynchronously by each third-party platform, thereby realizing asynchronous decoupling between the synchronization process and the main process.
[0049] Figure 6 An exemplary system architecture 600 is shown, in which the data synchronization method or data synchronization apparatus of embodiments of the present invention can be applied.
[0050] like Figure 6 As shown, system architecture 600 may include third-party platform servers 601, 602, and 603, network 604, and main process server 605. Network 604 serves as the medium for providing communication links between third-party platform servers 601, 602, and 603 and main process server 605. Network 604 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0051] The main process server 605 can be a server that provides various services, such as a backend management server that supports pending orders sent by third-party platform servers 601, 602, and 603. The backend management server can analyze and process the received pending orders and other data, and broadcast the synchronization information to the third-party platform servers 601, 602, and 603.
[0052] It should be noted that the data synchronization method provided in this embodiment of the invention is generally executed by the main process server 605, and correspondingly, the data synchronization device is generally set in the main process server 605.
[0053] It should be understood that Figure 6 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0054] The following is for reference. Figure 7 It shows a schematic diagram of the structure of a computer system 700 suitable for implementing a terminal device of the present invention. Figure 7 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0055] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the system 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) first interface 705 is also connected to the bus 704.
[0056] The following components are connected to the I / O first interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network first interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O first interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.
[0057] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit (CPU) 701, it performs the functions defined above in the system of this invention.
[0058] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0059] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0060] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including an acquisition module, a processing module, a creation module, and a broadcast module. The names of these modules do not necessarily limit the module itself; for example, the acquisition module can also be described as "a module that receives orders to be processed from a third-party platform."
[0061] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs that, when executed by the device, cause the device to include: receiving pending orders from a third-party platform; processing the pending orders using a pre-packaged event listener corresponding to the pending orders to obtain information to be synchronized; creating an event corresponding to the information to be synchronized; and broadcasting the event to the third-party platform, so that the third-party platform can synchronize the information to be synchronized by listening to the broadcast message of the event and according to the broadcast message.
[0062] According to the technical solution of the present invention, by introducing an event listener and an event creation component into the main system, the message to be synchronized processed by the main system can be sent to various third-party platforms in the form of event broadcast. This avoids the problem in the prior art that subsequent processes can only proceed after receiving the synchronization result returned by the third party. In other words, the bidirectional information interaction process is simplified into a one-way information broadcast process, and the received broadcast messages are processed asynchronously by each third-party platform, thereby realizing asynchronous decoupling between the synchronization process and the main process.
[0063] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for merchant data synchronization, the method comprising: The main program used to actually process orders includes: Receive pending orders from a third-party platform, whereby the third-party platform is the platform that receives user orders; The pre-encapsulated event listener corresponding to the order to be processed is used to process the order to be processed and obtain the information to be synchronized. Create an event corresponding to the information to be synchronized; wherein, an event component developed based on the Spring framework is used to create the event. The event is broadcast to multiple third-party platforms, enabling these platforms to listen to the broadcast messages and synchronize the information to be synchronized based on them; however, there is no data interaction between the various third-party platforms. After creating the event corresponding to the information to be synchronized, the method further includes: The event is stored in a Redis cache, and the execution status of the event is marked. The execution status of each event in the Redis cache is queried at preset time intervals; If the execution status is successful, the event will be deleted from the Redis cache. If the execution status is "execution failed", the event will be executed repeatedly.
2. The method of claim 1, wherein, Before receiving pending orders from a third-party platform, the following is also included: Start a lightweight container and obtain one or more event listeners; the event listeners indicate the implementation method for processing the pending order; The event listener is encapsulated using the publisher component, and a first interface corresponding to the event listener is determined.
3. The method of claim 2, wherein, The process of processing the pending order using a pre-encapsulated event listener corresponding to the pending order includes: Call the first interface to obtain the pre-encapsulated event listener corresponding to the order to be processed; The pending orders are processed using the implementation methods in the event listener.
4. The method of claim 1, wherein, Following the repeated execution of the event, the following is also included: If the number of repeated executions reaches a preset number, an alarm message is sent to the user so that the user can handle the event according to the alarm message; wherein, the alarm message indicates the reason for the failure of the event handling.
5. The method of claim 2, wherein, Store the one or more event listeners in a local cache.
6. An apparatus for merchant data synchronization, the apparatus comprising: The main program, which is responsible for actually processing orders, includes: The acquisition module is used to receive orders to be processed from a third-party platform, which is a platform that receives orders placed by users; The processing module is used to process the order to be processed using a pre-encapsulated event listener corresponding to the order to be processed, and obtain the information to be synchronized. A creation module is used to create events corresponding to the information to be synchronized; wherein, an event component developed based on the Spring framework is used for event creation. The broadcast module is used to broadcast the event to multiple third-party platforms, so that the multiple third-party platforms can listen to the broadcast message of the event and synchronize the information to be synchronized according to the broadcast message; wherein, there is no data interaction between the various third-party platforms; The creation module is also used for: After creating the event corresponding to the information to be synchronized, the event is stored in the Redis cache, and the execution status of the event is marked. The creation module is also used for: The execution status of each event in the Redis cache is queried at preset time intervals; If the execution status is successful, the event will be deleted from the Redis cache. If the execution status is "execution failed", the event will be executed repeatedly.
7. An electronic device for merchant data synchronization, comprising: include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.
8. A computer readable medium having stored thereon a computer program, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Information synchronization method and device, and information synchronization processing system
CN106101220A
Business data synchronization method and device, nonvolatile storage medium and processor
CN112380229A
Vehicle inventory synchronization method and device, storage medium and electronic equipment
CN114049176A
