Service data synchronization method and device, electronic equipment and storage medium
By using preset switches and message queues for data synchronization between systems, the problems of poor timeliness and low stability of data synchronization are solved, and timely and reliable data transmission is achieved.
Patent Information
- Application Number
- CN202310513457.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-08
- Publication Date
- 2024-11-08
AI Technical Summary
Existing technologies are not timely and prone to failure when synchronizing data between systems, resulting in data acquisition delays and low stability.
By generating data files and sending production messages to a preset exchange, the preset exchange broadcasts the messages to each message queue. When the data consumer listens to a message queue, it performs synchronization processing. The preset message queue service is used to build an exchange and associate queue addresses to improve synchronization efficiency.
It improves the timeliness and stability of data synchronization, reduces the possibility of data synchronization failure, and ensures that data requesters can obtain data in a timely and reliable manner.
Smart Images

Figure CN118921378A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method and device for synchronizing business data, an electronic device, and a storage medium. Background Art
[0002] When there is a need for large amounts of data synchronization between business systems, related technologies often synchronize data between systems through data files. Specifically, the data provider generates data files at an agreed time, the data demander reads the data files, and the data provider delivers notifications through online message communication. For example, after the data provider A system generates a file at the agreed time of 08:00 and stores it in a specified path, the data demander B, C, D and other systems obtain the file at the agreed time of 08:05.
[0003] However, the above data synchronization method has the following problems: (1) poor timeliness. For example, there is a 5-minute interval between 08:00 and 08:05, and the data demander has a 5-minute delay in obtaining data; (2) low stability. For example, if the source data volume of the file generated by the data provider A system is large, it takes a long time to generate the file, and it can only be generated at 08:06, but the data demander B, C, D system does not know the actual generation time and will still obtain it according to 08:05. If the file is not found, it will be considered a failure. In addition, if the data provider A system fails to generate a file, the data demander B, C, D system does not know that the file generation failed, and will still obtain it according to 08:05. If the file is not found, it will be considered a failure.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method and device for synchronizing business data, an electronic device and a storage medium, so as to at least solve the technical problems in the related art of poor timeliness and easy synchronization failure when synchronizing data between systems.
[0006] According to one aspect of an embodiment of the present invention, a method for synchronizing business data is provided, which is applied to a data production end, and includes: generating a data file based on the business data to be synchronized, wherein the data file corresponds to a production message; sending the production message to a preset switch, wherein the preset switch broadcasts the production message to each message queue, and each of the message queues corresponds to a data consumer end, and the data consumer end synchronizes the business data to be synchronized based on the production message when it is monitored that the message queue has the production message.
[0007] Optionally, before generating a data file based on the service data to be synchronized, the method further includes: determining a target switch architecture; and constructing the preset switch using a preset message queue service based on the target switch architecture, wherein the preset switch corresponds to a switch address.
[0008] Optionally, after constructing the preset switch using the preset message queue service, it also includes: sending a message notification request to the data consumer, wherein the data consumer responds to the message notification request and returns a response request, wherein the response request carries the consumer address; upon receiving the response request, constructing the message queue, and associating the queue address of the message queue with the switch address and the consumer address; sending the queue address to the data consumer, wherein the data consumer monitors the message queue based on the queue address.
[0009] Optionally, the step of generating a data file based on the business data to be synchronized includes: obtaining the business data to be synchronized from multiple data sources; classifying the business data to be synchronized to obtain classification results; based on the classification results, aggregating the synchronized business data belonging to the same type to generate the data file, wherein each of the data files corresponds to a file type and each of the data files corresponds to a file identifier.
[0010] Optionally, after generating a data file based on the business data to be synchronized, it also includes: determining a file path for storing the data file; determining a delivery time for storing the data file in a storage space indicated by the file path; and generating the production message corresponding to the data file based on the file path, the delivery time, the file type and the file identifier.
[0011] Optionally, when the data consumer detects that the message queue has the production message, the step of synchronizing the business data to be synchronized based on the production message includes: the data consumer parses the production message to obtain a parsing result, wherein the parsing result at least includes: the file type, delivery time, file path, and file identifier of the data file corresponding to the production message; when the file type meets the preset file type, the data consumer obtains the business data to be synchronized indicated by the file identifier from the storage space indicated by the file path when the delivery time arrives; the data consumer synchronizes the business data to be synchronized.
[0012] Optionally, the synchronization method also includes: when the data consumer does not detect that the message queue has the production message for a period of time exceeding a first preset time threshold, the data consumer sends a heartbeat detection request to the message queue; when the data consumer does not receive a heartbeat detection response for a period of time exceeding a second preset time threshold, the data consumer sends a message queue connection request to the data producer.
[0013] According to another aspect of an embodiment of the present invention, a business data synchronization device is also provided, which is applied to a data production end and includes: a generation unit, which is used to generate a data file based on the business data to be synchronized, wherein the data file corresponds to a production message; a synchronization unit, which is used to send the production message to a preset switch, wherein the preset switch broadcasts the production message to each message queue, and each of the message queues corresponds to a data consumer end. When the data consumer end monitors that the message queue has the production message, the data consumer end synchronizes the business data to be synchronized based on the production message.
[0014] Optionally, the synchronization device also includes: a first determination module, used to determine the target switch architecture before generating a data file based on the business data to be synchronized; a first construction module, used to construct the preset switch based on the target switch architecture using a preset message queue service, wherein the preset switch corresponds to a switch address.
[0015] Optionally, the synchronization device also includes: a first sending module, which is used to send a message notification request to the data consumer end after the preset switch is constructed using a preset message queue service, wherein the data consumer end responds to the message notification request and returns a response request, wherein the response request carries the consumer end address; a second construction module, which is used to construct the message queue upon receiving the response request, and associate the queue address of the message queue with the switch address and the consumer end address; a second sending module, which is used to send the queue address to the data consumer end, wherein the data consumer end monitors the message queue based on the queue address.
[0016] Optionally, the generation unit includes: a first acquisition module, used to acquire the business data to be synchronized from multiple data sources; a first classification module, used to classify the business data to be synchronized to obtain classification results; a first generation module, used to aggregate the synchronized business data belonging to the same type based on the classification results, and generate the data file, wherein each of the data files corresponds to a file type, and each of the data files corresponds to a file identifier.
[0017] Optionally, the synchronization device also includes: a second determination module, used to determine the file path for storing the data file after generating the data file based on the business data to be synchronized; a third determination module, used to determine the delivery time for storing the data file to the storage space indicated by the file path; and a second generation module, used to generate the production message corresponding to the data file based on the file path, the delivery time, the file type and the file identifier.
[0018] Optionally, the synchronization unit includes: a first parsing module, used by the data consumer to parse the production message to obtain a parsing result, wherein the parsing result includes at least: the file type, delivery time, file path, and file identifier of the data file corresponding to the production message; a second acquisition module, used by the data consumer to acquire the business data to be synchronized indicated by the file identifier from the storage space indicated by the file path when the delivery time arrives, when the file type meets the preset file type; and a first synchronization module, used by the data consumer to synchronize the business data to be synchronized.
[0019] Optionally, the synchronization device also includes: a third sending module, which is used for the data consumer end to send a heartbeat detection request to the message queue when the data consumer end does not detect that the message queue has the production message for more than a first preset time threshold; and a fourth sending module, which is used for the data consumer end to send a message queue connection request to the data production end when the data consumer end does not receive a heartbeat detection response for more than a second preset time threshold.
[0020] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned method for synchronizing business data.
[0021] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store 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 the above-mentioned method for synchronizing business data.
[0022] In the present disclosure, the data production end generates a data file based on the business data to be synchronized, and sends the production message to the preset switch. The preset switch broadcasts the production message to each message queue. Each message queue corresponds to a data consumer end. When the data consumer end monitors that the message queue has a production message, the data consumer end synchronizes the business data to be synchronized based on the production message. In the present disclosure, the data production end can first generate a data file, and then send the production message corresponding to the data file to the preset switch. The production message is broadcast to each message queue through the preset switch. When the data consumer end monitors that the corresponding message queue has a production message, the business data to be synchronized can be synchronized according to the production message, which can improve the timeliness of data synchronization and enhance the stability of data synchronization, effectively reduce the possibility of data synchronization failure, and thus solve the technical problems of poor timeliness and easy synchronization failure when synchronizing data between systems in the related technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0024] Figure 1 is a flowchart of an optional method for synchronizing business data according to an embodiment of the present invention;
[0025] Figure 2 is a schematic diagram of an optional business data synchronization architecture according to an embodiment of the present invention;
[0026] Figure 3 is a schematic diagram of an optional device for synchronizing service data according to an embodiment of the present invention;
[0027] Figure 4 The present invention is a hardware structure block diagram of an electronic device (or mobile device) for synchronizing business data according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0031] The following embodiments of the present invention can be applied to various systems / applications / devices for synchronizing business data. The present invention can effectively improve the timeliness of data demanders obtaining data and the stability of data demanders obtaining data by broadcasting production messages (including: delivery time, file path, file name, file type, etc.) to message queues, thereby improving data synchronization efficiency and system stability.
[0032] After system development and basic environment construction, the present invention has carried out scenario and data simulation, so that data demanders can obtain required data information stably and timely.
[0033] The present invention is described in detail below in conjunction with various embodiments.
[0034] Embodiment 1
[0035] According to an embodiment of the present invention, an embodiment of a method for synchronizing business data is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0036] Figure 1 is a flowchart of an optional method for synchronizing business data according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0037] Step S101, generating a data file based on the business data to be synchronized, wherein the data file corresponds to a production message.
[0038] Step S102, sending the production message to the preset switch, wherein the preset switch broadcasts the production message to each message queue, each message queue corresponds to a data consumer, and when the data consumer monitors that the message queue has a production message, the data consumer synchronizes the service data to be synchronized based on the production message.
[0039] Through the above steps, the data production end can generate a data file based on the business data to be synchronized, and send the production message to the preset switch. The preset switch broadcasts the production message to each message queue. Each message queue corresponds to a data consumer end. When the data consumer end monitors that the message queue has a production message, it synchronizes the business data to be synchronized based on the production message. In an embodiment of the present invention, the data production end can first generate a data file, and then send the production message corresponding to the data file to the preset switch, and broadcast the production message to each message queue through the preset switch. When the data consumer end monitors that the corresponding message queue has a production message, it can synchronize the business data to be synchronized according to the production message, which can improve the timeliness of data synchronization and enhance the stability of data synchronization, effectively reduce the possibility of data synchronization failure, and thus solve the technical problem of poor timeliness and easy synchronization failure when performing data synchronization between systems in the related technology.
[0040] The following is a detailed description of the embodiment of the present invention in combination with the above steps. The following steps can be applied to the data production end (ie, the data provider system).
[0041] In an embodiment of the present invention, the problems of data transmission timeliness and reliability can be solved by combining a preset message queue service (such as RABBITMQ service, RABBITMQ is an open source message agent software (i.e., message-oriented middleware) that implements the Advanced Message Queuing Protocol).
[0042] Optionally, before generating a data file based on the service data to be synchronized, the method further includes: determining a target switch architecture; and constructing a preset switch using a preset message queue service based on the target switch architecture, wherein the preset switch corresponds to a switch address.
[0043] In an embodiment of the present invention, a fan-out (FANOUT) type switch (EXCHANGE) named FANOUT_NOTICE may be defined in a preset message queue service (such as a RABBITMQ service), specifically: a target switch architecture (i.e., a fan-out architecture, which can broadcast messages to multiple message queues) may be determined first, and then based on the target switch architecture, a preset message queue service may be used to construct a preset switch (i.e., a fan-out switch FANOUT_NOTICE), the preset switch corresponding to a switch address, and multiple message queues (such as QUEUE_A, QUEUE_B, QUEUE_C, etc.) may be dynamically defined according to the number of data consumers.
[0044] Optionally, after building a preset switch using a preset message queue service, it also includes: sending a message notification request to the data consumer, wherein the data consumer responds to the message notification request and returns a response request, wherein the response request carries the consumer address; upon receiving the response request, building a message queue, and associating the queue address of the message queue with the switch address and the consumer address; sending the queue address to the data consumer, wherein the data consumer monitors the message queue based on the queue address.
[0045] In an embodiment of the present invention, after the preset switch is built, a message notification request can be sent to the data consumer (i.e., the data demander system) (the message notification request is used to notify the data consumer that it can obtain messages by monitoring the message queue associated with the preset switch), and the data consumer can respond to the message notification request and return a response request to the data producer (i.e., confirming to monitor the message and requesting to establish a monitoring connection, the response request carries the consumer address to facilitate the establishment of the corresponding connection). If the data producer receives the response request, it can build a message queue and associate the queue address of the message queue with the switch address and the consumer address (i.e., build a message queue that the preset switch can broadcast messages, and establish a monitoring connection between the message queue and the data consumer to facilitate the data consumer to monitor messages). The queue address can then be sent to the data consumer, and the data consumer can monitor the corresponding message queue based on the queue address.
[0046] Step S101, generating a data file based on the business data to be synchronized, wherein the data file corresponds to a production message.
[0047] Optionally, the step of generating a data file based on the business data to be synchronized includes: obtaining the business data to be synchronized from multiple data sources; classifying the business data to be synchronized to obtain classification results; based on the classification results, aggregating the synchronized business data belonging to the same type to generate a data file, wherein each data file corresponds to a file type and each data file corresponds to a file identifier.
[0048] In an embodiment of the present invention, the data production end can generate data files based on the business data to be synchronized (each data file corresponds to a corresponding production message). Specifically, the data production end can first obtain the business data to be synchronized from different data sources, and then count all the business data to be synchronized, and classify the business data to be synchronized to obtain a classification result (that is, data involving the same business type are classified as data of the same type). After that, according to the classification result, the synchronized business data belonging to the same type can be summarized to generate data files for the synchronized business data belonging to the same type. Each data file corresponds to a file type, and each data file corresponds to a file identifier (that is, a unique identifier of the file).
[0049] Optionally, after generating a data file based on the business data to be synchronized, it also includes: determining the file path for storing the data file; determining the delivery time for storing the data file to the storage space indicated by the file path; and generating a production message corresponding to the data file based on the file path, delivery time, file type and file identifier.
[0050] In the embodiment of the present invention, after the data provider system generates a data file, it can first determine the file path (i.e., the storage location of the file) where the data file is stored, and then determine the delivery time (i.e., the time when the file storage is completed) for storing the data file in the storage space indicated by the file path. Then, based on the file path, delivery time, file type, and file identifier, a production message corresponding to the data file is generated, and the production message is used to notify the data demander system how to obtain the required business data to be synchronized.
[0051] Step S102, sending the production message to the preset switch, wherein the preset switch broadcasts the production message to each message queue, each message queue corresponds to a data consumer, and when the data consumer monitors that the message queue has a production message, the data consumer synchronizes the service data to be synchronized based on the production message.
[0052] In an embodiment of the present invention, the data provider system, as a producer, sends the produced message (i.e., the production message, including the delivery time, file path, file name, file type, etc.) to the fan-out switch FANOUT_NOTICE (i.e., the preset switch). The preset switch can broadcast the production message to each message queue. Each message queue corresponds to a data consumer. The data consumer (i.e., the data demander system) reads the file arrival notification (i.e., the production message) by monitoring the message queue as a consumer, and processes the data file according to the message content of the production message (i.e., when the data consumer monitors that the message queue has a production message, it synchronizes the business data to be synchronized based on the production message).
[0053] Optionally, when the data consumer detects that the message queue has a production message, the data consumer performs steps of synchronizing the business data to be synchronized based on the production message, including: the data consumer parses the production message to obtain a parsing result, wherein the parsing result includes at least: the file type, delivery time, file path, and file identifier of the data file corresponding to the production message; when the file type meets the preset file type, the data consumer obtains the business data to be synchronized indicated by the file identifier from the storage space indicated by the file path when the delivery time arrives; the data consumer synchronizes the business data to be synchronized.
[0054] In the embodiment of the present invention, when the data consumer monitors that there is a production message on the corresponding message queue, the data consumer can synchronize the business data to be synchronized according to the production message, specifically: the obtained production message can be parsed first to obtain the parsing result, and the parsing result includes: the file type, delivery time, file path, file identifier, etc. of the data file corresponding to the production message. If the file type of the data file meets the preset file type (i.e., the required file type pre-set by the data consumer, such as the fund type, etc.), then when the current time reaches the delivery time, the business data to be synchronized indicated by the file identifier can be obtained from the storage space indicated by the file path, and then the business data to be synchronized can be synchronized.
[0055] Optionally, the synchronization method also includes: when the data consumer end does not detect that the message queue has any production message for a period of time exceeding a first preset time threshold, the data consumer end sends a heartbeat detection request to the message queue; when the data consumer end does not receive a heartbeat detection response for a period of time exceeding a second preset time threshold, the data producer end sends a message queue connection request to the data producer end.
[0056] In an embodiment of the present invention, if the data consumer does not monitor that the message queue has a production message for more than a first preset time threshold (for example, one day), a heartbeat detection request may be sent to the corresponding message queue (for determining whether there is still a valid connection with the message queue). If the data consumer does not receive a heartbeat detection response for more than a second preset time threshold (for example, 5 minutes), a monitoring connection may be re-established with the message queue (i.e., a message queue connection request may be sent to the data producer).
[0057] Figure 2 is a schematic diagram of an optional business data synchronization architecture according to an embodiment of the present invention, such as Figure 2 As shown, it includes: a data provider system, a data demander system (for example, data demander system A, data demander system B, data demander system C), a switch, and a queue (for example, queue QUEUE_A, queue QUEUE_B, queue QUEUE_C). The specific synchronization process is as follows:
[0058] After the data provider system generates a file, it can send a file arrival notification (including: delivery time, file path, file name, file type, etc.) to the switch. The switch can broadcast the file arrival notification to the queue. The data demander system, as a consumer, can monitor the queue, read the file arrival notification, and perform file synchronization processing based on the message content of the file arrival notification.
[0059] In the embodiments of the present invention, the timeliness and stability of data interaction can be effectively improved, and the problem of inconsistent system data synchronization notification standards can be effectively solved.
[0060] The following is a detailed description in conjunction with another embodiment.
[0061] Embodiment 2
[0062] A synchronization device for business data provided in this embodiment includes multiple implementation units, each of which corresponds to each implementation step in the above-mentioned embodiment 1.
[0063] Figure 3 is a schematic diagram of an optional device for synchronizing service data according to an embodiment of the present invention. Figure 3 As shown, the synchronization device may include: a generation unit 30, a synchronization unit 31, wherein:
[0064] A generating unit 30, configured to generate a data file based on the business data to be synchronized, wherein the data file corresponds to a production message;
[0065] The synchronization unit 31 is used to send the production message to the preset switch, wherein the preset switch broadcasts the production message to each message queue. Each message queue corresponds to a data consumer. When the data consumer monitors that the message queue has a production message, the data consumer synchronizes the business data to be synchronized based on the production message.
[0066] In the above-mentioned synchronization device, the data production end can generate a data file based on the business data to be synchronized through the generation unit 30, and send the production message to the preset switch through the synchronization unit 31. The preset switch broadcasts the production message to each message queue. Each message queue corresponds to a data consumer end. When the data consumer end monitors that the message queue has a production message, the data consumer end synchronizes the business data to be synchronized based on the production message. In an embodiment of the present invention, the data production end can first generate a data file, and then send the production message corresponding to the data file to the preset switch, and broadcast the production message to each message queue through the preset switch. When the data consumer end monitors that the corresponding message queue has a production message, it can synchronize the business data to be synchronized according to the production message, which can improve the timeliness of data synchronization and improve the stability of data synchronization, effectively reduce the possibility of data synchronization failure, and thus solve the technical problem of poor timeliness and easy synchronization failure when performing data synchronization between systems in the related technology.
[0067] Optionally, the synchronization device also includes: a first determination module, used to determine the target switch architecture before generating a data file based on the business data to be synchronized; a first construction module, used to construct a preset switch based on the target switch architecture using a preset message queue service, wherein the preset switch corresponds to a switch address.
[0068] Optionally, the synchronization device also includes: a first sending module, which is used to send a message notification request to the data consumer end after building a preset switch using a preset message queue service, wherein the data consumer end responds to the message notification request and returns a response request, wherein the response request carries the consumer end address; a second building module, which is used to build a message queue when receiving the response request, and associate the queue address of the message queue with the switch address and the consumer end address; a second sending module, which is used to send the queue address to the data consumer end, wherein the data consumer end monitors the message queue based on the queue address.
[0069] Optionally, the generation unit includes: a first acquisition module, used to acquire the business data to be synchronized from multiple data sources; a first classification module, used to classify the business data to be synchronized and obtain classification results; a first generation module, used to aggregate the synchronized business data belonging to the same type based on the classification results, and generate data files, wherein each data file corresponds to a file type and each data file corresponds to a file identifier.
[0070] Optionally, the synchronization device also includes: a second determination module, used to determine the file path for storing the data file after generating the data file based on the business data to be synchronized; a third determination module, used to determine the delivery time for storing the data file to the storage space indicated by the file path; and a second generation module, used to generate a production message corresponding to the data file based on the file path, delivery time, file type and file identifier.
[0071] Optionally, the synchronization unit includes: a first parsing module, used by the data consumer to parse the production message and obtain a parsing result, wherein the parsing result includes at least: the file type, delivery time, file path, and file identifier of the data file corresponding to the production message; a second acquisition module, used by the data consumer to acquire the business data to be synchronized indicated by the file identifier from the storage space indicated by the file path when the delivery time arrives if the file type meets the preset file type; and a first synchronization module, used by the data consumer to synchronize the business data to be synchronized.
[0072] Optionally, the synchronization device also includes: a third sending module, which is used for the data consumer end to send a heartbeat detection request to the message queue when the data consumer end does not detect any production message in the message queue for more than a first preset time threshold; a fourth sending module, which is used for the data consumer end to send a message queue connection request to the data producer end when the data consumer end does not receive a heartbeat detection response for more than a second preset time threshold.
[0073] The above-mentioned synchronization device may also include a processor and a memory. The above-mentioned generation unit 30, synchronization unit 31, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to implement corresponding functions.
[0074] The processor includes a kernel, which retrieves the corresponding program unit from the memory. The kernel can be set to one or more, and the production message is sent to the preset switch by adjusting the kernel parameters.
[0075] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.
[0076] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that is initialized with the following method steps: the data production end generates a data file based on the business data to be synchronized, and sends the production message to a preset switch. The preset switch broadcasts the production message to each message queue. Each message queue corresponds to a data consumer end. When the data consumer end monitors that the message queue has a production message, the data consumer end synchronizes the business data to be synchronized based on the production message.
[0077] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium including a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned method for synchronizing business data.
[0078] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned method for synchronizing business data.
[0079] Figure 4 1 is a hardware structure block diagram of an electronic device (or mobile device) for a method for synchronizing business data according to an embodiment of the present invention. Figure 4 As shown, the electronic device may include one or more ( Figure 4 402a, 402b, ..., 402n are used to illustrate) processor 402 (processor 402 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), memory 404 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 4 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 4 More or fewer components as shown, or with Figure 4 Different configurations are shown.
[0080] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0081] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0082] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0083] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0084] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0085] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of 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: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0086] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for synchronizing business data, It is characterized in that Applied to data production, including: Generate a data file based on the business data to be synchronized, wherein the data file corresponds to a production message; The production message is sent to a preset switch, wherein the preset switch broadcasts the production message to each message queue, each of which corresponds to a data consumer end, and when the data consumer end monitors that the message queue has the production message, the data consumer end synchronizes the business data to be synchronized based on the production message.
2. The synchronization method according to claim 1, It is characterized in that Before generating a data file based on the business data to be synchronized, the following steps are also included: Determine the target switch architecture; Based on the target switch architecture, the preset switch is constructed by using a preset message queue service, wherein the preset switch corresponds to a switch address.
3. The synchronization method according to claim 2, It is characterized in that After the preset switch is constructed by using the preset message queue service, the following steps are also included: Sending a message notification request to the data consumer, wherein the data consumer responds to the message notification request and returns a response request, wherein the response request carries the consumer address; In case of receiving the response request, constructing the message queue, and associating the queue address of the message queue with the switch address and the consumer end address; The queue address is sent to the data consumer, wherein the data consumer monitors the message queue based on the queue address.
4. The synchronization method according to claim 1, It is characterized in that The steps of generating a data file based on the business data to be synchronized include: Acquire the business data to be synchronized from multiple data sources; Classifying the service data to be synchronized to obtain a classification result; Based on the classification result, the synchronous business data belonging to the same type are aggregated to generate the data files, wherein each of the data files corresponds to a file type and each of the data files corresponds to a file identifier.
5. The synchronization method according to claim 4, It is characterized in that After generating the data file based on the business data to be synchronized, it also includes: Determine the file path where the data file is stored; Determining a delivery time for storing the data file in the storage space indicated by the file path; The production message corresponding to the data file is generated based on the file path, the delivery time, the file type, and the file identifier.
6. The synchronization method according to claim 1, It is characterized in that When the data consumer monitors that the message queue has the production message, the step of synchronizing the service data to be synchronized based on the production message includes: The data consumer parses the production message to obtain a parsing result, wherein the parsing result at least includes: a file type, a delivery time, a file path, and a file identifier of the data file corresponding to the production message; When the file type meets the preset file type, the data consumer obtains the to-be-synchronized service data indicated by the file identifier from the storage space indicated by the file path when the delivery time arrives; The data consumption end performs synchronization processing on the service data to be synchronized.
7. The synchronization method according to claim 1, It is characterized in that The synchronization method further comprises: When the data consumer fails to monitor that the message queue has the production message for a period exceeding a first preset time threshold, the data consumer sends a heartbeat detection request to the message queue; When the data consumption end does not receive a heartbeat detection response after exceeding a second preset time threshold, the data production end sends a message queue connection request to the data production end.
8. A device for synchronizing business data, It is characterized in that Applied to data production, including: A generating unit, configured to generate a data file based on the business data to be synchronized, wherein the data file corresponds to a production message; A synchronization unit is used to send the production message to a preset switch, wherein the preset switch broadcasts the production message to each message queue, each of which corresponds to a data consumer end, and when the data consumer end monitors that the message queue has the production message, the data consumer end synchronizes the business data to be synchronized based on the production message.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for synchronizing business data according to any one of claims 1 to 7.
10. An electronic device, It is characterized in that It includes one or more processors and a memory, wherein the memory is used to store 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 the business data synchronization method described in any one of claims 1 to 7.
