Message configuration method, electronic device and readable storage medium
By obtaining and merging database change data and configuring message content, the problems of high coupling degree and long customized development cycle in asynchronous interaction between systems are solved, and field-level customized configuration of messages and efficient online process are realized.
Patent Information
- Application Number
- CN202011286196.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-17
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2040-11-17
AI Technical Summary
In the asynchronous interaction between systems, the existing technology has problems such as high system coupling, problems with message middleware affecting the operation of the business system, and long customized development cycles to be launched.
By obtaining the changed database data in the database, performing merging operations, obtaining the fields of the table where the merged database data corresponds to the message, and configuring the message content according to the fields required by the message, realizing field-level configuration of the message.
It realizes field-level customizable configuration and online of messages, reduces the complexity of business code, simplifies business system maintenance, and does not require restarting of services when going online, and does not affect the operation of business system.
Smart Images

Figure CN112416975B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computers, and in particular to a message configuration method, an electronic device and a readable storage medium. Background Art
[0002] In the asynchronous interaction process between systems, the common method is to send messages. To achieve message sending, the code for message sending is usually added after the business data is written in the business code. There are problems such as high system coupling and problems with the message middleware directly affecting the operation of the business system. In addition, when there are many business parties, if each business party requires to receive only the messages of the field changes they need, there are problems such as long customization development cycle and cumbersome online launch. Summary of the invention
[0003] The present invention aims to solve at least one of the above technical problems.
[0004] To this end, a first objective of the present invention is to provide a message configuration method.
[0005] A second objective of the present invention is to provide an electronic device.
[0006] A third object of the present invention is to provide a readable storage medium.
[0007] To achieve the first purpose of the present invention, the technical solution of the present invention provides a message configuration method, including: obtaining changed database data in a database; merging the changed database data to obtain merged database data; obtaining the fields of the table where the message is located corresponding to the merged database data; and configuring the content of the message according to the fields required by the message.
[0008] In this technical solution, the fields of the table where the message is located corresponding to the merged database data are obtained, and the message content is configured according to the required fields, thereby realizing field-level configuration of the message, and then realizing customizable configuration and online release of field-level messages. This will not increase the complexity of the business code, making the business system maintenance simple. In addition, there is no need to restart the service when going online, and there is no impact on the operation of the business system.
[0009] In addition, the above technical solution of the present invention may also have the following additional technical features:
[0010] In the above technical solution, obtaining the changed database data in the database includes: building a log parsing service; and obtaining the changed database data through the log synchronization parsing service.
[0011] By building a log parsing service, configuring the database changes, and obtaining the changed database data, only a small amount of changed database data needs to be obtained through the above method, which makes code writing simple and saves CPU resources.
[0012] In any of the above technical solutions, the log parsing service follows the master-slave protocol.
[0013] The constructed log parsing service follows the master-slave protocol of the database. By adopting the master-slave protocol, the changed database data in the database is synchronized, saving CPU resources.
[0014] In any of the above technical solutions, a merge operation is performed on the changed database data to obtain the merged database data, including: parsing the previous value and the next value of the changed database data; performing a merge operation based on the previous value and the next value to obtain the previous value and the next value of the merged database data, and obtaining the merged database data.
[0015] Through the merge operation, the process of changing the field values in the data table is simplified, the complexity of the code is reduced, and subsequent system maintenance is facilitated
[0016] In any of the above technical solutions, when the merge operation is performed on the changed database data, single-threaded processing is used to obtain the database data.
[0017] The merge operation needs to be processed in a single thread to ensure that each change in the field value can be obtained, and then the process of continuous change of the field value can be identified to implement the merge operation.
[0018] In any of the above technical solutions, the message configuration method also includes: the log parsing service persists the processed location to the distributed application coordination service.
[0019] By monitoring the running status of tasks, the accuracy of log parsing services can be improved, and alarms can be used to prompt when problems occur, making the prompts more intuitive and easier to find.
[0020] In any of the above technical solutions, obtaining the fields of the table where the message corresponding to the merged database data is located includes: generating tasks according to the configuration file; obtaining the tasks triggered by the merged database data; and obtaining the fields of the table where the message corresponding to the tasks is located.
[0021] In this technical solution, the task triggered by the merged database data is obtained, and the field of the table where the task corresponding to the message is located is obtained. Based on the obtained message, the message content is configured according to the required fields. The message and business code are separated, and there is no coupling. When problems occur in the message middleware, it does not affect the normal operation of the business system, thereby improving the stability of the operation of the business system. In addition, there is no need to restart the service when going online, and there is no impact on the operation of the business system.
[0022] In any of the above technical solutions, the message configuration method also includes: configuring a master library and a slave library for the log parsing service; based on the interruption of the main library, the slave library switches to the main library for operation, and during the switching process, the site pushes forward the target time.
[0023] By setting up the master database and slave database, when the terminal runs into an abnormal situation, the slave database can be switched to the master database to continue running, which improves the stability of the system operation. When switching, the site automatically advances the target time during the switching process to ensure that no data is lost and the data is accurate.
[0024] To achieve the second purpose of the present invention, the technical solution of the present invention provides an electronic device, including: a memory and a processor, the memory stores a computer program, and the processor executes the computer program; wherein, when the processor executes the computer program, it implements the steps of the message configuration method of any technical solution of the present invention.
[0025] The electronic device provided by the technical solution of the present invention implements the steps of the message configuration method of any technical solution of the present invention, and thus has all the beneficial effects of the message configuration method of any technical solution of the present invention, which will not be repeated here.
[0026] To achieve the third purpose of the present invention, the technical solution of the present invention provides a readable storage medium, which stores a computer program. When the computer program is executed, the steps of the message configuration method of any of the above technical solutions are implemented.
[0027] The readable storage medium provided by the technical solution of the present invention implements the steps of the message configuration method of any technical solution of the present invention, and thus has all the beneficial effects of the message configuration method of any technical solution of the present invention, which will not be repeated here.
[0028] Additional aspects and advantages of the present invention will become apparent from the following description or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0030] Figure 1 This is one of the flow charts of the message configuration method according to an embodiment of the present invention;
[0031] Figure 2 This is a second flow chart of a message configuration method according to an embodiment of the present invention;
[0032] Figure 3 This is a flow chart of a message configuration method according to an embodiment of the present invention;
[0033] Figure 4 This is a fourth flow chart of a message configuration method according to an embodiment of the present invention;
[0034] Figure 5 This is a fifth flow chart of a message configuration method according to an embodiment of the present invention;
[0035] Figure 6 This is a flowchart of a message configuration method according to an embodiment of the present invention;
[0036] Figure 7 A schematic diagram of an electronic device according to an embodiment of the present invention;
[0037] Figure 8 A schematic diagram of a system technology architecture of the present invention;
[0038] in, Figures 7 and 8 The corresponding relationship between the reference numerals and the component names is as follows:
[0039] 110: database, 120: database log change incremental acquisition service, 130: database change data merging service, 140: task calculation and message generation and sending service, 150: configuration file, 160: distributed application coordination service, 170: middleware, 200: electronic device, 210: memory, 220: processor. DETAILED DESCRIPTION
[0040] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0041] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0042] Refer to the following Figures 1 to 8 The message configuration method, the electronic device 200 and the readable storage medium according to some embodiments of the present invention are described.
[0043] Embodiment 1:
[0044] like Figure 1 As shown, this embodiment provides a message configuration method, comprising the following steps:
[0045] Step S102, obtaining changed database data in the database;
[0046] Step S104, performing a merge operation on the changed database data to obtain merged database data;
[0047] Step S106, obtaining the fields of the table where the merged database data corresponds to the message;
[0048] Step S108, configuring the content of the message according to the fields required by the message.
[0049] In this embodiment, the database may be a MySQL database, and the following description will be given using the MySQL database as an example.
[0050] First, this embodiment obtains the changed database data in the MySQL database, the database data is binlog (binary log file data), merges the changed database data to obtain the merged database data, and then determines the field of the table where the corresponding message is located according to the merged database data. Finally, according to the fields required by the message, the content of the message is configured. In this embodiment, the message is separated from the business code, and there is no coupling. When a problem occurs in the message middleware, it does not affect the normal operation of the business system, thereby improving the stability of the operation of the business system.
[0051] In the related art, when a change in business data requires sending messages to multiple business parties and the required message fields are different, the business code will become complicated, causing problems with maintenance. In this embodiment, the fields of the table where the merged database data corresponds to the message are obtained, and the message content is configured according to the required fields, thereby realizing field-level configuration of the message, and then realizing customizable configuration and online launch of field-level messages, which will not increase the complexity of the business code, making the business system maintenance simple, and there is no need to restart the service when going online, which has no impact on the operation of the business system.
[0052] In this embodiment, by calling back the binlog location to a specified location to send a message after a specified time, it is very simple and feasible to resend the message.
[0053] Embodiment 2:
[0054] like Figure 2 As shown, in addition to the technical features of the above embodiment, this embodiment further includes the following technical features:
[0055] Obtaining the changed database data in the database includes the following steps:
[0056] Step S202, constructing a log parsing service;
[0057] Step S204: obtaining changed database data through log synchronization and parsing service.
[0058] Specifically, the binlog mode of the MySQL database can be set to row mode to build a log parsing service. For example, the log parsing service includes a database log change incremental acquisition service (canal-server service) and a database change data merging service (canal-client service).
[0059] By building the canal-server service, configuring it to monitor changes in the MySQL database, and obtaining the changed binlog, only a small amount of changed binlogs need to be obtained through the above method, which makes code writing simple and saves CPU resources.
[0060] The canal-client service is used for data merging.
[0061] Embodiment 3:
[0062] In addition to the technical features of the above embodiment, this embodiment further includes the following technical features:
[0063] The log parsing service follows the master-slave protocol.
[0064] The constructed canal-server service follows the master-slave protocol of the MySQL database. By following the master-slave protocol, the canal-server service is disguised as a slave of the MySQL database, and then configured to pay attention to the changed tables in the MySQL database. The MySQL database passes the changed binlog to the canal-server service. By adopting the master-slave protocol, the changed binlog in the MySQL database is synchronized, and less CPU resources are used to obtain the binlog, saving CPU resources.
[0065] Embodiment 4:
[0066] like Figure 3 As shown, in addition to the technical features of the above embodiment, this embodiment further includes the following technical features:
[0067] Performing a merge operation on the changed database data to obtain the merged database data includes the following steps:
[0068] Step S302, parsing the previous value and the next value of the changed database data;
[0069] Step S304, performing a merge operation according to the previous value and the next value to obtain the previous value and the next value of the merged database data, thereby obtaining the merged database data.
[0070] The canal-client service built can obtain changes in table data in the MySQL database in real time, parse the previous value and the next value, and perform necessary merge operations. For example, the value of field X in table T changes from A to B, and then from B to C. When the changes are captured in the same batch, for downstream users, the value of field X only changes from A to C, so a merge operation can be performed. Through the merge operation, the process of changing field values in the data table is simplified, the complexity of the code is reduced, and subsequent system maintenance is convenient.
[0071] Embodiment 5:
[0072] In addition to the technical features of the above embodiment, this embodiment further includes the following technical features:
[0073] When performing a merge operation on the changed database data, single-threaded processing is used to obtain the database data.
[0074] Specifically, the merge operation needs to be processed using a single thread to ensure that each change in the field value can be obtained, and then the process of continuous changes in the field value can be identified to implement the merge operation. If multi-threaded processing is used, it will cause the situation where continuous changes in field values cannot be identified.
[0075] For example, the value of field X of data table T changes from A to B, and then from B to C. When a single thread is used, it can be identified that the value of field X of data table T changes from A to B, and then from B to C, and then a merge operation is performed, so that the value of field X only changes from A to C. If multiple threads are used, it cannot be identified that the value of field X of data table T changes from A to B, and then from B to C, resulting in the inability to perform a merge operation.
[0076] Embodiment 6:
[0077] like Figure 4 As shown, in addition to the technical features of the above embodiment, this embodiment further includes the following technical features:
[0078] The message configuration method also includes the following steps:
[0079] Step S402: the log parsing service persists the processed location to the distributed application coordination service.
[0080] The log parsing service persists the processed locations to the distributed application coordination service.
[0081] The canal-server service and the canal-client service will persist the processed sites to the distributed application coordination service (zookeeper), and an additional monitoring interface will be added to monitor the running status of the task, and alarms can be configured. By monitoring the running status of the task, the accuracy of the log parsing service is improved. In case of problems, alarms are used to prompt, making the prompts more intuitive and easy to find.
[0082] Embodiment 7:
[0083] like Figure 5 As shown, in addition to the technical features of the above embodiment, this embodiment further includes the following technical features:
[0084] Obtaining the fields of the table where the merged database data corresponds to the message includes the following steps:
[0085] Step S502, generating a task according to the configuration file;
[0086] Step S504, obtaining tasks triggered by the merged database data;
[0087] Step S506, obtaining the fields of the table where the task corresponding message is located.
[0088] For example, the merge result is synchronized with the remote procedure call (RPC) request to the task calculation and message generation and sending service (worker). After the worker obtains the data, it generates a specific task according to the XML configuration file (the XML configuration file configures the relationship between the changed field and the specific task, the relationship between the task and the specific topic, the relationship between the task and the required business table, and the relationship between the task and the message result field). The task is processed and runs according to the XML configuration file to calculate the tasks that will be triggered by the result of the current batch of binlog merging, obtain the fields of the table where the messages (topics) corresponding to these tasks are located, obtain the data of the table required by a topic, and configure the content of the specific topic as needed through the required fields of the topic, thereby completing the message from triggering to assembly to sending.
[0089] In this embodiment, obtaining the fields of the table where the task corresponds to the message, specifically, refers to reading the name or subject of the message to be sent from the configuration, and also includes reading the return result corresponding to the message from the configuration, and the return result includes fields (the specific table and specific fields required to read the result field from the configuration). When a message topic requires data from multiple tables, and at least one of them is changed, the table with the change is obtained through the before and after values of the table change, and the table data that has not changed is obtained by one or more reverse queries to the database. For example, suppose a message topic requires data from 3 tables, but only 1 of the 3 tables is changed. At this time, the before and after values of 1 table change are obtained, and the data of the other 2 tables need to be reversed to the database.
[0090] In this embodiment, by obtaining the task triggered by the merged binlog, the field of the table where the task corresponding to the message is located is obtained, and based on the obtained message, the message content is configured according to the required fields, the message and the business code are separated, and there is no coupling. When a problem occurs in the message middleware, it does not affect the normal operation of the business system, thereby improving the stability of the operation of the business system. In addition, there is no need to restart the service when going online, and there is no impact on the operation of the business system.
[0091] Embodiment 8:
[0092] like Figure 6 As shown, in addition to the technical features of the above embodiment, this embodiment further includes the following technical features:
[0093] The message configuration method also includes the following steps:
[0094] Step S602, configuring a master database and a slave database for the log parsing service;
[0095] Step S604, based on the interruption of the main library, the slave library switches to the main library for operation, and the site pushes forward the target time during the switching process.
[0096] The canal-server service and canal-client service can be configured with a master and a slave to run. Only one instance is running at the same time. When the running instance is interrupted due to an abnormal situation, the slave will automatically switch to the master to run. During the switching process, the site automatically advances the target time. The target time is selected according to the situation. For example, it can be one minute.
[0097] By setting up the master and slave databases, when an abnormal situation occurs during terminal operation, the slave can be switched to the master to continue running, which improves the stability of system operation. When switching, the site automatically advances the target time during the switching process to ensure that no data is lost and the data is accurate.
[0098] Embodiment 9:
[0099] like Figure 7 As shown, this embodiment provides an electronic device 200, including: a memory 210 and a processor 220, the memory 210 stores programs or instructions, and the processor 220 executes the programs or instructions; wherein, when the processor 220 executes the programs or instructions, it implements the steps of the message configuration method of any embodiment of the present invention.
[0100] Embodiment 10:
[0101] This embodiment provides a readable storage medium, which stores a program or instruction. When the program or instruction is executed by a processor, the steps of the message configuration method in any of the above embodiments are implemented. Specific embodiment:
[0103] Traditional message development and sending methods have several disadvantages: (1) High coupling, the message sending logic is coupled with the business code. Once a problem occurs in the message middleware, the business system will become unavailable. (2) Customization is difficult. If a change in business data requires sending messages to multiple business parties and the required message fields are different, the business code will become complex and difficult to maintain. (3) Going online requires restarting the instance publishing service. (4) Message resending is difficult, and specific business logic needs to be implemented to query the database to resend the message.
[0104] This embodiment uses the binlog mechanism of the MySQL database to realize the field-level configuration development and launch of messages. The message system is completely separated from the business code, and even if there is a problem with the message middleware, it will not affect the operation of the business. Customized configuration development and launch are possible, and there is no need to restart the service when launching. The message resending is convenient, and the binlog location can be called back to the specified location to send messages after the specified time.
[0105] This embodiment provides a message configuration method, the system technical architecture is as follows Figure 8 As shown, the database 110 adopts the MySQL database, and the database 110 is provided with N databases (database 1 to database N), specifically including:
[0106] (1) Set the binlog mode of database 110 to row mode. You can use some open source tools (typical representatives include Alibaba's open source Canal, etc.) to write a database log change incremental acquisition service 120 (canal-server service). This service follows the master-slave protocol of database 110, disguises itself as a slave of database 110, and is configured to pay attention to the tables that have changed in database 110. Database 110 synchronizes the binlog with database log change incremental acquisition service 120.
[0107] (2) Database change data merging service 130 (canal-client service) obtains the changes of table data in database 110 in real time, analyzes the previous value and the next value, and performs necessary merge operations. For example, the changes of field X value from A to B to C in data table T are captured in the same batch. For downstream users, the value is only changed from A to C, so a merge operation can be performed. If there is a business table merge, it is also operated in this step. The process of fetching binlog in this step adopts single-thread processing and cannot use multi-threading to ensure that the subsequent processing can be carried out after the acquired data is processed.
[0108] (3) Synchronize the merged result with an RPC request to the task calculation and message generation and sending service 140 (worker). The task calculation and message generation and sending service 140 obtains the data and generates a specific task according to the configuration file 150, and the task is processed. The configuration file 150 uses an XML configuration file. A simple XML configuration file is as follows:
[0109] Configuration of the mapping relationship between database fields and tasks:
[0110]
[0111] Pay attention to what tasks will be generated after the field value in the database table changes. The above computer language expression is: the change of field1 in table T1 will generate two tasks 001 and 002. After business processing, tasks 001 and 002 will eventually generate 2 messages.
[0112] The mapping relationship between tasks and topics is as follows:
[0113]
[0114] The above computer language expression is: Task 001 corresponds to topic1 message, and task 002 corresponds to topic2 message, where topic1 and topic2 refer to the general message names.
[0115] The correspondence between tasks and associated targets (necessary for reverse query):
[0116]
[0117] For example, the message body of the message topic1 requires fields from three tables T1, T2, and T3. If only the field value of table T1 changes in the database, and the values of tables T2 and T3 do not change, the previous and next values of table T1 can be captured from the database change log, but there are no values of tables T2 and T3. The values of tables T2 and T3 required in the result are queried in the database to obtain the latest values of tables T2 and T3. The above computer language expression is: for task 001, compare the data changes captured by binlog of the three tables T1, T2, and T3. For the captured data changes, no query is required. For the data changes that are not captured, query the table to obtain. For example, if the change of table T2 is captured, the data of tables T1 and T3 need to be reversed in the database. For example, if the change of tables T2 is captured, the data of tables T1 and T3 need to be reversed in the database. For example, if tables T2 and T3 are captured at the same time, at this time, only table T1 is missing, so only table T1 is queried. If T1, T2, and T3 are captured in a batch of binlogs, no reverse query is required.
[0118] Custom configuration of message return results:
[0119]
[0120] According to the xml configuration, it is calculated which tasks will be triggered by the result of the current batch of binlog merging, which topics these tasks will be associated with, and which tables of data a certain topic needs (if a certain topic focuses on multiple tables, the result requires change data of multiple tables, and there is a special case where data needs to be reversed when only one table is changed this time). The content of the specific topic is configured as needed through the required fields of the topic, completing the message from triggering to assembly to sending. The above computer language expression is: for task 001, the result assembly of the message is configured, and the field data of the table required for the result of the message corresponding to task 001 is taken out and assembled. T1.column1 is column 1 of table T1, T1.column2 is column 2 of table T1, T1.column5 is column 5 of table T1, and T2.column3 is column 3 of table T1.
[0121] The worker finally generates the message and sends it to the message platform through the middleware 170.
[0122] (4) When the database change data merging service 130 requests the task calculation and message generation and sending service 140 to run a task, a synchronous request needs to be used. The corresponding thread pool is configured in the task calculation and message generation and sending service 140 to calculate and run the current task. After the running is completed, the results are uniformly returned to the database change data merging service 130.
[0123] (5) The specific monitoring of tasks is as follows: the database log change incremental acquisition service 120 and the database change data merge service 130 will persist the processed sites on the distributed application coordination service 160. An additional monitoring interface can be added to monitor the task running status, and alarms can be configured.
[0124] (6) A high-availability configuration can also be adopted. The database log change incremental acquisition service 120 and the database change data merge service 130 can be configured to run as master and slave. Only one instance is running at the same time. When the running instance is interrupted due to an abnormal situation, the slave will automatically switch to the master to run. During the switching process, the location is automatically pushed forward by 1 minute to ensure that the data is completely accurate and not lost.
[0125] This embodiment can carry at least 30,000 topic production and sending per second on a single worker (8C8G), and can be expanded without limit through configuration, which is particularly suitable for scenarios with large amounts of data changes.
[0126] The beneficial effects produced by this embodiment are:
[0127] (1) The message system and the business system are decoupled, and message middleware exceptions will not affect the operation of the business system at all.
[0128] (2) Highly configurable field level: Accurately customize messages for different business parties by configuring field-level configuration tasks.
[0129] (3) It saves CPU and other resources and only requires a small amount of IO for MySQL master-slave synchronization.
[0130] (4) Going online does not require restarting the service, and can be configured.
[0131] In summary, the beneficial effects of the embodiments of the present invention are:
[0132] 1. In this embodiment, the message and the business code are separated, and there is no coupling. When a problem occurs in the message middleware, it does not affect the normal operation of the business system, thereby improving the stability of the operation of the business system.
[0133] 2. In this embodiment, the fields of the table where the merged binlog corresponds to the message are obtained, and the message content is configured according to the required fields, thereby realizing the field-level configuration of the message, and then realizing the customizable configuration and online launch of the field-level message, which will not increase the complexity of the business code and make the business system maintenance simple.
[0134] 3. In this embodiment, there is no need to restart the service when going online, and there is no impact on the operation of the business system.
[0135] In the present invention, the terms "first", "second", and "third" are used for descriptive purposes only and should not be understood as indicating or implying relative importance; the term "plurality" refers to two or more, unless otherwise clearly defined. The terms "installed", "connected", "connected", "fixed", etc. should be understood in a broad sense. For example, "connected" can be a fixed connection, a detachable connection, or an integral connection; "connected" can be a direct connection or an indirect connection through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0136] In the description of the present invention, it is necessary to understand that the directions or positional relationships indicated by terms such as “upper”, “lower”, “left”, “right”, “front” and “back” are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or unit referred to must have a specific direction, be constructed and operated in a specific orientation, and therefore, cannot be understood as a limitation on the present invention.
[0137] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "specific embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0138] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A message configuration method, characterized in that: include: Get the changed database data in the database; Performing a merging operation on the changed database data to obtain merged database data; Obtain the fields of the table where the merged database data corresponds to the message; Configuring the content of the message according to the fields required by the message; The obtaining of changed database data in the database includes: Build a log parsing service; Obtaining the changed database data through the log synchronization and parsing service; The log parsing service includes a database log change increment acquisition service and a database change data merging service; The merging operation is performed on the changed database data to obtain the merged database data, including: Analyze the previous value and the next value of the changed database data; Perform a merging operation according to the previous value and the next value to obtain the previous value and the next value of the merged database data, and obtain the merged database data; When the merge operation is performed on the changed database data, single-threaded processing is adopted to obtain the database data.
2. The message configuration method according to claim 1, characterized in that: The log parsing service follows the master-slave protocol.
3. The message configuration method according to claim 1, characterized in that: Also includes: The log parsing service persists the processed locations to the distributed application coordination service.
4. The message configuration method according to claim 1, characterized in that: The obtaining of the fields of the table where the merged database data corresponds to the message includes: Generate tasks based on configuration files; Acquiring the task triggered by the merged database data; Get the field of the table where the message corresponding to the task is located.
5. The message configuration method according to claim 1, characterized in that: Also includes: Configure a master database and a slave database for the log parsing service; Based on the interruption of the operation of the main library, the slave library switches to the operation of the main library, and the site pushes forward the target time during the switching process.
6. An electronic device (200), characterized in that: include: A memory (210) storing programs or instructions; A processor (220) for executing the program or instruction; Wherein, when executing the program or instruction, the processor (220) implements the steps of the message configuration method according to any one of claims 1 to 5.
7. A readable storage medium, characterized in that: include: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the message configuration method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method and system for updating application system database
CN103136308A
Change message sending method and apparatus, and electronic device
CN106980643A
Cross-machine-room data synchronization system, method and device and electronic device
CN108573006A