Event asynchronous processing method, device, computer equipment and storage medium

By creating a new asynchronous event table in the points deduction transaction interface and adopting a state machine and batch scheduling, the problem of long data processing time in the existing technology is solved and the data processing efficiency is improved.

CN114201285BActive Publication Date: 2025-09-26PINGAN YIQIANBAO E COMMERCE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111559128.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-20
Publication Date
2025-09-26
Estimated Expiration
2041-12-20

AI Technical Summary

Technical Problem

In the existing technology, after the real-time account is completed at the collection layer of the points deduction transaction interface, the collection flow and asset channel account information are spliced ​​and inserted into the collection synchronization flow table in batches. The spliced ​​messages are directly sent to the message queue in batches for processing, which cannot reduce time consumption and affects the overall data processing efficiency.

Method used

By creating a new asynchronous event table after the collection layer is completed, the transaction metadata is written into the asynchronous event table, and the state machine and batch scheduling are used to determine the output result according to the asynchronous event code to ensure the timeliness of data processing.

Benefits of technology

It implements asynchronous event and scheduling coordination based on the state machine to ensure the timeliness of data processing and improve data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114201285B_ABST
    Figure CN114201285B_ABST
Patent Text Reader

Abstract

The present invention relates to big data technology and provides an event asynchronous processing method, device, equipment and medium. The method first obtains data to be processed, and then if it is determined that the asynchronous processing state is in the on state, writes the data to be processed into an asynchronous event table for storage and switches the state to the initial state. Afterwards, if it is determined that the data to be processed is obtained through batch scheduling, its state is switched to a processing state, and the first output result of the data to be processed is determined according to the asynchronous event code of the data to be processed in the asynchronous event table. If it is determined that the first output result of the data to be processed and the metadata of the data to be processed meet the conversion condition, its state is switched to a first output label state. Finally, if it is determined that the first output result of the data to be processed and the metadata of the data to be processed do not meet the conversion condition, its state is switched to a second output label state. Asynchronous events and scheduling based on a state machine are implemented to ensure the timeliness of data processing and improve data processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of big data processing, and in particular to a method, apparatus, computer equipment and storage medium for asynchronous event processing. Background Art

[0002] Currently, many online shopping and insurance platforms support transactions using points to deduct cash. For example, on an insurance platform, the points deduction transaction interface experienced significant latency. Investigation revealed that excessive aggregation and asynchronous accrual transactions were the cause. When a points member makes a purchase, the deduction interface deducts points from the account based on the merchant. Accounts are organized into four layers: assets, channels, aggregation, and accrual. The asset, channel, and aggregation layers record transaction information in real time, while accrual records at the accrual layer serve as the basis for reconciliation. After the aggregation layer completes real-time transactions, the aggregation and asset channel account information is concatenated and batch-inserted into the aggregation synchronous flow table, serving as the data source for asynchronous accrual processing. The extended latency of some transaction interfaces is attributed to an excessive number of aggregation records. Most consumer point deduction transactions take between 122ms and 800ms, which is within the acceptable range for upstream providers. A few experience a worst-case latency of 5s to 7s, impacting business timeliness.

[0003] The excessive number of records in the synchronized flow table, resulting from the splicing and insertion required to asynchronously supplement accruals, is a key factor impacting business timeliness. Directly sending batches of spliced ​​messages for QQ processing (which essentially means sending them to a message queue) does not fundamentally reduce the time required for real-time interfaces, nor does it improve the overall data processing efficiency of the process. Summary of the Invention

[0004] The embodiments of the present invention provide an event asynchronous processing method, apparatus, computer equipment and storage medium, which are intended to solve the problem in the prior art that after the real-time dynamic accounting is completed at the aggregation layer of the point deduction transaction interface, the aggregation flow and asset channel account information are spliced ​​and inserted into the aggregation synchronization flow table in batches, and the spliced ​​messages are directly sent to the message queue for batch processing, which fails to reduce time consumption and reduces the overall data processing efficiency.

[0005] In a first aspect, an embodiment of the present invention provides a method for asynchronously processing events, comprising:

[0006] In response to a user account data change instruction, obtaining data to be processed corresponding to the user account data change instruction;

[0007] If it is determined that the asynchronous processing state is in the on state, the data to be processed is written into the asynchronous event table for storage, and the state of the data to be processed is switched to the initial state;

[0008] If it is determined that the data to be processed in the asynchronous event table is obtained through batch scheduling, the state of the data to be processed is switched to a processing state, and a first output result of the data to be processed is determined according to the asynchronous event code of the data to be processed in the asynchronous event table;

[0009] If it is determined that the first output result of the data to be processed and the meta-information of the data to be processed meet a preset conversion condition, switching the state of the data to be processed to a first output label state; and

[0010] If it is determined that the first output result of the data to be processed and the meta-information of the data to be processed do not satisfy a preset conversion condition, the state of the data to be processed is switched to a second output label state.

[0011] In a second aspect, an embodiment of the present invention provides an event asynchronous processing device, comprising:

[0012] a to-be-processed data acquisition unit, configured to, in response to a user account data change instruction, acquire the to-be-processed data corresponding to the user account data change instruction;

[0013] a first asynchronous processing unit configured to, if determining that the asynchronous processing state is the on state, write the data to be processed into the asynchronous event table for storage, and switch the state of the data to be processed to the initial state;

[0014] a second asynchronous processing unit configured to, if it is determined that the data to be processed in the asynchronous event table is obtained through batch scheduling, switch the state of the data to be processed to a processing state, and determine a first output result of the data to be processed according to the asynchronous event code of the data to be processed in the asynchronous event table;

[0015] a third asynchronous processing unit, configured to switch the state of the data to be processed to a first output label state if it is determined that the first output result of the data to be processed and the meta-information of the data to be processed meet a preset conversion condition; and

[0016] The fourth asynchronous processing unit is configured to switch the state of the data to be processed to a second output label state if it is determined that the first output result of the data to be processed and the meta-information of the data to be processed do not satisfy a preset conversion condition.

[0017] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the event asynchronous processing method described in the first aspect is implemented.

[0018] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the event asynchronous processing method described in the first aspect above.

[0019] The embodiment of the present invention provides an event asynchronous processing method, device, computer equipment and storage medium, which first obtains the data to be processed, and then if it is determined that the asynchronous processing state is on, writes the data to be processed into the asynchronous event table for storage, and switches the state of the data to be processed to the initial state. Afterwards, if it is determined that the data to be processed in the asynchronous event table is obtained through batch scheduling, the state of the data to be processed is switched to the processing state, and the first output result of the data to be processed is determined according to the asynchronous event code of the data to be processed in the asynchronous event table. If it is determined that the first output result of the data to be processed and the metadata of the data to be processed meet the preset conversion conditions, the state of the data to be processed is switched to the first output label state. Finally, if it is determined that the first output result of the data to be processed and the metadata of the data to be processed do not meet the preset conversion conditions, the state of the data to be processed is switched to the second output label state. Asynchronous events and scheduling based on the state machine are implemented to ensure the timeliness of data processing and improve data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0021] Figure 1 A schematic diagram of an application scenario of the event asynchronous processing method provided by an embodiment of the present invention;

[0022] Figure 2 A schematic diagram of a flow chart of a method for asynchronous event processing provided by an embodiment of the present invention;

[0023] Figure 3 A schematic block diagram of an event asynchronous processing device provided by an embodiment of the present invention;

[0024] Figure 4 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0026] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0027] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0028] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0029] See also Figure 1 and Figure 2 , Figure 1 A schematic diagram of an application scenario of the event asynchronous processing method provided by an embodiment of the present invention; Figure 2 This is a flow chart of an event asynchronous processing method provided by an embodiment of the present invention. The event asynchronous processing method is applied in a server and is executed by application software installed in the server.

[0030] like Figure 2 As shown, the method includes steps S101 to S105.

[0031] S101 . In response to a user account data change instruction, obtain data to be processed corresponding to the user account data change instruction.

[0032] In this embodiment, the technical solution is described with the server as the execution entity. This application uses the specific application scenario of a user purchasing a product using points consumption, where the points deduction interface deducts points from the user's account based on the merchant's corresponding product. When a user selects a product through the client and chooses to use points to deduct cash for payment, a user account data change instruction is generated and sent to the server. A typical user's account consists of four layers: the asset layer, the channel layer, the collection layer, and the accrual layer. The asset, channel, and collection layers record transaction information in real time, while the accrual layer's accrual flow records provide a basis for reconciliation. After the collection layer completes real-time transaction information, the collection flow and asset channel account information are concatenated and batch-inserted into the collection synchronization flow table, serving as the data source for asynchronous accrual flow processing. If directly sending the aggregated synchronous flow sheet to the message queue in batches still doesn't guarantee faster processing, you can create a new asynchronous event table after the aggregate layer completes the account movement. This table stores transaction metadata, such as the transaction number, merchant, member, and transaction type. This asynchronous event record serves as the data source for asynchronous accrual flow processing, thus avoiding the time-consuming process of splicing aggregated flow sheets and batch inserting them into the aggregated synchronous flow sheet. The pending data corresponding to the user account data change instruction detected by the server can be written to the asynchronous event table as an asynchronous event record.

[0033] S102: If it is determined that the asynchronous processing state is in the on state, the data to be processed is written into the asynchronous event table for storage, and the state of the data to be processed is switched to the initial state.

[0034] In this embodiment, since an asynchronous event table is pre-created in the server, the asynchronous event table is deployed in a corresponding relational database such as Oracle. The asynchronous event table is controlled by an asynchronous switch. If the asynchronous switch is turned on, the asynchronous event table is in an effective state, indicating that data can be written to the asynchronous event table. Once data to be processed is detected in the server, the data to be processed is first written into the asynchronous event table as an asynchronous event record data, and the state of the asynchronous event state machine of the data to be processed is switched to the initial state. Among them, a pessimistic lock is used in the state switching process of the asynchronous event state machine to ensure that the data in the asynchronous event table is in a locked state during the state switching process, ensuring that the data is not easily changed, resulting in errors in the data processing process. In subsequent steps, as long as the state of the asynchronous event state machine is switched, a pessimistic lock is used in the state switching process of the asynchronous event state machine.

[0035] In one embodiment, after step S102, the method further includes:

[0036] The asynchronous event code is determined according to the write event type of the to-be-processed data written into the asynchronous event table.

[0037] In this embodiment, since multiple asynchronous event record data can be written into the asynchronous event table, the write event type corresponding to the asynchronous event record data to be processed can be first obtained. For example, at the accrual layer of the points deduction interface, if both the asynchronous accrual flow and the C-merchant credit business are processed, the asynchronous event code is determined to be 11; if neither the asynchronous accrual flow nor the C-merchant credit business is processed, the asynchronous event code is determined to be 00; if only the C-merchant credit business is processed and the asynchronous accrual flow is not processed, the asynchronous event code is determined to be 01; if only the C-merchant credit business is processed and the asynchronous accrual flow is not processed, the asynchronous event code is determined to be 10. It can be seen that using asynchronous event codes to identify each asynchronous event to be processed can effectively distinguish different asynchronous events and perform separate asynchronous processing.

[0038] In one embodiment, after step S101, the method further includes:

[0039] If it is determined that the asynchronous processing state is a closed state, a serial number is generated corresponding to the data to be processed, and the data to be processed is calculated in an original scheduling manner to obtain an output result.

[0040] In this embodiment, since the asynchronous event table is controlled by the asynchronous switch, if the asynchronous switch is off, it indicates that the asynchronous event table is in an inactive state, indicating that data cannot be written to the asynchronous event table. In this case, a serial number (which can be understood as an active account serial number) is directly generated based on the data to be processed, and then the data to be processed is calculated using the original scheduling method to obtain an output result. The original scheduling method refers to the scheduling method that originally processes accrued active account serial numbers.

[0041] S103: If it is determined that the data to be processed in the asynchronous event table is obtained through batch scheduling, the state of the data to be processed is switched to a processing state, and a first output result of the data to be processed is determined according to the asynchronous event code of the data to be processed in the asynchronous event table.

[0042] In this embodiment, after the data to be processed is stored in the asynchronous event table, the state of the data to be processed is first switched to the processing state, and then the data to be processed is sent to the batch processing schedule through the message queue (sending through the message queue can be simply referred to as sending Q), and the business logic in the batch processing schedule and the time processing method corresponding to the asynchronous event code are used to operate on the data to be processed to obtain the first output result.

[0043] In one embodiment, step S103 includes:

[0044] Sending the data to be processed to a process corresponding to the batch scheduling through a message queue, and switching the state of the data to be processed from an initial state to a processing state;

[0045] If it is determined that the asynchronous event code is a preset first code value, obtaining a first operation logic corresponding to the first code value, and performing an operation on the data to be processed in the process using the first operation logic to obtain a first output result;

[0046] If it is determined that the asynchronous event code is a preset second code value, obtaining a second operation logic corresponding to the second code value, and performing an operation on the data to be processed in the process using the second operation logic to obtain a first output result;

[0047] If it is determined that the asynchronous event code is a preset third code value, obtaining a third operation logic corresponding to the third code value, and performing an operation on the data to be processed in the process using the third operation logic to obtain a first output result;

[0048] If it is determined that the asynchronous event code is a preset fourth code value, a fourth operation logic corresponding to the fourth code value is obtained, and the data to be processed is operated by the fourth operation logic in the process to obtain a first output result.

[0049] In this embodiment, the preset first coding value is 00, the second coding value is 01, the third coding value is 10, and the fourth coding value is 11; if it is determined that the asynchronous event code is the preset first coding value (i.e., 00), it means that neither the asynchronous accrual flow nor the C-merchant credit business is processed, then the first operation logic corresponding to the first coding value is obtained and the data to be processed is operated based on the first operation logic to obtain a first output result; if it is determined that the asynchronous event code is the preset second coding value (i.e., 01), it means that the asynchronous accrual flow is not processed and only the C-merchant credit business is processed, then the second operation logic corresponding to the second coding value is obtained and based on the second operation logic, the first output result is obtained. The calculation logic operates on the data to be processed to obtain a first output result; if it is determined that the asynchronous event code is the preset third code value (i.e. 10), it means that only asynchronous accrual flow is processed and C-merchant credit business is not processed. At this time, the third calculation logic corresponding to the third code value is obtained and the data to be processed is calculated based on the third calculation logic to obtain the first output result; if it is determined that the asynchronous event code is the preset fourth code value (i.e. 11), it means that both asynchronous accrual flow and C-merchant credit business are processed. At this time, the fourth calculation logic corresponding to the fourth code value is obtained and the data to be processed is calculated based on the fourth calculation logic to obtain the first output result. It can be seen that based on the asynchronous event table containing the processing data corresponding to the asynchronous event code, the type of business to be processed can be determined according to the code. Currently, asynchronous accrual flow and C-merchant credit business are processed. In the future, the asynchronous expansion of B-end merchant flow can be added. It can be expanded to process non-time-sensitive businesses. If there is a new business, it will not affect the original business, and the use flexibility is high.

[0050] In one embodiment, switching the state of the to-be-processed data to a processing state includes:

[0051] The state of the data to be processed is switched from an initial state to a processing state.

[0052] In this embodiment, once the data to be processed in the asynchronous event table is obtained through batch scheduling for calculation and processing, it is necessary to promptly switch the state of the data to be processed from the initial state to the processing state to ensure that the state of the asynchronous event state machine corresponds to the current data processing process, thereby correctly identifying the data processing state.

[0053] S104: If it is determined that the first output result of the data to be processed and the meta-information of the data to be processed meet a preset conversion condition, switch the state of the data to be processed to a first output label state.

[0054] In this embodiment, after obtaining a first output result corresponding to the data to be processed based on the asynchronous event table and batch scheduling processing, it is necessary to compare the metadata of the data to be processed (i.e., the metadata of the data to be processed, i.e., the metadata of the data to be processed, such as the metadata of the transaction for processing accruals or credits) with the original transaction information based on the transaction number, transaction number, and other information to further confirm the correctness of the processing result. Once it is determined that the first output result and the metadata of the data to be processed meet the preset conversion conditions (for example, if the calculation logic used to convert the metadata to the first output result is the same as the calculation logic used in the batch scheduling processing, it can be determined that the first output result and the metadata of the data to be processed meet the preset conversion conditions), the processing result is correct.

[0055] In one embodiment, switching the state of the to-be-processed data to the first output tag state includes:

[0056] The state of the data to be processed is switched from a processing state to a first output tag state.

[0057] In this embodiment, the state of the data to be processed is switched from the processing state to the first output tag state, where the first output tag state can be understood as a successful processing state. Since the state of the asynchronous event state machine is switched in time, the latest state of the data processing can be effectively identified.

[0058] By marking the first output tag state as S (S stands for Success) in the asynchronous event table's state machine, the business message is guaranteed to be successfully sent. Message reception and processing are consistent with the original asynchronous accrual flow logic. The original reconciliation schedule ensures bidirectional verification of transactions and post-processing asynchronous events, accurately identifying any business anomalies. However, if a message processing anomaly occurs, the asynchronous event state machine will have already been re-set to S, and the message will not be resent. Therefore, a compensation schedule is required to re-initiate processing of the anomaly to ensure robustness.

[0059] S105: If it is determined that the first output result of the data to be processed and the meta-information of the data to be processed do not satisfy a preset conversion condition, switch the state of the data to be processed to a second output label state.

[0060] In this embodiment, if it is determined that the first output result of the data to be processed and the metadata of the data to be processed do not meet the preset conversion conditions, it means that the correctness of the processing result cannot be guaranteed. At this time, the state of the data to be processed can be switched from the processing state to the second output label state, where the second output label state can be understood as a processing failure state (the failure state can be represented by F, the abbreviation for Fail). The reason for obtaining the data to be processed in the processing failure state is to ensure that it is subsequently reprocessed until the correct processing result is obtained.

[0061] In one embodiment, after step S105, the method further includes:

[0062] The data to be processed is acquired in a second output tag state or a processing state, and a second output result of the data to be processed is acquired through leak patching scheduling.

[0063] In this embodiment, if there is data to be processed that is in the second output tag state or is in the processing state for a long time (for example, if it remains in the processing state for more than 5 minutes, it can be considered to be in the processing state for a long time), leak-filling scheduling can be used to obtain the second output result of the data to be processed. Leak-filling scheduling means that when there is data to be processed that is in the second output tag state or in the processing state, the batch processing scheduling will reprocess the data to be processed until it is successfully processed.

[0064] The embodiments of the present application can acquire and process data from related servers based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.

[0065] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0066] This method implements asynchronous event scheduling based on a state machine to ensure the timeliness of data processing and improve data processing efficiency.

[0067] The embodiment of the present invention further provides an event asynchronous processing device, which is used to execute any embodiment of the aforementioned event asynchronous processing method. Figure 3 , Figure 3 It is a schematic block diagram of an event asynchronous processing device 100 provided in an embodiment of the present invention.

[0068] Among them, such as Figure 3 As shown, the event asynchronous processing device 100 includes a to-be-processed data acquisition unit 101 , a first asynchronous processing unit 102 , a second asynchronous processing unit 103 , a third asynchronous processing unit 104 and a fourth asynchronous processing unit 105 .

[0069] The to-be-processed data acquiring unit 101 is configured to, in response to a user account data change instruction, acquire the to-be-processed data corresponding to the user account data change instruction.

[0070] In this embodiment, the technical solution is described using a server as the execution entity. This application uses the specific application scenario of a user purchasing a product using points, and the points deduction interface deducting points from the user's account based on the merchant's corresponding product. A typical user's account consists of four layers: the asset layer, the channel layer, the collection layer, and the accrual layer. The asset, channel, and collection layers record transaction information in real time, while the accrual layer's accrual flow records provide the basis for reconciliation. After the collection layer completes real-time account movement, the collection flow records and asset channel account information are concatenated and batch inserted into the collection synchronization flow table, serving as the data source for asynchronous accrual flow processing. If directly sending the collection synchronization flow table in batches to a message queue for processing still fails to minimize processing time, a new asynchronous event table can be created after the collection layer completes the transaction. Transaction metadata, such as transaction number, merchant, member, and transaction type, can be written to the asynchronous event table. This single asynchronous event record serves as the data source for asynchronous accrual flow processing, thus avoiding the time-consuming concatenation of collection flow records and batch insertion into the collection synchronization flow table. The data to be processed corresponding to the user account data change instruction detected by the server may be written into the asynchronous event table as an asynchronous event record data.

[0071] The first asynchronous processing unit 102 is configured to write the data to be processed into the asynchronous event table for storage and switch the state of the data to be processed to the initial state if it is determined that the asynchronous processing state is the on state.

[0072] In this embodiment, since an asynchronous event table is pre-created in the server, the asynchronous event table is deployed in a corresponding relational database such as Oracle. The asynchronous event table is controlled by an asynchronous switch. If the asynchronous switch is turned on, the asynchronous event table is in an effective state, indicating that data can be written to the asynchronous event table. Once data to be processed is detected in the server, the data to be processed is first written into the asynchronous event table as an asynchronous event record data, and the state of the asynchronous event state machine of the data to be processed is switched to the initial state. Among them, a pessimistic lock is used in the state switching process of the asynchronous event state machine to ensure that the data in the asynchronous event table is in a locked state during the state switching process, ensuring that the data is not easily changed, resulting in errors in the data processing process. In subsequent steps, as long as the state of the asynchronous event state machine is switched, a pessimistic lock is used in the state switching process of the asynchronous event state machine.

[0073] In one embodiment, the event asynchronous processing device 100 further includes:

[0074] The asynchronous event code acquiring unit is configured to determine the asynchronous event code according to the write event type of the to-be-processed data written into the asynchronous event table.

[0075] In this embodiment, since multiple asynchronous event record data can be written into the asynchronous event table, the write event type corresponding to the asynchronous event record data to be processed can be first obtained. For example, at the accrual layer of the points deduction interface, if both the asynchronous accrual flow and the C-merchant credit business are processed, the asynchronous event code is determined to be 11; if neither the asynchronous accrual flow nor the C-merchant credit business is processed, the asynchronous event code is determined to be 00; if only the C-merchant credit business is processed and the asynchronous accrual flow is not processed, the asynchronous event code is determined to be 01; if only the C-merchant credit business is processed and the asynchronous accrual flow is not processed, the asynchronous event code is determined to be 10. It can be seen that using asynchronous event codes to identify each asynchronous event to be processed can effectively distinguish different asynchronous events and perform separate asynchronous processing.

[0076] In one embodiment, the event asynchronous processing device 100 further includes:

[0077] The output result acquisition unit is used to generate a serial number for the data to be processed if it is determined that the asynchronous processing state is a closed state, and to calculate the data to be processed in an original scheduling manner to obtain an output result.

[0078] In this embodiment, since the asynchronous event table is controlled by the asynchronous switch, if the asynchronous switch is off, it indicates that the asynchronous event table is in an inactive state, indicating that data cannot be written to the asynchronous event table. In this case, a serial number (which can be understood as an active account serial number) is directly generated based on the data to be processed, and then the data to be processed is calculated using the original scheduling method to obtain an output result. The original scheduling method refers to the scheduling method that originally processes accrued active account serial numbers.

[0079] The second asynchronous processing unit 103 is used to switch the state of the data to be processed to a processing state if it is determined that the data to be processed in the asynchronous event table is obtained through batch scheduling, and to determine the first output result of the data to be processed according to the asynchronous event code of the data to be processed in the asynchronous event table.

[0080] In this embodiment, after the data to be processed is stored in the asynchronous event table, the state of the data to be processed is first switched to the processing state, and then the data to be processed is sent to the batch processing schedule through the message queue (sending through the message queue can be simply referred to as sending Q), and the business logic in the batch processing schedule and the time processing method corresponding to the asynchronous event code are used to operate on the data to be processed to obtain the first output result.

[0081] In one embodiment, the second asynchronous processing unit 103 is specifically configured to:

[0082] Sending the data to be processed to a process corresponding to the batch scheduling through a message queue, and switching the state of the data to be processed from an initial state to a processing state;

[0083] If it is determined that the asynchronous event code is a preset first code value, obtaining a first operation logic corresponding to the first code value, and performing an operation on the data to be processed in the process using the first operation logic to obtain a first output result;

[0084] If it is determined that the asynchronous event code is a preset second code value, obtaining a second operation logic corresponding to the second code value, and performing an operation on the data to be processed in the process using the second operation logic to obtain a first output result;

[0085] If it is determined that the asynchronous event code is a preset third code value, obtaining a third operation logic corresponding to the third code value, and performing an operation on the data to be processed in the process using the third operation logic to obtain a first output result;

[0086] If it is determined that the asynchronous event code is a preset fourth code value, a fourth operation logic corresponding to the fourth code value is obtained, and the data to be processed is operated by the fourth operation logic in the process to obtain a first output result.

[0087] In this embodiment, the preset first coding value is 00, the second coding value is 01, the third coding value is 10, and the fourth coding value is 11; if it is determined that the asynchronous event code is the preset first coding value (i.e., 00), it means that neither the asynchronous accrual flow nor the C-merchant credit business is processed, then the first operation logic corresponding to the first coding value is obtained and the data to be processed is operated based on the first operation logic to obtain a first output result; if it is determined that the asynchronous event code is the preset second coding value (i.e., 01), it means that the asynchronous accrual flow is not processed and only the C-merchant credit business is processed, then the second operation logic corresponding to the second coding value is obtained and based on the second operation logic, the first output result is obtained. The calculation logic operates on the data to be processed to obtain a first output result; if it is determined that the asynchronous event code is the preset third code value (i.e. 10), it means that only asynchronous accrual flow is processed and C-merchant credit business is not processed. At this time, the third calculation logic corresponding to the third code value is obtained and the data to be processed is calculated based on the third calculation logic to obtain the first output result; if it is determined that the asynchronous event code is the preset fourth code value (i.e. 11), it means that both asynchronous accrual flow and C-merchant credit business are processed. At this time, the fourth calculation logic corresponding to the fourth code value is obtained and the data to be processed is calculated based on the fourth calculation logic to obtain the first output result. It can be seen that based on the asynchronous event table containing the processing data corresponding to the asynchronous event code, the type of business to be processed can be determined according to the code. Currently, asynchronous accrual flow and C-merchant credit business are processed. In the future, the asynchronous expansion of B-end merchant flow can be added. It can be expanded to process non-time-sensitive businesses. If there is a new business, it will not affect the original business, and the use flexibility is high.

[0088] In one embodiment, the second asynchronous processing unit 103 is further specifically configured to:

[0089] The state of the data to be processed is switched from an initial state to a processing state.

[0090] In this embodiment, once the data to be processed in the asynchronous event table is obtained through batch scheduling for calculation and processing, it is necessary to promptly switch the state of the data to be processed from the initial state to the processing state to ensure that the state of the asynchronous event state machine corresponds to the current data processing process, thereby correctly identifying the data processing state.

[0091] The third asynchronous processing unit 104 is configured to switch the state of the data to be processed to the first output tag state if it is determined that the first output result of the data to be processed and the meta-information of the data to be processed meet a preset conversion condition.

[0092] In this embodiment, after obtaining a first output result corresponding to the data to be processed based on the asynchronous event table and batch scheduling processing, it is necessary to compare the metadata of the data to be processed (i.e., the metadata of the data to be processed, i.e., the metadata of the data to be processed, such as the metadata of the transaction for processing accruals or credits) with the original transaction information based on the transaction number, transaction number, and other information to further confirm the correctness of the processing result. Once it is determined that the first output result and the metadata of the data to be processed meet the preset conversion conditions (for example, if the calculation logic used to convert the metadata to the first output result is the same as the calculation logic used in the batch scheduling processing, it can be determined that the first output result and the metadata of the data to be processed meet the preset conversion conditions), the processing result is correct.

[0093] In one embodiment, the third asynchronous processing unit 104 is further specifically configured to:

[0094] The state of the data to be processed is switched from a processing state to a first output tag state.

[0095] In this embodiment, the state of the data to be processed is switched from the processing state to the first output tag state, where the first output tag state can be understood as a successful processing state. Since the state of the asynchronous event state machine is switched in time, the latest state of the data processing can be effectively identified.

[0096] By marking the first output tag state as S (S stands for Success) in the asynchronous event table's state machine, the business message is guaranteed to be successfully sent. Message reception and processing are consistent with the original asynchronous accrual flow logic. The original reconciliation schedule ensures bidirectional verification of transactions and post-processing asynchronous events, accurately identifying any business anomalies. However, if a message processing anomaly occurs, the asynchronous event state machine will have already been re-set to S, and the message will not be resent. Therefore, a compensation schedule is required to re-initiate processing of the anomaly to ensure robustness.

[0097] The fourth asynchronous processing unit 105 is configured to switch the state of the data to be processed to a second output tag state if it is determined that the first output result of the data to be processed and the meta-information of the data to be processed do not satisfy a preset conversion condition.

[0098] In this embodiment, if it is determined that the first output result of the data to be processed and the metadata of the data to be processed do not meet the preset conversion conditions, it means that the correctness of the processing result cannot be guaranteed. At this time, the state of the data to be processed can be switched from the processing state to the second output label state, where the second output label state can be understood as a processing failure state (the failure state can be represented by F, the abbreviation for Fail). The reason for obtaining the data to be processed in the processing failure state is to ensure that it is subsequently reprocessed until the correct processing result is obtained.

[0099] In one embodiment, the event asynchronous processing device 100 further includes:

[0100] The second output result obtaining unit is used to obtain the data to be processed whose status is the second output tag status or the processing status, and obtain the second output result of the data to be processed through leak filling scheduling.

[0101] In this embodiment, if there is data to be processed that is in the second output tag state or is in the processing state for a long time (for example, if it remains in the processing state for more than 5 minutes, it can be considered to be in the processing state for a long time), leak-filling scheduling can be used to obtain the second output result of the data to be processed. Leak-filling scheduling means that when there is data to be processed that is in the second output tag state or in the processing state, the batch processing scheduling will reprocess the data to be processed until it is successfully processed.

[0102] The device implements asynchronous event plus scheduling based on the state machine to ensure the timeliness of data processing and improve data processing efficiency.

[0103] The above-mentioned event asynchronous processing device can be implemented in the form of a computer program. The computer program can be used in Figure 4 Runs on the computer equipment shown.

[0104] See also Figure 4 , Figure 4 1 is a schematic block diagram of a computer device provided in an embodiment of the present invention. The computer device 500 is a server or a server cluster. The server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0105] See Figure 4 The computer device 500 includes a processor 502 , a memory, and a network interface 505 connected via a device bus 501 , wherein the memory may include a storage medium 503 and an internal memory 504 .

[0106] The storage medium 503 can store an operating device 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 can execute an event asynchronous processing method.

[0107] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500.

[0108] The internal memory 504 provides an environment for the operation of the computer program 5032 in the storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute the event asynchronous processing method.

[0109] The network interface 505 is used for network communication, such as providing data information transmission. Those skilled in the art will understand that Figure 4 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention and does not constitute a limitation on the computer device 500 to which the solution of the present invention is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0110] The processor 502 is configured to run a computer program 5032 stored in a memory to implement the event asynchronous processing method disclosed in an embodiment of the present invention.

[0111] Those skilled in the art will understand that Figure 4 The embodiment of the computer device shown in the figure does not constitute a limitation on the specific composition of the computer device. In other embodiments, the computer device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, in some embodiments, the computer device may only include a memory and a processor. In such an embodiment, the structure and function of the memory and processor are the same as those in the figure. Figure 4 The embodiments shown are consistent and will not be described again here.

[0112] It should be understood that in the embodiment of the present invention, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0113] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the event asynchronous processing method disclosed in an embodiment of the present invention.

[0114] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0115] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, or units with the same function may be combined into one unit. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.

[0116] The units described as separate components may or may not be physically separate, and 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 network units. Some or all of these units may be selected according to actual needs to achieve the objectives of the embodiments of the present invention.

[0117] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0118] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a backend server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk.

[0119] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.

Claims

1. A method for asynchronous event processing, characterized in that: include: In response to a user account data change instruction, obtaining data to be processed corresponding to the user account data change instruction; If it is determined that the asynchronous processing state is in the on state, the data to be processed is written into the asynchronous event table for storage, and the state of the data to be processed is switched to the initial state; If it is determined that the data to be processed in the asynchronous event table is obtained through batch scheduling, the state of the data to be processed is switched to a processing state, and a first output result of the data to be processed is determined according to the asynchronous event code of the data to be processed in the asynchronous event table; If it is determined that the first output result of the data to be processed and the metadata of the data to be processed meet a preset conversion condition, switching the state of the data to be processed to a first output label state; as well as If it is determined that the first output result of the data to be processed and the metadata of the data to be processed do not meet the preset conversion condition, switching the state of the data to be processed to the second output label state; The meta information of the data to be processed refers to the meta information for processing the supplementary accrual flow or the supplementary credit.

2. The event asynchronous processing method according to claim 1, characterized in that: If it is determined that the asynchronous processing state is in the on state, the data to be processed is written into the asynchronous event table for storage, and the state of the data to be processed is switched to the initial state, the method further includes: The asynchronous event code is determined according to the write event type of the to-be-processed data written into the asynchronous event table.

3. The event asynchronous processing method according to claim 1, characterized in that: After obtaining the to-be-processed data corresponding to the user account data change instruction in response to the user account data change instruction, the method further includes: If it is determined that the asynchronous processing state is a closed state, a serial number is generated corresponding to the data to be processed, and the data to be processed is calculated in an original scheduling manner to obtain an output result.

4. The event asynchronous processing method according to claim 1, characterized in that: If it is determined that the data to be processed in the asynchronous event table is obtained through batch scheduling, switching the state of the data to be processed to a processing state, and determining a first output result of the data to be processed according to the asynchronous event code of the data to be processed in the asynchronous event table, includes: Sending the data to be processed to a process corresponding to the batch scheduling through a message queue, and switching the state of the data to be processed from an initial state to a processing state; If it is determined that the asynchronous event code is a preset first code value, obtaining a first operation logic corresponding to the first code value, and performing an operation on the data to be processed in the process using the first operation logic to obtain a first output result; If it is determined that the asynchronous event code is a preset second code value, obtaining a second operation logic corresponding to the second code value, and performing an operation on the data to be processed in the process using the second operation logic to obtain a first output result; If it is determined that the asynchronous event code is a preset third code value, obtaining a third operation logic corresponding to the third code value, and performing an operation on the data to be processed in the process using the third operation logic to obtain a first output result; If it is determined that the asynchronous event code is a preset fourth code value, a fourth operation logic corresponding to the fourth code value is obtained, and the data to be processed is operated by the fourth operation logic in the process to obtain a first output result.

5. The event asynchronous processing method according to claim 1, characterized in that: Switching the state of the to-be-processed data to a processing state includes: The state of the data to be processed is switched from an initial state to a processing state.

6. The event asynchronous processing method according to claim 1, characterized in that: Switching the state of the to-be-processed data to the first output tag state includes: The state of the data to be processed is switched from a processing state to a first output tag state.

7. The event asynchronous processing method according to claim 1, characterized in that: If it is determined that the first output result of the data to be processed and the metadata of the data to be processed do not meet the preset conversion condition, after the state of the data to be processed is switched to the second output label state, the method further includes: The data to be processed is acquired in a second output tag state or a processing state, and a second output result of the data to be processed is acquired through leak patching scheduling.

8. An event asynchronous processing device, characterized in that: include: a to-be-processed data acquisition unit, configured to, in response to a user account data change instruction, acquire the to-be-processed data corresponding to the user account data change instruction; a first asynchronous processing unit configured to, if determining that the asynchronous processing state is the on state, write the data to be processed into the asynchronous event table for storage, and switch the state of the data to be processed to the initial state; a second asynchronous processing unit configured to, if it is determined that the data to be processed in the asynchronous event table is obtained through batch scheduling, switch the state of the data to be processed to a processing state, and determine a first output result of the data to be processed according to the asynchronous event code of the data to be processed in the asynchronous event table; a third asynchronous processing unit, configured to switch the state of the data to be processed to a first output label state if it is determined that the first output result of the data to be processed and the meta-information of the data to be processed meet a preset conversion condition; as well as a fourth asynchronous processing unit, configured to switch the state of the data to be processed to a second output label state if it is determined that the first output result of the data to be processed and the meta-information of the data to be processed do not satisfy a preset conversion condition; The meta information of the data to be processed refers to the meta information for processing the supplementary accrual flow or the supplementary credit.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the event asynchronous processing method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the event asynchronous processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • A data asynchronous processing method and device

    CN107169064A