Business processing method and apparatus, electronic device, and storage medium

CN115629848BActive Publication Date: 2026-09-04INDUSTRIAL AND COMMERCIAL BANK OF CHINA +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211268135.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-17
Publication Date
2026-09-04
Estimated Expiration
2042-10-17

AI Technical Summary

Technical Problem

[0006]本发明实施例提供了一种业务处理方法及其装置、电子设备及存储介质,以至少解决相关技术中需要依赖消息中间件进行业务处理,处理效率较低且容易导致数据不一致的技术问题

Benefits of technology

[0023] In this disclosure, change message data of the target business sent by a preset server is received. Based on the database configuration file, a target thread is started. The target thread identifies data within transactions of the same transaction in the change message data and stores the data within those transactions into a preset memory array. Data from all transactions in the preset memory array is processed to obtain the processing result. In this disclosure, a preset consumer can receive change message data of the target business collected from the database by a preset server. Then, according to the corresponding database configuration file, a target thread is started to identify data within transactions of the same transaction in the change message data and store the data from all transactions within that transaction into a preset memory array. This achieves the purpose of uniformly processing messages of the same transaction. The preset consumer and preset server improve the efficiency of business processing, and storing data from the same transaction in a memory array for unified processing ensures data order and consistency. This solves the technical problems of related technologies that rely on message middleware for business processing, resulting in low processing efficiency and data inconsistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115629848B_ABST
    Figure CN115629848B_ABST
Patent Text Reader

Abstract

The application discloses a service processing method and device, an electronic device and a storage medium, and relates to the field of financial technology or other related fields. The processing method comprises the following steps: receiving change message data of a target service sent by a preset server, starting a target thread according to a database configuration file, identifying data in a transaction of the same transaction in the change message data by using the target thread, and storing the data in the transaction into a preset memory array, processing all data in the transactions in the preset memory array, and obtaining a processing result. The application solves the technical problems of related technologies, such as the need to rely on a message middleware for service processing, low processing efficiency, and data inconsistency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial technology, and more specifically, to a business processing method and apparatus, electronic device and storage medium. Background Technology

[0002] Currently, with a large number of users accessing e-commerce applications, these applications are required to support high concurrency and high responsiveness. For example, a product system needs to perform rapid batch modifications to the listing status of hundreds of thousands of promotional products at the very first second of a promotion. To modify the status of a large number of products with a response time in milliseconds, some functions in the business logic (such as monitoring, logging, statistics, and cache synchronization) need to be decoupled and separated from the main business logic.

[0003] In related technologies, business decoupling solutions primarily utilize message queues. This is achieved by adding message sending functionality to the service interface and then processing the messages asynchronously, thus smoothing out business loads. Taking online payment as an example, the first step is to deduct money from the user's account, and the second step is to notify the user of successful payment via SMS. To improve the processing speed of the payment function interface, a message queue can be used for decoupling. This means that the payment interface should only handle the deduction, returning a result upon successful deduction. The function for handling SMS notifications is modified to send messages to the message queue, allowing the subscribed program to process SMS notifications asynchronously, thereby improving the processing speed of the payment function interface.

[0004] However, decoupling business logic in this way makes the system more complex. Issues such as message duplication and message order must be considered. Furthermore, because it relies on a message middleware, a failure in the middleware will cause the system to crash, reducing its availability. Moreover, if only some of the asynchronously processed messages succeed, but the page still returns success, it will ultimately lead to data inconsistency, causing inconsistency problems.

[0005] There is currently no effective solution to the above problems. Summary of the Invention

[0006] This invention provides a business processing method, apparatus, electronic device, and storage medium to at least solve the technical problems in related technologies that rely on message middleware for business processing, resulting in low processing efficiency and easy data inconsistency.

[0007] According to one aspect of the present invention, a business processing method is provided, applied to a preset consumer terminal, comprising: receiving change message data of a target business sent by a preset server, wherein the change message data includes: a database configuration file; starting a target thread according to the database configuration file; using the target thread to identify data in a transaction of the same transaction in the change message data, and storing the data in the transaction into a preset memory array; processing all the data in the transaction in the preset memory array to obtain a processing result.

[0008] Optionally, before receiving the target service change message data sent by the preset server, the method further includes: configuring database configuration information and message filtering rule configuration information for each database through the preset server, wherein the databases are located in different or the same data sources; and generating the database configuration file for each database based on the database configuration information and the message filtering rule configuration information through the preset server.

[0009] Optionally, after generating the database configuration file for each database, the method further includes: monitoring database logs through the preset server; obtaining location information based on the database logs through the preset server, wherein the location information includes at least the data update time point; accessing a preset service registration center through the preset server, and obtaining the change message data from the preset service registration center based on the location information.

[0010] Optionally, the step of accessing the preset service registry center through the preset server includes: configuring the database address and table address of the business data corresponding to the target business through the preset server based on the database configuration information; configuring a preset service address through the preset server based on the database address and the table address; and accessing the preset service registry center through the preset server based on the preset service address, wherein the preset service registry center is used to record the location information of the database log, and the preset service registry center obtains the database data corresponding to the location information.

[0011] Optionally, the step of using the target thread to identify data within the same transaction in the change message data includes: identifying operation data within the same transaction in the change message data based on the message body type, wherein the message body type includes: transaction start, transaction in progress, and transaction end; and obtaining the data within the same transaction based on the operation data.

[0012] Optionally, the step of processing all the data in the transactions in the preset memory array to obtain a processing result includes: parsing all the data in the transactions in the preset memory array using a preset application to obtain parsed data; filtering the parsed data according to the business rules of the target business to obtain the processing result, wherein the processing result includes: processed data, which includes: data before and after updating the target business, the operation type of the operation performed on the target business, and the database identifier and table identifier of the operation.

[0013] Optionally, after processing the data in all the transactions in the preset memory array and obtaining the processing result, the method further includes: sending the table identifiers involved in asynchronous task processing in the processing data to the processing system corresponding to the business requirement, based on the business requirements of the target business; wherein the processing system performs business logic processing on the target table indicated by the table identifier and the fields in the target table according to the business requirements to obtain the asynchronous task processing result; assembling the asynchronous task processing results from different processing systems to obtain processing result data; and storing the processing result data in a preset database.

[0014] According to another aspect of the present invention, a service processing apparatus is also provided, applied to a preset consumer end, comprising: a receiving unit, configured to receive change message data of a target service sent by a preset server, wherein the change message data includes: a database configuration file; a starting unit, configured to start a target thread according to the database configuration file; an identification unit, configured to identify data in a transaction of the same transaction in the change message data using the target thread, and store the data in the transaction into a preset memory array; and a processing unit, configured to process all the data in the transactions in the preset memory array to obtain a processing result.

[0015] Optionally, the service processing device further includes: a first configuration module, configured to configure database configuration information and message filtering rule configuration information for each database through the preset server before receiving change message data of the target service sent by the preset server, wherein the databases are located in different or the same data sources; and a first generation module, configured to generate the database configuration file for each database through the preset server based on the database configuration information and the message filtering rule configuration information.

[0016] Optionally, the business processing device further includes: a first monitoring module, configured to monitor database logs through the preset server after generating the database configuration file for each database; a first acquisition module, configured to acquire location information through the preset server based on the database logs, wherein the location information includes at least: a data update time point; and a first access module, configured to access a preset service registration center through the preset server and acquire the change message data from the preset service registration center based on the location information.

[0017] Optionally, the first access module includes: a first configuration submodule, configured to configure the database address and table address of the business data corresponding to the target business according to the database configuration information through the preset server; a second configuration submodule, configured to configure a preset service address based on the database address and the table address through the preset server; and a first access submodule, configured to access the preset service registration center through the preset server according to the preset service address, wherein the preset service registration center is used to record the location information of the database log, and the preset service registration center obtains the database data corresponding to the location information.

[0018] Optionally, the identification unit includes: a first identification module, used to identify operation data in the change message data that belong to the same transaction based on the message body type and the target thread, wherein the message body type includes: transaction start, transaction in progress, and transaction end; and a second acquisition module, used to acquire data in the same transaction based on the operation data.

[0019] Optionally, the processing unit includes: a first parsing module, configured to parse all data in the transactions in the preset memory array using a preset application to obtain parsed data; and a first filtering module, configured to filter the parsed data according to the business rules of the target business to obtain the processing result, wherein the processing result includes: processed data, which includes: data before and after updating the target business, the operation type of the operation performed on the target business, and the database identifier and table identifier of the operation.

[0020] Optionally, the business processing device further includes: a first sending module, configured to, after processing the data in all the transactions in the preset memory array and obtaining the processing result, send the table identifiers involved in asynchronous task processing in the processing data to the processing system corresponding to the business requirement, according to the business requirement of the target business, wherein the processing system performs business logic processing on the target table indicated by the table identifier and the fields in the target table according to the business requirement to obtain the asynchronous task processing result; a first assembly module, configured to assemble the asynchronous task processing results of different processing systems to obtain processing result data; and a first storage module, configured to store the processing result data in a preset database.

[0021] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored computer program, wherein the computer program controls the device where the computer-readable storage medium is located to perform the above-described business processing method when it is executed.

[0022] According to another aspect of the present invention, an electronic device is also provided, including one or more processors and a memory, the memory being 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 cause the one or more processors to implement the above-described business processing method.

[0023] In this disclosure, change message data of the target business sent by a preset server is received. Based on the database configuration file, a target thread is started. The target thread identifies data within transactions of the same transaction in the change message data and stores the data within those transactions into a preset memory array. Data from all transactions in the preset memory array is processed to obtain the processing result. In this disclosure, a preset consumer can receive change message data of the target business collected from the database by a preset server. Then, according to the corresponding database configuration file, a target thread is started to identify data within transactions of the same transaction in the change message data and store the data from all transactions within that transaction into a preset memory array. This achieves the purpose of uniformly processing messages of the same transaction. The preset consumer and preset server improve the efficiency of business processing, and storing data from the same transaction in a memory array for unified processing ensures data order and consistency. This solves the technical problems of related technologies that rely on message middleware for business processing, resulting in low processing efficiency and data inconsistency. Attached Figure Description

[0024] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0025] Figure 1 This is a flowchart of an optional business processing method according to an embodiment of the present invention;

[0026] Figure 2 This is an optional flowchart for obtaining change message data according to an embodiment of the present invention;

[0027] Figure 3 This is a schematic diagram of an optional business processing system architecture according to an embodiment of the present invention;

[0028] Figure 4 This is a schematic diagram of an optional business processing apparatus according to an embodiment of the present invention;

[0029] Figure 5 This is a hardware structure block diagram of an electronic device (or mobile device) for a business processing method according to an embodiment of the present invention. Detailed Implementation

[0030] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0032] It should be noted that the business processing method and apparatus disclosed herein can be used in the field of financial technology for business processing, and can also be used in any field other than financial technology for business processing. This disclosure does not limit the application field of the business processing method and apparatus.

[0033] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent information from the aforementioned user or organization.

[0034] The following embodiments of the present invention can be applied to various systems / applications / devices that perform business processing. The present invention is suitable for non-intrusive business decoupling processing in high-concurrency scenarios. It can perform asynchronous task processing on massive amounts of data (hundreds of millions) without intruding on the business system code. This includes asynchronous task processing such as cached data synchronization, compliance data monitoring, log processing, data statistical analysis, and data consistency checks. It can achieve functional decoupling in a non-intrusive asynchronous manner, realizing near real-time response to business functions.

[0035] The present invention will now be described in detail with reference to various embodiments.

[0036] Example 1

[0037] According to an embodiment of the present invention, an embodiment of a business processing method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0038] Figure 1 This is a flowchart of an optional business processing method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:

[0039] Step S101: Receive change message data of the target service sent by the preset server, wherein the change message data includes: database configuration file.

[0040] Step S102: Start the target thread according to the database configuration file.

[0041] Step S103: The target thread identifies the data in the same transaction within the change message data and stores the data in the transaction into a preset memory array.

[0042] Step S104: Process the data in all transactions in the preset memory array to obtain the processing result.

[0043] Through the above steps, change message data of the target business sent by the preset server can be received. Based on the database configuration file, a target thread is started. The target thread identifies data within the same transaction in the change message data and stores the data in that transaction into a preset memory array. Data from all transactions in the preset memory array is then processed to obtain the processing result. In this embodiment of the invention, a preset consumer can receive change message data of the target business collected from the database by the preset server. Then, according to the corresponding database configuration file, a target thread is started to identify data within the same transaction in the change message data and store the data from all transactions in that transaction into a preset memory array. This achieves the purpose of uniformly processing messages of the same transaction. The preset consumer and preset server improve the efficiency of business processing, and storing data from the same transaction in a memory array for unified processing ensures data order and consistency. This solves the technical problems in related technologies where business processing relies on message middleware, resulting in low processing efficiency and data inconsistency.

[0044] The embodiments of the present invention will now be described in detail with reference to the steps described above. These embodiments can be applied to a pre-defined consumer terminal.

[0045] In an optional embodiment, before receiving the target service change message data sent by the preset server, the method further includes: configuring database configuration information and message filtering rule configuration information for each database through the preset server, wherein the databases are located in different or the same data sources; and generating a database configuration file for each database based on the database configuration information and message filtering rule configuration information through the preset server.

[0046] In this embodiment of the invention, a preset server (such as CanalServer service, an architecture service that provides data acquisition functionality, enabling the collection of data from a database (such as a MySQL database) and sending it to a preset consumer (such as CanalClient service, an architecture service for consuming data)) is introduced. The preset server can configure database configuration information and message filtering rule configuration information for each database (the databases are located in different or the same data source). Then, based on the database configuration information and message filtering rule configuration information, a database configuration file can be generated for each database (that is, the preset server can split the database configuration information and message filtering rule configuration information into multiple configuration files according to the number of databases, with one configuration file corresponding to each database). This allows the system to flexibly handle message distribution in the database tables according to business rules after production deployment, and the message filtering rules can be configured using regular expressions.

[0047] Optionally, after generating a database configuration file for each database, the method further includes: listening to database logs through a preset server; obtaining location information based on the database logs through the preset server, wherein the location information includes at least the data update time; accessing a preset service registry through the preset server, and obtaining change message data from the preset service registry based on the location information.

[0048] In this embodiment of the invention, the preset server can simulate a database slave and listen to the database logs (such as binlog logs) of the database master, thereby achieving near real-time data synchronization without code intrusion. At the same time, even when faced with massive amounts of data, it will not put pressure on the database or affect online business.

[0049] In this embodiment of the invention, the preset server can listen to the database logs, and then obtain position information (which includes at least the data update time) based on the database logs. It can also access a preset service registry (such as a ZooKeeper registry, which records the operation position information of the database logs, i.e., the data update time of the current database operation, can monitor the data processing status, and can determine whether there is a delay through the position information). It can also obtain change message data from the preset service registry based on the position information (i.e., it can match the same position information from the preset service registry based on the position information, so as to obtain the number of change messages from the database through the position information matched in the preset service registry).

[0050] Figure 2 This is an optional flowchart for obtaining change message data according to an embodiment of the present invention, such as... Figure 2 As shown, the method includes the following steps:

[0051] Step S201: Monitor database logs via a preset server.

[0052] Step S202: Obtain location information from database logs using a preset server. The location information includes at least the data update time.

[0053] Step S203: Access the preset service registration center through the preset server, and obtain change message data from the preset service registration center based on the location information.

[0054] Optionally, the step of accessing the preset service registry center through the preset server includes: configuring the database address and table address of the business data corresponding to the target business based on the database configuration information through the preset server; configuring the preset service address based on the database address and table address through the preset server; and accessing the preset service registry center through the preset server based on the preset service address, wherein the preset service registry center is used to record the location information of the database log, and the preset service registry center obtains the database data corresponding to the location information.

[0055] In this embodiment of the invention, the preset server can configure the database address and table address of the business data corresponding to the target business according to the database configuration information, and then configure the preset service address according to the database address and table address, and then access the preset service registration center according to the preset service address (that is, the preset server can configure the database address and corresponding table to be collected according to the business characteristics, and configure the preset service address to access the preset service registration center). The preset service registration center is used to record the location information of the database log to monitor the data processing status, and the preset service registration center can obtain the database data corresponding to the location information.

[0056] Step S101: Receive change message data of the target service sent by the preset server, wherein the change message data includes: database configuration file.

[0057] In this embodiment of the invention, after the preset server collects the change message data of the target service, it can send the change message data to the preset consumer. After receiving the change message data, the preset consumer can process the change message data according to the database configuration file carried in the change message data, so as to modify the target service in near real time and record all modified data.

[0058] Step S102: Start the target thread according to the database configuration file.

[0059] In this embodiment of the invention, each database corresponds to a database configuration file of a preset server. The preset consumer can start a separate processing thread to change the message data according to the database configuration file of the preset server. In this way, the changed message data in multiple databases will not be confused, and the changed message data in a single thread is also ordered. Therefore, the preset consumer can start the corresponding target thread according to the database configuration file.

[0060] Step S103: The target thread identifies the data in the same transaction within the change message data and stores the data in the transaction into a preset memory array.

[0061] Optionally, the step of using a target thread to identify data within the same transaction in the change message data includes: identifying operation data within the same transaction in the change message data based on the message body type, wherein the message body type includes: transaction start, transaction in progress, and transaction end; and obtaining data within the same transaction based on the operation data.

[0062] In this embodiment of the invention, in the processing thread of the preset consumer end, it is possible to first distinguish whether the operations belong to the same transaction based on the message body type. The message body types include three message types: transaction start TRANSACTIONBEGIN, transaction in progress ROWDATA, and transaction end TRANSACTIONEND (that is, based on the message body type, the target thread identifies the operation data in the change message data that belongs to the same transaction). Then, by collecting the transaction in progress ROWDATA type messages between the transaction start type message TRANSACTIONBEGIN and the transaction end type message TRANSACTIONEND into a List memory array (that is, based on the operation data, the data in the same transaction is obtained and the data in the transaction is stored in the preset memory array), the purpose of processing messages of the same transaction together is achieved.

[0063] Step S104: Process the data in all transactions in the preset memory array to obtain the processing result.

[0064] Optionally, the step of processing data in all transactions in a preset memory array to obtain processing results includes: parsing data in all transactions in the preset memory array using a preset application to obtain parsed data; filtering the parsed data according to the business rules of the target business to obtain processing results, wherein the processing results include: processed data, which includes: data before and after updating the target business, the operation type of the operation performed on the target business, and the database identifier and table identifier of the operation.

[0065] In this embodiment of the invention, a preset application (such as CanalAPI) can be used to parse the data in all transactions in a preset memory array to obtain parsed data. Then, according to the business rules of the target business, the parsed data is filtered to obtain the processing result. The processing result includes: processed data, which includes: data before and after updating the target business, the operation type of the operation performed on the target business (such as update, delete, insert, etc.), the database identifier and table identifier of the operation, etc.

[0066] Optionally, after processing the data in all transactions in the preset memory array and obtaining the processing results, the method further includes: sending the table identifiers involved in asynchronous task processing in the processing data to the processing system corresponding to the business requirements, based on the business requirements of the target business; wherein the processing system performs business logic processing on the target table indicated by the table identifier and the fields in the target table according to the business requirements to obtain the asynchronous task processing results; assembling the asynchronous task processing results of different processing systems to obtain the processing result data; and storing the processing result data in the preset database.

[0067] In this embodiment of the invention, based on the business requirements of the target business, the table identifiers involved in asynchronous task processing in the processing data can be sent to the processing system corresponding to the business requirements. Then, the processing system can perform business logic processing on the target table indicated by the table identifier and the fields in the target table according to the business requirements to obtain asynchronous task processing results (that is, perform business logic processing on these tables and fields that need to be processed asynchronously according to the business requirements). After that, the asynchronous task processing results of different processing systems are assembled to obtain processing result data, and then the processing result data is stored in a preset database (that is, the assembled asynchronous task processing result data is stored in a preset database (such as a task processing result database, or other file systems or non-relational databases can be used to store the processing result data).

[0068] For example, when modifying product category information in the book library, the CanalClient service, upon receiving a data change message, can asynchronously update the data in the product category system, achieving eventual data consistency in the distributed system. Similarly, when modifying prices in the product library, the CanalClient service, upon receiving a data change message, can asynchronously update and synchronize the price data in the price system without altering the original system.

[0069] The following describes in detail another optional implementation method.

[0070] Figure 3 This is a schematic diagram of an optional business processing system architecture according to an embodiment of the present invention, such as... Figure 3 As shown, it includes: multiple databases (such as database A, database B, database C, etc.), a preset server, a preset consumer, and a preset database.

[0071] The default server provides a data collection function, which collects data from the database and sends it to the default consumer.

[0072] The pre-defined consumer end performs a series of processing steps, such as analysis and filtering, on the collected data according to the characteristics of the business, and then stores it in the pre-defined database.

[0073] In this embodiment, the business processing system can be implemented with backend services using a programming language (such as Java), which can be horizontally expanded to other applications and is suitable for all scenarios that require recording database operations.

[0074] This embodiment can use the open-source architecture service CanalServer to collect data from the database. Canal has the following characteristics: Canal can simulate a database slave listening to the database logs of the database master without code intrusion, can achieve near real-time data synchronization, and will not put pressure on the database or affect online business even when faced with massive amounts of data.

[0075] The following details the processing flow of the preset server and preset consumer:

[0076] (1) The preset server is configured with the database addresses and corresponding tables to be collected according to the business characteristics, and the preset service address is configured to access the preset service registry (the preset service registry is used to record the operation position information of the database log, that is, the data update time of the current database operation, which can monitor the data processing status and determine whether there is a delay through the position information). Since the databases of each business system adopt the architecture of database sharding and table sharding, the database configuration information and message filtering rule configuration information can be split into multiple configuration files according to the number of databases on the preset server, so that each business system can flexibly handle the message distribution in the database table according to the business rules after production. The message filtering rules can be configured through regular expressions, and finally the collected change message data is sent to the preset consumer.

[0077] (2) The preset consumer receives data sent by the preset server. Since each database corresponds to a database configuration file of the preset server, the preset consumer can start a separate processing thread to process messages according to the database configuration file of the preset server. In this way, messages from multiple databases will not be confused and messages in a single thread will also be ordered. In the processing thread of the preset consumer, it can first distinguish whether they are operations of the same transaction based on the message body type. The message body types include: transaction start TRANSACTIONBEGIN, data in the transaction ROWDATA, and transaction end TRANSACTIONEND. By collecting the ROWDATA type messages between the transaction start type message TRANSACTIONBEGIN and the transaction end type message TRANSACTIONEND into a List memory array, the purpose of processing messages of a transaction together can be achieved.

[0078] The data in the List memory array within a transaction is then parsed and filtered using a preset application to obtain the data before and after the update, the operation type (update, delete, insert), the database name, and the table name. Next, the tables and fields requiring asynchronous task processing can be processed according to business logic requirements. Finally, the assembled asynchronous task processing results are stored in the preset database.

[0079] In this embodiment of the invention, by introducing a preset server and a preset consumer, business decoupling processing can be performed on sharded and partitioned business systems under high-concurrency scenarios without intruding on the business system code. This ensures message ordering and achieves near real-time asynchronous data processing, thus achieving the goal of non-intrusive asynchronous decoupling of business processes. Furthermore, this embodiment does not intrude on online business systems and supports near real-time asynchronous task processing of hundreds of millions of data points daily. It also enables rapid integration of asynchronous task systems with MySQL databases, reducing system access costs.

[0080] The following is a detailed description with reference to another embodiment.

[0081] Example 2

[0082] The business processing apparatus provided in this embodiment includes multiple implementation units, each of which corresponds to a specific implementation step in Embodiment 1 above.

[0083] Figure 4 This is a schematic diagram of an optional business processing apparatus according to an embodiment of the present invention, such as... Figure 4 As shown, the processing device may include: a receiving unit 40, a starting unit 41, an identification unit 42, and a processing unit 43, wherein...

[0084] The receiving unit 40 is used to receive change message data of the target service sent by the preset server, wherein the change message data includes: database configuration file;

[0085] Startup unit 41 is used to start the target thread according to the database configuration file;

[0086] The identification unit 42 is used to identify data in the same transaction of the change message data using the target thread, and store the data of the transaction into a preset memory array;

[0087] Processing unit 43 is used to process the data in all transactions in the preset memory array and obtain the processing result.

[0088] The aforementioned processing device can receive change message data of a target service sent by a preset server through the receiving unit 40, start a target thread according to the database configuration file through the starting unit 41, identify data in the same transaction within the change message data through the identification unit 42, and store the data in the transaction into a preset memory array through the target thread, and process the data in all transactions in the preset memory array through the processing unit 43 to obtain the processing result. In this embodiment of the invention, a preset consumer can receive change message data of a target service collected from the database by a preset server, and then start a target thread according to the corresponding database configuration file to identify data in the same transaction within the change message data, and store the data in all transactions in that transaction into a preset memory array to achieve the purpose of uniformly processing the same transaction message. The preset consumer and preset server can improve the efficiency of processing business, and storing the data of the same transaction in the memory array for unified processing can ensure the order and consistency of the data, thereby solving the technical problems of relying on message middleware for business processing in related technologies, which have low processing efficiency and are prone to data inconsistency.

[0089] Optionally, the business processing device further includes: a first configuration module, configured to configure database configuration information and message filtering rule configuration information for each database through the preset server before receiving change message data of the target business sent by the preset server, wherein the databases are located in different or the same data sources; and a first generation module, configured to generate a database configuration file for each database based on the database configuration information and message filtering rule configuration information through the preset server.

[0090] Optionally, the business processing device further includes: a first listening module, used to listen to database logs through a preset server after generating a database configuration file for each database; a first acquisition module, used to acquire location information based on the database logs through the preset server, wherein the location information includes at least: the data update time point; and a first access module, used to access a preset service registration center through the preset server and acquire change message data from the preset service registration center based on the location information.

[0091] Optionally, the first access module includes: a first configuration submodule, configured to configure the database address and table address of the business data corresponding to the target business based on the database configuration information through a preset server; a second configuration submodule, configured to configure a preset service address based on the database address and table address through the preset server; and a first access submodule, configured to access a preset service registration center through the preset server based on the preset service address, wherein the preset service registration center is used to record the location information of the database log, and the preset service registration center obtains the database data corresponding to the location information.

[0092] Optionally, the identification unit includes: a first identification module, used to identify operation data in the change message data that belong to the same transaction based on the message body type and the target thread, wherein the message body type includes: transaction start, transaction in progress, and transaction end; and a second acquisition module, used to acquire data in the same transaction based on the operation data.

[0093] Optionally, the processing unit includes: a first parsing module, used to parse the data in all transactions in a preset memory array using a preset application to obtain parsed data; and a first filtering module, used to filter the parsed data according to the business rules of the target business to obtain processing results, wherein the processing results include: processed data, which includes: data before and after updating the target business, the operation type of the operation performed on the target business, and the database identifier and table identifier of the operation.

[0094] Optionally, the business processing device further includes: a first sending module, configured to, after processing data in all transactions in a preset memory array and obtaining processing results, send table identifiers involved in asynchronous task processing in the processing data to the processing system corresponding to the business requirements, based on the business requirements of the target business; wherein the processing system performs business logic processing on the target table indicated by the table identifier and the fields in the target table according to the business requirements to obtain asynchronous task processing results; a first assembly module, configured to assemble the asynchronous task processing results of different processing systems to obtain processing result data; and a first storage module, configured to store the processing result data in a preset database.

[0095] The aforementioned processing device may further include a processor and a memory. The aforementioned receiving unit 40, starting unit 41, identification unit 42, processing unit 43, etc., are all stored in the memory as program units, and the processor executes the aforementioned program units stored in the memory to realize the corresponding functions.

[0096] The aforementioned processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and by adjusting kernel parameters, data from all transactions in a preset memory array can be processed to obtain the result.

[0097] The aforementioned memory may include non-permanent memory in computer-readable media, such as 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 memory chip.

[0098] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: receiving change message data of a target business sent by a preset server, starting a target thread according to a database configuration file, using the target thread to identify data in the same transaction within the change message data, storing the data in the transaction into a preset memory array, processing the data in all transactions in the preset memory array, and obtaining a processing result.

[0099] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored computer program, wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to perform the above-described business processing method.

[0100] According to another aspect of the present invention, an electronic device is also provided, including 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 cause the one or more processors to implement the above-described business processing method.

[0101] Figure 5 This is a hardware structure block diagram of an electronic device (or mobile device) for a business processing method according to an embodiment of the present invention. Figure 5 As shown, the electronic device may include one or more processors 502 (shown as 502a, 502b, ..., 502n in the figure) 502 (processor 502 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 504 for storing data. In addition, it may 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. Those skilled in the art will understand that... Figure 5 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device may also include... Figure 5 The more or fewer components shown, or having the same Figure 5 The different configurations shown.

[0102] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0103] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0104] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0105] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0106] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0107] If the integrated unit is implemented as 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. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0108] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A business processing method, characterized in that, Applied to pre-defined consumer terminals, including: Receive target service change message data sent by a preset server, wherein the change message data includes: database configuration file; Based on the database configuration file, start the target thread; The target thread is used to identify data within the same transaction in the change message data, and the data of the transaction is stored in a preset memory array; Process the data in all the transactions in the preset memory array to obtain a processing result, wherein the processing result includes: processed data; The process further includes, after processing all the data in the transactions in the preset memory array and obtaining the processing results, the following steps: based on the business requirements of the target business, sending the table identifiers involved in asynchronous task processing in the processing data to the processing system corresponding to the business requirements, wherein the processing system performs business logic processing on the target table indicated by the table identifier and the fields in the target table according to the business requirements to obtain asynchronous task processing results; assembling the asynchronous task processing results from different processing systems to obtain processing result data; and storing the processing result data in a preset database.

2. The business processing method according to claim 1, characterized in that, Before receiving the target service change message data sent by the preset server, it also includes: The preset server configures database configuration information and message filtering rule configuration information for each database, wherein the databases are located in different or the same data sources; The preset server generates a database configuration file for each database based on the database configuration information and the message filtering rule configuration information.

3. The business processing method according to claim 2, characterized in that, After generating the database configuration file for each of the databases, the process also includes: The database logs are monitored via the preset server. The preset server obtains location information based on the database logs, wherein the location information includes at least the data update time point; The system accesses the preset service registration center through the preset server and obtains the change message data from the preset service registration center based on the location information.

4. The business processing method according to claim 3, characterized in that, The steps of accessing the preset service registration center through the preset server include: The preset server configures the database address and table address of the business data corresponding to the target business based on the database configuration information. The preset service address is configured based on the database address and the table address through the preset server; The preset server accesses the preset service registration center based on the preset service address. The preset service registration center is used to record the location information of the database logs and obtains the database data corresponding to the location information.

5. The business processing method according to claim 1, characterized in that, The step of identifying data within a transaction of the same transaction in the change message data using the target thread includes: Based on the message body type, the target thread identifies operation data belonging to the same transaction in the change message data, wherein the message body type includes: transaction start, transaction in progress, and transaction end; Based on the operation data, data within the same transaction is obtained.

6. The business processing method according to claim 1, characterized in that, The steps for processing data from all transactions in the preset memory array to obtain a processing result include: The data in all transactions within the preset memory array are parsed using a preset application to obtain the parsed data; Based on the business rules of the target business, the parsed data is filtered to obtain the processing result, wherein the processing data includes: data before and after updating the target business, the operation type of the operation performed on the target business, and the database identifier and table identifier of the operation.

7. A business processing apparatus, characterized in that, Applied to pre-defined consumer terminals, including: A receiving unit is configured to receive change message data of a target service sent by a preset server, wherein the change message data includes: a database configuration file; A startup unit is used to start the target thread according to the database configuration file; The identification unit is used to identify data in the same transaction within the change message data using the target thread, and store the data in the transaction into a preset memory array; A processing unit is configured to process data from all transactions in the preset memory array to obtain a processing result, wherein the processing result includes: processed data; The business processing device further includes: a first sending module, configured to, after processing data in all transactions in the preset memory array and obtaining processing results, send table identifiers involving asynchronous task processing in the processing data to the processing system corresponding to the business requirements of the target business, wherein the processing system performs business logic processing on the target table indicated by the table identifier and the fields in the target table according to the business requirements to obtain asynchronous task processing results; a first assembly module, configured to assemble the asynchronous task processing results of different processing systems to obtain processing result data; and a first storage module, configured to store the processing result data in a preset database.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the business processing method according to any one of claims 1 to 6.

9. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being 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 cause the one or more processors to implement the business processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Log processing method, system and device, client and storage medium

    CN113760845A