Test data synchronization method, device, equipment and medium based on message queue
By adopting the message queue-based data synchronization method in banking system testing, the problem of difficulty in ensuring the independence and stability of test data in traditional methods is solved, one-way data synchronization is achieved, management costs are reduced and testing efficiency is improved.
Patent Information
- Application Number
- CN202010578990.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-23
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2040-06-23
AI Technical Summary
In banking system testing, traditional methods are difficult to ensure the independence and stability of test data, leading to increased testing problems and management costs.
The test data synchronization method based on message queue is used to send data change messages to the message queue through the verification database, and pull and synchronize data according to the needs of the test database to achieve one-way synchronization of data, thereby solving the problem of data independence and stability.
Effectively manage and use test data, reduce test data management costs, meet the stability, security and independence requirements of test data, and improve the efficiency and sequence of system testing.
Smart Images

Figure CN111767343B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a test data synchronization method and device based on a message queue, equipment and medium. Background Art
[0002] The banking system has many subsystems. System testing has the characteristics of long testing process, wide data range and high data requirements. While maintaining the requirements of rapid development of business functions and the security of existing businesses, the system test data needs to meet the following requirements: First, the data must be stable. All kinds of customer data from the beginning of bank computerization need to be inherited to meet the testing requirements of different scenarios; second, different test groups need relatively independent test data during data use.
[0003] like Figure 1 As shown, traditional bank testers usually operate directly on the test database by simulating tellers or using test scripts or manual number changes. In order to facilitate operation or have special requirements for data, they will use non-standard methods to add, modify, and delete data. The independence and stability of the test data cannot be effectively guaranteed, which in turn causes testing problems. Summary of the invention
[0004] In view of the problems in the prior art, the present invention provides a test data synchronization method and device based on a message queue, an electronic device and a computer-readable storage medium, which can at least partially solve the problems in the prior art.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] In a first aspect, a test data synchronization method based on a message queue is provided, comprising:
[0007] Sending a data change message to a message queue in response to a data change in a verification database;
[0008] The corresponding data change message in the message queue is pulled according to the needs of each test database, and the data in the corresponding test database is modified according to the data change message to achieve one-way synchronization of the test data from the verification database to the test database.
[0009] Furthermore, the message queue is kafka.
[0010] Furthermore, the corresponding data change message in the message queue is pulled according to the requirements of each test database, including:
[0011] Pull the corresponding data change message in the message queue according to the data synchronization screening parameter table preset by each test database.
[0012] Further, before sending a data change message to the message queue in response to the data change in the verification database, the method further includes:
[0013] Get simulated trading data;
[0014] Conducting a legality check on the simulated transaction data;
[0015] If the check passes, the data in the verification database is modified according to the simulated transaction data.
[0016] Furthermore, when the data in the verification database is modified according to the simulated transaction data, the modification action and the data before the modification are saved.
[0017] In a second aspect, a test data synchronization device based on a message queue is provided, comprising:
[0018] A message sending module, in response to data changes in the verification database, sends a data change message to the message queue;
[0019] The message pulling module pulls the corresponding data change messages in the message queue according to the needs of each test database;
[0020] The data one-way synchronization module modifies the data in the corresponding test database according to the data change message to achieve one-way synchronization of the test data from the verification database to the test database.
[0021] Furthermore, the message queue is kafka.
[0022] Furthermore, the message pulling module includes:
[0023] The message pulling unit pulls the corresponding data change message in the message queue according to the data synchronization screening parameter table preset in each test database.
[0024] According to a third aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned message queue-based test data synchronization method when executing the program.
[0025] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned test data synchronization method based on a message queue are implemented.
[0026] The present invention provides a test data synchronization method and apparatus, equipment and medium based on a message queue. The method comprises: sending a data change message to a message queue in response to a data change in a verification database; pulling the corresponding data change message in the message queue according to the needs of each test database, and modifying the data in the corresponding test database according to the data change message to realize one-way synchronization of test data from the verification database to the test database, wherein a hierarchical architecture of the verification database and the test database is adopted, and the verification database synchronizes data to the test database in one direction through a message queue, thereby solving the problems of test data independence and stability, effectively managing and using test data, and facilitating efficient and orderly system testing.
[0027] In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0029] Figure 1 Schematic diagram of the architecture tested for existing banks;
[0030] Figure 2 This is a schematic diagram of the architecture of a bank test in an embodiment of the present invention;
[0031] Figure 3 The following is a flow chart of a test data synchronization method based on a message queue in an embodiment of the present invention. Figure 1 ;
[0032] Figure 4 A data synchronization screening parameter table in an embodiment of the present invention is shown;
[0033] Figure 5 The following is a flow chart of a test data synchronization method based on a message queue in an embodiment of the present invention. Figure 2 ;
[0034] Figure 6 The application scenario of the test data synchronization method based on the message queue in the embodiment of the present invention is shown;
[0035] Figure 7 The model of the message queue in the embodiment of the present invention is shown;
[0036] Figure 8The distributed message reading model in the embodiment of the present invention is shown;
[0037] Fig. 9 The detailed process of sending the data change status to the message center through a message after verifying the database modification in the embodiment of the present invention is shown;
[0038] Fig.10 The detailed process of completing one-way synchronization from the verification database to the test database by consuming messages from the message center in an embodiment of the present invention is shown;
[0039] Fig.11 is a structural block diagram of a test data synchronization device based on a message queue in an embodiment of the present invention;
[0040] Fig.12 4 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0042] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0043] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or apparatuses.
[0044] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0045] Figure 2The schematic diagram of the bank test architecture in the embodiment of the present invention uses a verification database B1, a message queue (also called a message center) S1 and multiple test databases B21-B2 n The three-tier architecture is formed. The verification database transmits the modified data to the message queue S1 in one direction. Each test database then pulls the required data from the message queue S1 according to the data needs of the database, realizing the data transmission from the verification database S1 to multiple test databases B21~B2 n One-way synchronization.
[0046] Among them, if you need to modify the data in the verification database, such as adding test data or modifying test data, a user with verification authority is required to log in to the verification database to perform the operation to prevent the test data from being turned into erroneous data by erroneous programs or manual modification of the database, and to avoid using non-standard methods to add, modify, and delete data, resulting in erroneous operations such as full table parameters, and even the test data will become unusable and unrepairable after a period of time.
[0047] During testing, testers call the data in the test database and modify the test data in the test database according to requirements. Each test database is independent of each other, isolating the test data used by testers of different products to avoid test problems caused by a large number of data problems due to testers using other testers' important data.
[0048] In summary, the one-way synchronization of test data can solve the problem of test data usage management, reduce the cost of test data management, and meet the requirements of stable, available, secure and independent test data.
[0049] Figure 3 The following is a flow chart of a test data synchronization method based on a message queue in an embodiment of the present invention. Figure 1 ;like Figure 3 As shown, the test data synchronization method based on the message queue may include the following contents:
[0050] Step S100: sending a data change message to a message queue in response to a data change in a verification database;
[0051] Specifically, when the data in the verification database changes, such as when it is added or modified, a data change message is sent to the message queue.
[0052] The data change message includes: message subject, information before modification, information after modification, etc. The message subject means that each message published to the message center has a category, which is called the message subject. For example, if the data in the table in the verification database (table name mobile banking information table PTHHKWAP) is modified, a message with the message subject DRP_PTHHKWAP is generated.
[0053] For example, when a table data record in a verification database is changed, the table name and data field changes are sent to a message queue.
[0054] Step S200: Pull corresponding data change messages in the message queue according to the requirements of each test database;
[0055] Specifically, each test database reads messages from a message queue, filters data that meets the practical requirements of the test database according to the message content, and synchronizes the data to the current test database.
[0056] Among them, when the message filtering is completed, the offset is submitted, indicating that the message has been consumed.
[0057] Step S300: modifying the data in the corresponding test database according to the data change message to achieve one-way synchronization of the test data from the verification database to the test database.
[0058] The test database data is located according to the information before modification in the message, and the test database data is modified according to the information after modification in the message to achieve data synchronization.
[0059] The test data synchronization method based on message queue provided in the embodiment of the present invention adopts a hierarchical architecture of verification database and test database. The verification database synchronizes data to the test database unidirectionally through the message queue, thereby solving the problems of test data independence and stability, effectively managing and using test data, and facilitating efficient and orderly system testing.
[0060] In an optional embodiment, the message queue may be kafka.
[0061] Kafka is a high-throughput distributed publish-subscribe messaging system. Kafka unifies online and offline message processing through Hadoop's parallel loading mechanism, provides real-time messages through clusters, throughput drafts, message persistence, supports Hadoop parallel loading, and uses Kafka to synchronize data between the verification database and the test database, which can effectively improve data synchronization efficiency.
[0062] In an optional embodiment, step S200 specifically includes:
[0063] The corresponding data change message in the message queue is pulled according to the data synchronization screening parameter table preset in each test database.
[0064] Among them, bank transactions are operated by transaction tellers, and data synchronization screening is controlled by setting the data synchronization screening parameter table, such as Figure 4As shown, a data synchronization screening parameter table is defined for the message queue consumer program: the transaction teller is the operating teller of the bank transaction, which consists of 5 digits that do not start with 0, such as 12723. Each test database user is assigned a specific teller number, and a public teller number is created at the same time, which consists of 0+4 digits that do not start with 0, such as 01201; whether to download synchronously can be set to 1-yes and 2-no; the parameter effective date is composed of 4-digit year + 2-digit month + February date, separated by - in the middle, such as 1990-01-01; the parameter expiration date is composed of 4-digit year + 2-digit month + February date, separated by - in the middle, such as 2030-01-01; the status can be set to 1-normal and 2-invalid; the consumer program synchronizes the data to the test database by judging that the information in the message queue meets the conditions that the transaction teller is equal to the teller in the parameter table, the current date is within the effective date and expiration date range, the status is normal, and whether to download synchronously is 1-yes.
[0065] In an alternative embodiment, see Figure 5 , the test data synchronization method based on message queue may also include:
[0066] Step S400: obtaining simulated transaction data;
[0067] After the bank teller initiates the transaction, the tester conducts the transaction in the environment of the verification database through the assigned transaction teller, simulating the customer's electronic banking business. On the one hand, it can prevent the security risks of customer privacy leakage caused by importing data extracted from the real customer production environment into the test environment and the problem that the data extraction cannot meet the requirements of all characteristic customers. It can also prevent the inability to generate business function data that has been canceled in history through normal business interfaces, such as non-real-name accounts, etc., where existing bank transactions can no longer be opened. At the same time, generating data through simulated transactions can prevent manual modification of the database and the problem of data confusion and errors caused by cross-use of data between testers.
[0068] Step S500: performing a legality check on the simulated transaction data;
[0069] If the check passes, execute step S600; otherwise, execute step S700.
[0070] Among them, by checking the legitimacy of the data before storing and synchronizing it, it is possible to prevent non-compliant data from being introduced into the test phase and affecting the accuracy of the test.
[0071] Step S600: modifying the data in the verification database according to the simulated transaction data.
[0072] Specifically, when the simulated transaction data is compliant, the data in the verification database is modified according to the simulated transaction data, and the modification includes different methods such as adding, modifying, and deleting.
[0073] Step S700: End.
[0074] It is worth noting that when the data in the verification database is modified according to the simulated transaction data, the modification action and the data before the modification are saved to achieve data traceability, and data repair can also be performed when necessary.
[0075] To sum up, the test data synchronization method based on message queue provided by the embodiment of the present invention is suitable for bank test data synchronization, and can generate test data that meets both stability and independence, so as to solve the problem that testers need to devote a lot of energy to create test data and synchronize test data during their work. There is no need to import a large amount of data from real business in each project cycle, and the process of deforming sensitive data such as customer ID, name, mobile phone number, etc. before importing is eliminated. This prevents a large amount of data from being converted into erroneous data by erroneous programs or manual modification of the database after being used for a period of time, avoids the problem that testers use other people's data or tamper with data to meet test requirements, and meets the requirements of testers for data use and maintenance.
[0076] The database operation recording mechanism provided by the present invention records data and database operations, and sends the data information before and after the modification to Kafka.
[0077] By configuring the verification database + test database, the verification database data modification triggers the producer (i.e., the verification database) to send the modification information to the message queue. Each consumer (i.e., the test database) consumes the queue message and filters the messages that meet the operator tag corresponding to the current test database (the modification information includes the operator tag). The filtered data is synchronized to the test database, solving the data stability problem.
[0078] In an optional embodiment, the test database usage rights can be divided according to the test content. Each tester can only use standard transaction teller operations to verify the database to keep the verification database data stable. When the test database data is damaged, the correct data can be re-imported from the verification database through database operations.
[0079] By adopting the above technical solution, the problem of data independence is solved. The data of each verification database is generated by transactions in the verification database, or by manually entering the test database data, which meets the data usage requirements of the testers in this test group and does not affect the data of other test databases.
[0080] In order to enable those skilled in the art to better understand the present invention, the implementation process of the present invention is described below by way of example:
[0081] Figure 6 The application scenario of the test data synchronization method based on the message queue in the embodiment of the present invention is shown; Figure 6 As shown, the structure of verification database + multiple test databases is used. After standardizing the operating permissions of testers, in the verification database, the test needs to maintain the test data by initiating normal transactions.
[0082] Testers on different product lines correspond to different test databases and continue to use the old permissions to modify data. When testers on product line A need to use data, they use the assigned transaction teller number A to create data in the verification environment, and use the one-way synchronization function to synchronize this verification environment to the test database of product line A. If tester A wants to use this data for other product lines, he uses the assigned public teller number to create data in the verification environment, and uses the one-way synchronization function to synchronize this verification environment to the test databases of all product lines. In the early stages of the project, each product test submits data requirements, distinguishes between public data and private data of this product line, and completes incremental data creation in the verification database. During the project testing phase, only the test database assigned to this product line needs to be used for testing, and there is no horizontal impact on the use of existing data by each product line.
[0083] Figure 7 The model of the message queue in the embodiment of the present invention is shown; the model of the message queue is a distributed stream platform.
[0084] The message producer (Producer) is responsible for generating and sending messages to the message center (Broker). The verification database assumes the role of message producer. When the table data record in the verification database changes, the table name and data field changes are sent to the message center (i.e., the message queue).
[0085] The message center is responsible for message storage, confirmation, and retry.
[0086] The message consumer (Consumer) is responsible for pulling or receiving messages from the message center (Broker) and processing them accordingly. The test database assumes the role of a message consumer, reads messages from the message center, filters them according to the message content, and synchronizes the data that meets the use requirements of this test database to the current test database.
[0087] Each message published to the message center has a category, which is called the message topic.
[0088] Consumer Group: Consumers in a group subscribe to the same topic, and each consumer receives messages from a part of the partitions of the topic.
[0089] Figure 8 The distributed message reading model in the embodiment of the present invention is shown; wherein the message center adopts the distributed message reading model.
[0090] The number of partitions is specified when creating a message topic. When the producer sends a message, the message will be evenly distributed to each partition. The position of each message on the Kafka server is called the offset. Offset is a long number that uniquely marks a message. Consumers track and record it through (offset, partition, topic). Each consumer will be assigned an independent GroupID, and each GroupID will independently record consumption. Consumers with different GroupIDs have completely independent consumption information. For example, consumers with GroupID A only need to care about the offset, and do not need to care about the specific information of the message storage. They can clearly know how many messages of this topic have been processed and how many messages of this topic are still to be processed, which facilitates stable and independent message processing.
[0091] The following is a comprehensive analysis of the process from transaction initiation to data synchronization, taking the common electronic banking opening transaction of banks as an example:
[0092] Fig. 9 The detailed process of sending the data change status to the message center through a message after verifying the database modification in an embodiment of the present invention is shown, including the following steps:
[0093] Step S901: A bank teller initiates a transaction.
[0094] The bank teller initiates the transaction, and the tester conducts the transaction in the environment of the verification database through the assigned transaction teller (teller number 12723), simulating a customer opening an electronic banking business.
[0095] Step S902: Transaction read and write database.
[0096] Transaction reading and writing database, transaction entry, submission to the backend database, transaction reading and writing to verify database data;
[0097] Step S903: modify the verification database data;
[0098] Specifically, the transaction data passes the legality check and modifies the verification database data (new mobile banking information table PTHHKWAP record, new electronic banking registration card list PTHRSARM, new customer security media table BTHEBPCF, used to store customer mobile phone number, registration card, U shield and other related information).
[0099] Step S904: Use the transaction inheritance base class to save the database modification action.
[0100] Specifically, save the actions involved in verifying database modifications in the transaction, save tablename-table name, operflag-operation type, including update-modification, delete-deletion, insert-addition, as well as the table data before and after the table record is modified.
[0101] Step S905: The transaction base class creates KafkaProducer;
[0102] KafkaProducer is the message producer.
[0103] Step S906: Send message send(Topic, message).
[0104] The message topic Topic is named after tablename, and the message is sent to the Broker message processing center. The message topics are DRP_PTHHKWAP, DRP_PTHRSARM, and DRP_BTHEBPCF respectively. Three messages are sent to the message processing center, and the content is the SQL statement of the insert action.
[0105] Fig.10 The detailed process of completing the one-way synchronization from the verification database to the test database by consuming the message of the message center in the embodiment of the present invention is shown, wherein the consumer program of each test environment synchronizes the data changes of the verification database to the test database in a filtered manner through the message of the consumption message center, and the detailed process of completing the one-way synchronization from the verification database to the test database is specifically including the following steps:
[0106] Step S1001: Create a consumer.
[0107] Each test data environment consumer program creates a Consumer message consumer.
[0108] Step S1002: Subscribe to the topic Subscribe (Topic);
[0109] At the same time, verify that the message subjects sent by the database correspond one to one. In this example, the message subjects are DRP_PTHHKWAP, DRP_PTHRSARM, and DRP_BTHEBPCF.
[0110] Step S1003: Test database configuration consumption program, configure message screening tag (transaction teller number);
[0111] Specifically, the environment to which the test database belongs configures a consumer program, configures a data synchronization screening parameter table, and maintains the transaction teller number corresponding to the data that needs to be synchronized to the current test database in the data synchronization screening parameter table.
[0112] Step S1004: Pull the message poll(), and download the message that meets the screening condition (current test environment belongs to the teller / public teller);
[0113] Each test database consumes the message queue. In this example, the GroupID of the e-bank test server is defined as F-EBANK, and other test servers name their own GroupIDs according to the naming rules of the supplementary name.
[0114] Step S1005: Submit the offset commit();
[0115] Specifically, committing the offset commit() indicates that the message has been consumed.
[0116] Step S1006: Locate the test database data according to the information before modification in the message, and modify the test database data according to the information after modification in the message;
[0117] For example, if the verification database (fund test database) finds that the teller number of these three messages is 12723, which does not meet the requirements of the fund test database, the data change will not be synchronized; if the verification database (electronic banking test database) finds that the teller number of these three messages is 12723, which meets the requirements of the electronic banking test database, the data change SQL in the message will be executed in the test database to achieve data synchronization for this electronic banking customer, so that the electronic banking test data is independent in the electronic banking test database.
[0118] After step S1006 is completed, the next information can be read and the data synchronization step can be repeated.
[0119] Based on the same inventive concept, the embodiments of the present application also provide a test data synchronization device based on a message queue, which can be used to implement the method described in the above embodiment, as described in the following embodiments. Since the principle of solving the problem by the test data synchronization device based on a message queue is similar to the above method, the implementation of the test data synchronization device based on a message queue can refer to the implementation of the above method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0120] Fig.11 is a structural block diagram of a test data synchronization device based on a message queue in an embodiment of the present invention. Fig.11As shown, the test data synchronization device based on message queue specifically includes: a message sending module 10 , a message pulling module 20 and a data unidirectional synchronization module 30 .
[0121] The message sending module 10 sends a data change message to the message queue in response to the data change in the verification database;
[0122] The message queue is kafka.
[0123] The message pulling module 20 pulls the corresponding data change messages in the message queue according to the requirements of each test database;
[0124] The data one-way synchronization module 30 modifies the data in the corresponding test database according to the data change message to achieve one-way synchronization of the test data from the verification database to the test database.
[0125] The message queue-based test data synchronization device provided in the embodiment of the present invention adopts a hierarchical architecture of a verification database and a test database. The verification database synchronizes data to the test database unidirectionally through a message queue, thereby solving the problems of test data independence and stability, effectively managing and using test data, and facilitating efficient and orderly system testing.
[0126] In an optional embodiment, the message pulling module includes: a message pulling unit, which pulls corresponding data change messages in the message queue according to a data synchronization screening parameter table preset in each test database.
[0127] The devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is an electronic device, and the electronic device may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0128] In a typical example, the electronic device specifically includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the above-mentioned test data synchronization method based on the message queue are implemented.
[0129] Reference below Fig.12 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application.
[0130] like Fig.12As shown, the electronic device includes a central processing unit (CPU) 601, which can perform various appropriate operations and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for system operation are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0131] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed as needed as the storage section 608.
[0132] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned test data synchronization method based on a message queue when executed by a processor.
[0133] In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 609 , and / or installed from the removable medium 611 .
[0134] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0135] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0136] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0137] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0139] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0140] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0141] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0142] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0143] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A test data synchronization method based on message queue, It is characterized in that include: Sending a data change message to a message queue in response to a data change in a verification database; Pull the corresponding data change message in the message queue according to the needs of each test database; Modify the data in the corresponding test database according to the data change message to achieve one-way synchronization of the test data from the verification database to the test database; the verification database corresponds to one message queue and corresponds to multiple test databases; Pulling the corresponding data change message in the message queue according to the requirements of each test database includes: Pull the corresponding data change message in the message queue according to the data synchronization screening parameter table preset in each test database; The test data synchronization method based on the message queue also includes: If the data synchronization screening parameter table includes a specific teller number, determining the test database corresponding to the specific teller number as the test database to be synchronized; If the data synchronization screening parameter table includes a public teller number, all test databases are determined as test databases to be synchronized; The data synchronization screening parameter table also includes whether to download synchronously, parameter effective date, parameter expiration date and status; accordingly, the test data synchronization method based on the message queue also includes: If the consumer program determines that the information in the message queue satisfies the teller information in the data synchronization screening parameter table, and the current date is within the interval between the parameter effective date and the parameter expiration date, and the status is normal, and the download is synchronized, the data will be synchronized to the test database; The test data synchronization method based on the message queue also includes: Step S1001: Create a consumer; Step S1002: Subscribe to a topic; Step S1003: Test the database configuration consumer program and configure the message filtering tag; Step S1004: Pull messages and download messages that meet the screening conditions; Step S1005: Submit the offset; Step S1006: Locate the test database data according to the information before modification in the message, and modify the test database data according to the information after modification in the message; After the steps of locating the test database data according to the information before modification in the message and modifying the test database data according to the information after modification in the message, the next message is read and steps S1004 to S1006 are repeated.
2. The test data synchronization method based on message queue according to claim 1, It is characterized in that The message queue is kafka.
3. The test data synchronization method based on message queue according to claim 1, It is characterized in that Before sending a data change message to the message queue in response to the data change in the verification database, the method further includes: Get simulated trading data; Conducting a legality check on the simulated transaction data; If the check passes, the data in the verification database is modified according to the simulated transaction data.
4. According to the test data synchronization method based on message queue according to claim 3, It is characterized in that When the data in the verification database is modified according to the simulated transaction data, the modification action and the data before the modification are saved.
5. A test data synchronization device based on message queue, It is characterized in that include: A message sending module, in response to data changes in the verification database, sends a data change message to the message queue; A message pulling module pulls the corresponding data change messages in the message queue according to the needs of each test database; A one-way data synchronization module, which modifies the data in the corresponding test database according to the data change message to achieve one-way synchronization of the test data from the verification database to the test database; The verification database corresponds to a message queue and corresponds to multiple test databases; The message pulling module includes: A message pulling unit, pulling corresponding data change messages in the message queue according to a data synchronization screening parameter table preset in each test database; The message queue-based test data synchronization device is also used for: If the data synchronization screening parameter table includes a specific teller number, determining the test database corresponding to the specific teller number as the test database to be synchronized; If the data synchronization screening parameter table includes a public teller number, all test databases are determined as test databases to be synchronized; The data synchronization screening parameter table also includes whether to download synchronously, parameter effective date, parameter expiration date and status; accordingly, the test data synchronization device based on the message queue is also used for: If the consumer program determines that the information in the message queue satisfies the teller information in the data synchronization screening parameter table, and the current date is within the interval between the parameter effective date and the parameter expiration date, and the status is normal, and the download is synchronized, the data will be synchronized to the test database; The message queue-based test data synchronization device is also used for: Step S1001: Create a consumer; Step S1002: Subscribe to a topic; Step S1003: Test the database configuration consumer program and configure the message filtering tag; Step S1004: Pull messages and download messages that meet the screening conditions; Step S1005: Submit the offset; Step S1006: Locate the test database data according to the information before modification in the message, and modify the test database data according to the information after modification in the message; After the steps of locating the test database data according to the information before modification in the message and modifying the test database data according to the information after modification in the message, the next message is read and steps S1004 to S1006 are repeated.
6. The test data synchronization device based on message queue according to claim 5, It is characterized in that The message queue is kafka.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the steps of the message queue-based test data synchronization method according to any one of claims 1 to 4 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the message queue-based test data synchronization method described in any one of claims 1 to 4 are implemented.
