Transaction processing method, device, electronic device and storage medium

By using remote dictionary services to determine and execute target transaction steps in a distributed system, the data disorder caused by excessive asynchronous message processing steps are solved, and message processing with high success rate and accuracy is achieved.

CN114217909BActive Publication Date: 2025-03-14JOYME PTE LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111294118.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-03
Publication Date
2025-03-14
Estimated Expiration
2041-11-03

AI Technical Summary

Technical Problem

In distributed systems, when there are too many asynchronous message processing steps and there are up and down dependencies, the error message may lead to data disorder or even serious accidents.

Method used

By obtaining the transaction processing request, the target transaction step is determined based on the message information based on the remote dictionary service, and the step is performed. If the execution is successful, the target execution result is generated and stored in the remote dictionary service.

Benefits of technology

Effectively handle transactions, improve the success rate of message processing and data accuracy, and prevent data disorders and accidents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114217909B_ABST
    Figure CN114217909B_ABST
Patent Text Reader

Abstract

The present disclosure proposes a transaction processing method, device, electronic device and storage medium, which belongs to the field of computer technology. The transaction processing method includes: obtaining a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of the transaction to be processed; determining a target transaction step from the transaction step set based on the message information based on a remote dictionary service; executing the target transaction step; if the target transaction step is successfully executed, generating a target execution result of the target transaction step, and storing the target execution result and the corresponding number of the target transaction step in the remote dictionary service. In this way, effective processing of transactions can be achieved, thereby ensuring the success rate of message processing and improving the accuracy of data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a transaction processing method, device, electronic device and storage medium. Background Art

[0002] At present, asynchronous message data transmission is widely used in various large-scale systems. The asynchronous message interaction mechanism can effectively reduce the coupling between different systems, reduce the complexity of system development, and improve the performance of system processing through high concurrency processing.

[0003] In the related art, for a distributed system, when asynchronously processing messages in a message queue, if there are too many asynchronous processing steps and there are dependencies between the steps, then if one of the steps goes wrong, the message will be put into the message queue again and wait for the next processing. When it is processed for the second time, it will start from the first step, so the data will be disordered and even cause serious accidents. Summary of the invention

[0004] The embodiments of the present disclosure provide a transaction processing method, device, electronic device and storage medium, which can realize effective transaction processing, thereby ensuring the success rate of message processing and improving the accuracy of data.

[0005] The first aspect of the present disclosure proposes a transaction processing method, including: obtaining a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of a transaction to be processed; determining a target transaction step from the transaction step set based on the message information based on a remote dictionary service; executing the target transaction step; if the target transaction step is executed successfully, generating a target execution result of the target transaction step, and storing the target execution result and the number corresponding to the target transaction step in the remote dictionary service.

[0006] In one embodiment of the present disclosure, the transaction processing request is generated in the following manner: obtaining a message queue and determining a target message from the message queue; and generating the transaction processing request according to the target message.

[0007] In one embodiment of the present disclosure, the message information includes an identification code of the transaction to be processed, and the remote dictionary service determines the target transaction step from the transaction step set according to the message information, including: obtaining a status value of the transaction to be processed from the remote dictionary service according to the identification code; if the status value meets a processing condition, querying the remote dictionary service with the identification code as an index to determine whether the remote dictionary service includes transaction step execution history information of the transaction to be processed; if the remote dictionary service does not include the transaction step execution history information, taking the first transaction step in the transaction step set as the target transaction step.

[0008] In one embodiment of the present disclosure, the remote dictionary service is based on the message information to determine the target transaction step from the transaction step set, and further includes: if the remote dictionary service includes the transaction step execution history information, then obtaining the record number and record processing result corresponding to the most recently processed transaction step from the transaction step execution history information; and taking the transaction step corresponding to the next number after the record number in the transaction step set as the target transaction step.

[0009] In one embodiment of the present disclosure, the executing the target transaction step includes: if the remote dictionary service includes the transaction step processing history information, executing the target transaction step according to the record processing result; if the remote dictionary service does not include the transaction step processing history information, directly executing the target transaction step.

[0010] In one embodiment of the present disclosure, the transaction processing method further includes: if the target transaction step is not successfully executed, re-putting the target message into the message queue.

[0011] In one embodiment of the present disclosure, there is at least one target transaction step, and the method further includes: if at least one of the target transaction steps is successfully executed, deleting the transaction step processing history information of the pending transaction from the remote dictionary service according to the identification code.

[0012] The second aspect embodiment of the present disclosure proposes a transaction processing device, including: an acquisition module, used to acquire a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of the transaction to be processed; a determination module, used to determine a target transaction step from the transaction step set according to the message information based on a remote dictionary service; an execution module, used to execute the target transaction step; and a storage module, used to generate a target execution result of the target transaction step if the target transaction step is successfully executed, and store the target execution result and the number corresponding to the target transaction step in the remote dictionary service.

[0013] In one embodiment of the present disclosure, the transaction processing request is generated in the following manner: obtaining a message queue and determining a target message from the message queue; and generating the transaction processing request according to the target message.

[0014] In one embodiment of the present disclosure, the message information includes an identification code of the transaction to be processed, and the determination module is specifically used to: obtain a status value of the transaction to be processed from the remote dictionary service according to the identification code; if the status value meets the processing condition, query the remote dictionary service with the identification code as an index to determine whether the remote dictionary service includes transaction step execution history information of the transaction to be processed; if the remote dictionary service does not include the transaction step execution history information, take the first transaction step in the transaction step set as the target transaction step.

[0015] In one embodiment of the present disclosure, the determination module is further used to: if the remote dictionary service includes the transaction step execution history information, obtain the record number and record processing result corresponding to the most recently processed transaction step from the transaction step execution history information; and take the transaction step corresponding to the next number after the record number in the transaction step set as the target transaction step.

[0016] In one embodiment of the present disclosure, the execution module is specifically used to: if the remote dictionary service includes the transaction step processing history information, execute the target transaction step according to the record processing result; if the remote dictionary service does not include the transaction step processing history information, directly execute the target transaction step.

[0017] In one embodiment of the present disclosure, the transaction processing device further includes: a placing module, configured to place the target message into the message queue again if the target transaction step is not successfully executed.

[0018] In one embodiment of the present disclosure, there is at least one target transaction step, and the device further includes: a deletion module, which is used to delete the transaction step processing history information of the pending transaction from the remote dictionary service according to the identification code if at least one of the target transaction steps is successfully executed.

[0019] An embodiment of the third aspect of the present disclosure proposes an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the transaction processing method proposed in the embodiment of the first aspect of the present disclosure.

[0020] The fourth aspect embodiment of the present disclosure proposes a non-temporary computer-readable storage medium. When the instructions in the storage medium are executed by the processor of an electronic device, the electronic device can execute the transaction processing method proposed in the first aspect embodiment of the present disclosure.

[0021] The fifth aspect embodiment of the present disclosure proposes a computer program product, including a computer program, which implements the transaction processing method proposed in the first aspect embodiment of the present disclosure when executed by a processor in a communication device.

[0022] The transaction processing method, device, electronic device and storage medium provided by the embodiments of the present disclosure first obtain a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of the transaction to be processed, and then determine the target transaction step from the transaction step set based on the message information based on the remote dictionary service, and execute the target transaction step. If the target transaction step is executed successfully, a target execution result of the target transaction step is generated, and the target execution result and the number corresponding to the target transaction step are stored in the remote dictionary service. In this way, effective processing of transactions can be achieved, thereby ensuring the success rate of message processing and improving the accuracy of data.

[0023] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0025] Figure 1 A flowchart of a transaction processing method provided by an embodiment of the present disclosure;

[0026] Figure 2 A flowchart of another transaction processing method provided by an embodiment of the present disclosure;

[0027] Figure 3 A flowchart of another transaction processing method provided by an embodiment of the present disclosure;

[0028] Figure 4 A flowchart of another transaction processing method provided by an embodiment of the present disclosure;

[0029] Figure 5 A flowchart of another transaction processing method provided by an embodiment of the present disclosure;

[0030] Figure 6 A schematic diagram of the structure of a transaction processing device provided by an embodiment of the present disclosure; and

[0031] Figure 7 The figure is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0032] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the embodiments of the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present disclosure as detailed in the appended claims.

[0033] The terms used in the disclosed embodiments are only for the purpose of describing specific embodiments and are not intended to limit the disclosed embodiments. The singular forms of "a", "an" and "the" used in the disclosed embodiments and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0034] It should be understood that although the terms first, second, third, etc. may be used to describe various information in the disclosed embodiments, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the disclosed embodiments, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein may be interpreted as "at" or "when" or "in response to determination".

[0035] The embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and cannot be understood as limiting the present disclosure.

[0036] The transaction processing method, device, electronic device and storage medium of the embodiments of the present disclosure are described below with reference to the accompanying drawings.

[0037] The transaction processing method of the embodiment of the present disclosure may be executed by an electronic device, which may be a server, a PC (Personal Computer), etc., wherein the server may be a cloud server, and the transaction processing method may be executed in the cloud. No limitation is made here.

[0038] In the embodiment of the present disclosure, a processing component, a storage component and a drive component may be provided in the electronic device. Optionally, the drive component and the processing component may be integrated, the storage component may store an operating system, an application program or other program modules, and the processing component implements the transaction processing method provided in the embodiment of the present disclosure by executing the application program stored in the storage component.

[0039] Figure 1 A flowchart of a transaction processing method provided by an embodiment of the present disclosure.

[0040] The transaction processing method of the embodiment of the present disclosure can also be executed by the transaction processing device provided by the embodiment of the present disclosure. The device can be configured in an electronic device to obtain a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of the transaction to be processed, and based on the remote dictionary service, the target transaction step is determined from the transaction step set according to the message information, and then the target transaction step is executed. If the target transaction step is executed successfully, the target execution result of the target transaction step is generated, and the target execution result and the corresponding number of the target transaction step are stored in the remote dictionary service, so as to realize effective processing of the transaction, thereby ensuring the success rate of message processing and improving the accuracy of data.

[0041] like Figure 1 As shown, the transaction processing method may include:

[0042] Step 101: Obtain a transaction processing request, wherein the transaction processing request may include a transaction step set and message information of the transaction to be processed.

[0043] The message information may include an identification code of the pending transaction, which may be a UUID (Universally Unique Identifier). Each pending transaction (message) corresponds to a unique identification code, and the corresponding pending transaction may be found through the identification code.

[0044] In the disclosed embodiment, the processing process of a pending transaction can be divided into multiple transaction steps, which can form a transaction step set. Each transaction step in the transaction step set must ensure atomicity, that is, it either succeeds or fails. For example, an accumulation operation is performed on a certain Key (key value) of a remote dictionary service (Redis). Since the remote dictionary service is an atomic (smallest and non-parallelizable) operation, this step can ensure its atomicity.

[0045] Specifically, a distributed system may include multiple servers. After generating a transaction processing request, an electronic device (for example, a mobile phone) may send (issue) the transaction processing request to multiple servers, which will receive the request. When one of the servers receives (obtains) the transaction processing request and processes it in response to the transaction processing request, other servers will no longer process it in response to the transaction processing request.

[0046] In order to clearly explain the above embodiment, in one embodiment of the present disclosure, as Figure 2 As shown, a transaction request can be generated in the following ways:

[0047] Step 201, obtain a message queue, and determine a target message from the message queue.

[0048] The message may be data transmitted between system applications, and the message queue may be a queue for storing messages. Before storing the message in the message queue, an identification code may be added to each message.

[0049] In the disclosed embodiment, for a distributed system, when a message queue is not used, the user's request data (message) will be directly written to the database. In the case of high concurrency, the pressure on the database will increase dramatically, slowing down the system's response speed. However, after using a message queue, the user's request data (message) will be first stored in the message queue, and then the consumer process of the message queue will obtain the data from the message queue and write it asynchronously to the database. Since the processing speed of the message queue is faster than that of the database (the message queue also has better scalability than the database), the system's response speed will be improved.

[0050] Specifically, the electronic device can obtain the message queue in the distributed system through a relevant API (Application Programming Interface), and determine the target message from the message queue based on a preset determination strategy, wherein the preset determination strategy can be calibrated according to actual conditions and requirements.

[0051] It should be noted that the electronic device described in this embodiment may be a PC, a tablet computer, a PDA or a mobile phone, etc., and no limitation is made here.

[0052] Step 202: Generate a transaction processing request according to the target message.

[0053] In the embodiment of the present disclosure, after determining the target message, a transaction processing request may be generated according to the target message based on a preset generation strategy, wherein the preset generation strategy may be calibrated according to actual conditions and requirements.

[0054] Specifically, after determining the target message, the electronic device may generate a corresponding transaction processing request according to the target message based on a preset generation strategy, and send (distribute) the transaction processing request to multiple servers.

[0055] Step 102: Determine the target transaction step from the transaction step set based on the remote dictionary service and the message information.

[0056] In order to clearly explain the above embodiment, in one embodiment of the present disclosure, as Figure 3 As shown, determining the target transaction step from the transaction step set based on the remote dictionary service according to the message information may include:

[0057] Step 301, obtaining the status value of the transaction to be processed from the remote dictionary service according to the identification code.

[0058] The status value may include 1 and 0, 1 may indicate that the pending transaction has not been processed, and 0 may indicate that the pending transaction is being processed.

[0059] In the disclosed embodiment, when a server processes a transaction, it obtains a distributed lock for the transaction through a remote dictionary service (Redis). Since only one server can obtain the distributed lock for the transaction at any time, it can avoid the situation where multiple servers process the same transaction at the same time.

[0060] Specifically, after obtaining the above-mentioned pending transaction, the server can first parse the pending transaction to obtain the transaction step set and message information of the pending transaction, and then obtain the distributed lock of the pending transaction through the remote dictionary service according to the identification code in the message information (that is, the identification code of the pending transaction). If the acquisition is successful, the status value 1 can be returned, indicating that the pending transaction has not been processed; if the acquisition fails, the status value 0 can be returned, indicating that the pending transaction is being processed.

[0061] Step 302: If the status value satisfies the processing condition, query is performed from the remote dictionary service using the identification code as an index to determine whether the remote dictionary service includes the transaction step execution history information of the transaction to be processed.

[0062] In the embodiment of the present disclosure, when the status value is 1, it indicates that the pending transaction has not been processed and the status value meets the processing condition; when the status value is 0, it indicates that the pending transaction is being processed and the status value does not meet the processing condition.

[0063] Specifically, after obtaining the status value of the above-mentioned pending transaction, the server can determine whether the status value meets the processing conditions. If so, it can use the identification code of the pending transaction as an index to query from the remote dictionary service to determine whether the remote dictionary service includes the transaction step execution history information of the pending transaction.

[0064] Step 303: If the remote dictionary service does not include the transaction step execution history information, the first transaction step in the transaction step set is used as the target transaction step.

[0065] In the embodiment of the present disclosure, during the process of the server processing a transaction, after each transaction step in the transaction step set is successfully executed, the execution information of the transaction step will be generated (if the transaction step fails to execute, it will not be recorded), wherein the execution information may include the number and processing result corresponding to the transaction step, and the execution information of the transaction step is stored in the remote dictionary service, so that the execution history information can be generated after the transaction processing is completed. It should be noted that the number and processing result in the execution information described in this embodiment can also be called record number and record processing result.

[0066] Specifically, when querying from the remote dictionary service using the identification code of the above-mentioned pending transaction as the index, it can be determined whether the remote dictionary service includes transaction step execution history information. If not, it means that the pending transaction has never been processed, and the first transaction step in the transaction step set can be used as the target transaction step.

[0067] Further, in one embodiment of the present disclosure, Figure 4 As shown, based on the remote dictionary service and according to the message information, determining the target transaction step from the transaction step set may also include:

[0068] Step 401: If the remote dictionary service includes transaction step execution history information, then obtain the record number and record processing result corresponding to the most recently processed transaction step from the transaction step execution history information.

[0069] Specifically, when querying from the remote dictionary service using the identification code of the above-mentioned pending transaction as an index, it can be determined whether the remote dictionary service includes transaction step execution history information. If so, it means that the pending transaction has been processed, and the record number and record processing result corresponding to the most recently processed transaction step (i.e., the last successfully processed transaction step) can be obtained from the transaction step execution history information.

[0070] Step 402: Take the transaction step corresponding to the next number after the record number in the transaction step set as the target transaction step.

[0071] Specifically, after obtaining the above record number, the transaction step corresponding to the number in the next transaction step set after the number may be used as the target transaction step.

[0072] Step 103, execute the target transaction step.

[0073] Specifically, after obtaining the above target transaction steps, the target transaction steps can be executed to perform corresponding transaction processing.

[0074] In order to clearly explain the above embodiment, in one embodiment of the present disclosure, as Figure 5 As shown, executing the target transaction step may include:

[0075] Step 501: If the remote dictionary service includes transaction step processing history information, the target transaction step is executed according to the record processing result.

[0076] In the embodiment of the present disclosure, after obtaining the record processing result corresponding to the most recently processed transaction step, the target transaction step can be executed according to the record processing result based on the preset execution strategy. The preset execution strategy can be calibrated according to the actual situation and needs.

[0077] Specifically, when determining the target transaction step from the transaction step set based on the remote dictionary service according to the message information, if the remote dictionary service includes the transaction step processing history information, it means that the above-mentioned transaction to be processed has been processed. After obtaining the above-mentioned target transaction step, the server can execute the transaction step (target step) corresponding to the next number after the record number in the transaction step set according to the above-mentioned record processing result based on the preset execution strategy.

[0078] Step 502: If the remote dictionary service does not include transaction step processing history information, the target transaction step is directly executed.

[0079] Specifically, when determining the target transaction step from the transaction step set based on the remote dictionary service according to the message information, if the remote dictionary service does not include the transaction step processing history information, it means that the above-mentioned pending transaction has not been processed. After obtaining the above-mentioned target transaction step, the server can directly execute the first transaction step (target step) in the transaction step set.

[0080] Step 104: If the target transaction step is executed successfully, a target execution result of the target transaction step is generated, and the target execution result and the number corresponding to the target transaction step are stored in the remote dictionary service.

[0081] Furthermore, in one embodiment of the present disclosure, the transaction processing method may further include re-putting the target message into the message queue if the target transaction step is not successfully executed.

[0082] Specifically, when the server executes the target transaction step, if the execution fails, the target information is put into the message queue again, and the distributed lock of the pending transaction can be released, waiting for the next processing. If the execution is successful, the target execution result of the target transaction step can be generated, and the target execution result and the number corresponding to the target transaction step can be stored in the remote dictionary service, that is, the target execution result and the number corresponding to the target transaction step are placed in the transaction step processing history information corresponding to the pending transaction.

[0083] Furthermore, in one embodiment of the present disclosure, the target transaction step may be at least one, and the transaction processing method may further include deleting the transaction step processing history information of the transaction to be processed from the remote dictionary service according to the identification code if at least one target transaction step is executed successfully.

[0084] In the embodiment of the present disclosure, if the target transaction step is executed successfully, the transaction step corresponding to the next number of the number corresponding to the target transaction step can be used as a new target transaction step and continued to be executed until all transaction steps in the transaction step set are executed.

[0085] Specifically, if all transaction steps in the transaction step set of the pending transaction are executed successfully, it can be said that the processing of the pending transaction is completed (successful), that is, the processing of the target message is completed. At this time, the transaction step processing history information of the pending transaction can be deleted from the remote dictionary service according to the identification code of the pending transaction, and the above-mentioned target message can be deleted from the message queue.

[0086] In order to clearly illustrate the transaction processing method provided by the embodiment of the present disclosure, the following examples can be cited:

[0087] Assume that the transaction step set of the pending transaction includes 100 transaction steps, and the distributed system includes two servers, server A and server B. The process of processing the pending transaction is as follows:

[0088] ① After server A obtains the transaction processing request, it obtains the distributed lock of the pending transaction in the transaction processing request. If the acquisition is successful, the pending transaction is processed; if the acquisition fails, it means that other servers are processing the pending transaction, and no processing is performed.

[0089] ②. Assuming the acquisition is successful, server A obtains the number of the most recently processed transaction step (target transaction step) (e.g. 9, transaction step 9) and the processing result of the transaction step from the transaction step set of the above-mentioned pending transaction. At this time, it means that the pending transaction has been processed before, and when executing transaction step 10, the execution fails, and then the message corresponding to the pending transaction (target message) is put back into the message queue.

[0090] ③. Since transaction step 10 fails to execute, server A executes step 10 and starts processing from step 10. Server A obtains the processing result of transaction step 9 in the previous process. Since the execution of transaction step 10 depends on the processing result of the previous transaction step (transaction step 9), server A can successfully execute transaction step 10 according to the processing result of transaction step 9, that is, complete the task processing of step 10.

[0091] ④. After successfully executing transaction step 10, server A stores the number 10 and the processing result of transaction step 10 in the remote dictionary service (Redis), and then starts execution from transaction step 11 (step 11).

[0092] ⑤. Assuming that server A completes step 99 (transaction step 99) and fails to execute transaction step 100, the message corresponding to the above-mentioned pending transaction (target message) will be put back into the message queue and the distributed lock of the pending transaction can be released.

[0093] ⑥. When the transaction processing request of the target message that is put back into the message queue is obtained by server B, since transaction step 100 fails to execute, server B starts execution from step 100 (transaction step 100). Assuming that the execution is successful, the message (target message) corresponding to the pending transaction has gone through all the processes, that is, the pending transaction processing is completed (successfully). At this time, the target message is deleted from the message queue.

[0094] ⑦. The above pending transactions are processed by server A and server B, that is, the target message is processed and ends.

[0095] According to the transaction processing method provided by the embodiment of the present disclosure, a transaction processing request is first obtained, wherein the transaction processing request includes a transaction step set and message information of the transaction to be processed, and then based on the remote dictionary service and the message information, a target transaction step is determined from the transaction step set, and the target transaction step is executed. If the target transaction step is executed successfully, a target execution result of the target transaction step is generated, and the target execution result and the number corresponding to the target transaction step are stored in the remote dictionary service. In this way, effective processing of transactions can be achieved, thereby ensuring the success rate of message processing and improving the accuracy of data.

[0096] Figure 6 A schematic diagram of the structure of a transaction processing device provided in an embodiment of the present disclosure.

[0097] The transaction processing device of the embodiment of the present disclosure can be configured in an electronic device to obtain a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of the transaction to be processed, and based on the remote dictionary service, determines the target transaction step from the transaction step set according to the message information, and then executes the target transaction step. If the target transaction step is executed successfully, a target execution result of the target transaction step is generated, and the target execution result and the corresponding number of the target transaction step are stored in the remote dictionary service, thereby enabling effective processing of transactions, thereby ensuring the success rate of message processing and improving data accuracy.

[0098] like Figure 6 As shown, the transaction processing device 600 may include: an acquisition module 610, a determination module 620, an execution module 630 and a storage module 640.

[0099] The acquisition module 610 is used to acquire a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of the transaction to be processed.

[0100] The determination module 620 is used to determine the target transaction step from the transaction step set based on the remote dictionary service according to the message information.

[0101] The execution module 630 is used to execute the target transaction step.

[0102] The storage module 640 is used to generate a target execution result of the target transaction step if the target transaction step is executed successfully, and store the target execution result and the serial number corresponding to the target transaction step into the remote dictionary service.

[0103] In one embodiment of the present disclosure, a transaction processing request is generated in the following manner: obtaining a message queue and determining a target message from the message queue; and generating a transaction processing request according to the target message.

[0104] In one embodiment of the present disclosure, the message information includes an identification code of the transaction to be processed, and the determination module 620 is specifically used to: obtain a status value of the transaction to be processed from a remote dictionary service according to the identification code; if the status value meets the processing condition, query the remote dictionary service with the identification code as an index to determine whether the remote dictionary service includes the transaction step execution history information of the transaction to be processed; if the remote dictionary service does not include the transaction step execution history information, then take the first transaction step in the transaction step set as the target transaction step.

[0105] In one embodiment of the present disclosure, the determination module 620 is further used to: if the remote dictionary service includes transaction step execution history information, obtain the record number and record processing result corresponding to the most recently processed transaction step from the transaction step execution history information; and take the transaction step corresponding to the next number after the record number in the transaction step set as the target transaction step.

[0106] In one embodiment of the present disclosure, the execution module 630 is specifically used to: if the remote dictionary service includes transaction step processing history information, execute the target transaction step according to the record processing result; if the remote dictionary service does not include transaction step processing history information, directly execute the target transaction step.

[0107] In one embodiment of the present disclosure, the transaction processing device further includes: a placing module, which is used to re-place the target message into the message queue if the target transaction step is not successfully executed.

[0108] In one embodiment of the present disclosure, there are multiple target transaction steps, and the transaction processing device also includes: a deletion module, which is used to delete the transaction step processing history information of the transaction to be processed from the remote dictionary service according to the identification code if the multiple target transaction steps are successfully executed.

[0109] It should be noted that the above Figures 1 to 5 The explanation of the transaction processing method embodiment is also applicable to the transaction processing device of this embodiment and will not be repeated here.

[0110] The transaction processing device provided by the embodiment of the present disclosure obtains a transaction processing request through an acquisition module, wherein the transaction processing request includes a transaction step set and message information of the transaction to be processed, and determines the target transaction step from the transaction step set based on the remote dictionary service according to the message information through a determination module, and executes the target transaction step through an execution module, and if the target transaction step is successfully executed, generates a target execution result of the target transaction step, and stores the target execution result and the number corresponding to the target transaction step into the remote dictionary service through a storage module. In this way, effective processing of transactions can be achieved, thereby ensuring the success rate of message processing and improving the accuracy of data.

[0111] According to a third aspect of an embodiment of the present disclosure, there is also provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor, wherein the processor is configured to execute the instructions to implement the transaction processing method as described above.

[0112] In order to implement the above embodiments, the present disclosure also proposes a storage medium.

[0113] When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to execute the transaction processing method as described above.

[0114] In order to implement the above embodiments, the present disclosure also provides a computer program product.

[0115] When the computer program product is executed by a processor of an electronic device, the electronic device is enabled to execute the method as described above.

[0116] Figure 7 A block diagram of an electronic device is shown according to an exemplary embodiment. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0117] like Figure 7 As shown, the electronic device 700 includes a processor 111, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 112 or the program loaded from the memory 116 to the random access memory (RAM) 113. In the RAM 113, various programs and data required for the operation of the electronic device 1000 are also stored. The processor 111, the ROM 112, and the RAM 113 are connected to each other through the bus 114. The input / output (I / O) interface 115 is also connected to the bus 114.

[0118] The following components are connected to the I / O interface 115: a memory 116 including a hard disk, etc.; and a communication part 117 including a network interface card such as a LAN (Local Area Network) card, a modem, etc., and the communication part 117 performs communication processing via a network such as the Internet; a drive 118 is also connected to the I / O interface 115 as needed.

[0119] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 117. When the computer program is executed by the processor 111, the above-mentioned functions defined in the method of the present disclosure are executed.

[0120] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory including instructions, and the instructions can be executed by the processor 111 of the electronic device 1000 to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0121] In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0122] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0123] In the embodiment of the present disclosure, by obtaining a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of the transaction to be processed, and based on the remote dictionary service and the message information, determining the target transaction step from the transaction step set, and executing the target transaction step, if the target transaction step is successfully executed, generating a target execution result of the target transaction step, and storing the target execution result and the number corresponding to the target transaction step in the remote dictionary service. In this way, effective processing of transactions can be achieved, thereby ensuring the success rate of message processing and improving the accuracy of data.

[0124] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0125] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A transaction processing method, characterized in that: include: Obtaining a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of a transaction to be processed; determining a target transaction step from the transaction step set based on the message information based on a remote dictionary service; Execute the target transaction step; If the target transaction step is executed successfully, a target execution result of the target transaction step is generated, and the target execution result and the serial number corresponding to the target transaction step are stored in the remote dictionary service; The message information includes an identification code of the transaction to be processed, and the remote dictionary service determines the target transaction step from the transaction step set according to the message information, including: Obtaining a status value of the pending transaction from the remote dictionary service according to the identification code; If the state value satisfies the processing condition, querying the remote dictionary service with the identification code as an index to determine whether the remote dictionary service includes the transaction step execution history information of the transaction to be processed; If the remote dictionary service does not include the transaction step execution history information, taking the first transaction step in the transaction step set as the target transaction step; If the remote dictionary service includes the transaction step execution history information, the record number and record processing result corresponding to the most recently processed transaction step are obtained from the transaction step execution history information; and the transaction step corresponding to the next number after the record number in the transaction step set is taken as the target transaction step.

2. The transaction processing method according to claim 1, characterized in that: in, The transaction request is generated in the following manner: Obtain a message queue, and determine a target message from the message queue; The transaction request is generated according to the target message.

3. The transaction processing method according to claim 1, characterized in that: The step of executing the target transaction includes: If the remote dictionary service includes the transaction step processing history information, executing the target transaction step according to the record processing result; If the remote dictionary service does not include the transaction step processing history information, the target transaction step is directly executed.

4. The transaction processing method according to claim 2, characterized in that: Also includes: If the target transaction step is not successfully executed, the target message is put into the message queue again.

5. The transaction processing method according to claim 1, characterized in that: in, The target transaction step is at least one, and the method further includes: If at least one of the target transaction steps is executed successfully, the transaction step processing history information of the pending transaction is deleted from the remote dictionary service according to the identification code.

6. A transaction processing device, characterized in that: include: An acquisition module, used for acquiring a transaction processing request, wherein the transaction processing request includes a transaction step set and message information of a transaction to be processed; a determination module, configured to determine a target transaction step from the transaction step set based on the message information based on a remote dictionary service; An execution module, used for executing the target transaction step; a storage module, configured to generate a target execution result of the target transaction step if the target transaction step is executed successfully, and store the target execution result and the serial number corresponding to the target transaction step in the remote dictionary service; The message information includes the identification code of the transaction to be processed, and the determination module is specifically used to: Obtaining a status value of the pending transaction from the remote dictionary service according to the identification code; If the state value satisfies the processing condition, querying the remote dictionary service with the identification code as an index to determine whether the remote dictionary service includes the transaction step execution history information of the transaction to be processed; If the remote dictionary service does not include the transaction step execution history information, the first transaction step in the transaction step set is used as the target transaction step; if the remote dictionary service includes the transaction step execution history information, the record number and record processing result corresponding to the most recently processed transaction step are obtained from the transaction step execution history information; and the transaction step corresponding to the next number after the record number in the transaction step set is used as the target transaction step.

7. The transaction processing device according to claim 6, characterized in that: in, The transaction request is generated in the following manner: Obtain a message queue, and determine a target message from the message queue; The transaction request is generated according to the target message.

8. The transaction processing device according to claim 6, characterized in that: The execution module is specifically used for: If the remote dictionary service includes the transaction step processing history information, executing the target transaction step according to the record processing result; If the remote dictionary service does not include the transaction step processing history information, the target transaction step is directly executed.

9. The transaction processing device according to claim 7, characterized in that: Also includes: The placing module is used to re-place the target message into the message queue if the target transaction step is not successfully executed.

10. The transaction processing device according to claim 6, characterized in that: in, The target transaction step is at least one, and the device further includes: A deletion module is used to delete the transaction step processing history information of the pending transaction from the remote dictionary service according to the identification code if at least one of the target transaction steps is executed successfully.

11. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the transaction processing method according to any one of claims 1 to 5 is implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the transaction processing method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Transaction processing method and apparatus based on network management system

    CN101478767A

  • Method and system for processing asynchronous task

    CN103345423A