Business processing method, device, equipment, readable storage medium and product
By unitizing the distributed transaction platform, separating the main transaction unit and sub-transaction unit, and interacting information through the main transaction context, the problems of low business processing efficiency and low disaster recovery in the existing technology are solved, and efficient and disaster recovery business processing is achieved.
Patent Information
- Application Number
- CN202210486675.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-06
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2042-05-06
AI Technical Summary
The existing distributed transaction platform is inefficient in business processing and is not disastrous, especially when an exception occurs in the main transaction or sub-transaction transaction, the entire business cannot continue to be processed.
By unitizing the distributed transaction platform, separating the main transaction unit and the sub-transaction unit, each sub-transaction unit has independent transaction platform services. According to the service processing request, the main transaction unit stores the identification information and status information of the main transaction into the transaction processor, generates the main transaction context, and sends it to the sub-transaction unit to realize information interaction and task rollback.
It improves the efficiency of the distributed transaction platform when processing services, ensuring that when any sub-transaction unit fails, other sub-transaction units can still operate normally, significantly improving disaster tolerance.
Smart Images

Figure CN114816684B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of distributed systems, and in particular to a business processing method, device, equipment, readable storage medium and product. Background Art
[0002] When a distributed transaction platform performs business processing, it is often necessary for the main transaction to call multiple sub-applications. In existing distributed transaction platforms, the main transaction and sub-transaction generally use the same transaction receiver and transaction server. When performing business processing, both the main transaction and the sub-transaction will initiate registration and persistence of the corresponding transaction data with the distributed transaction platform.
[0003] However, when using the distributed transaction platform of the above architecture for business processing, when an exception occurs in the main transaction or sub-transaction being processed, the distributed transaction platform needs to notify all sub-transactions to execute reverse transactions to ensure transaction consistency. Since both the main transaction and the sub-transaction rely on the same transaction receiver and transaction server, the distributed transaction platform has low efficiency in processing business. When any transaction fails, the entire business cannot continue to be processed, and the disaster tolerance is low. Summary of the invention
[0004] The present disclosure provides a business processing method, apparatus, device, readable storage medium and product, which are used to solve the technical problems of low efficiency and low disaster tolerance of existing distributed transaction platform business processing.
[0005] A first aspect of the present disclosure is to provide a business processing method, which is applied to a main transaction unit in a distributed transaction platform, wherein the distributed transaction platform includes a main transaction unit and at least one sub-transaction unit; the method includes:
[0006] Acquire a business processing request, wherein the business processing request includes identification information of at least one sub-transaction called by the main transaction and a calling sequence;
[0007] According to the business processing request, the identification information and the status information of the main transaction are stored in a transaction processor preset in the main transaction unit;
[0008] Generate a main transaction context according to the identification information and the state information;
[0009] The main transaction context is sent to each sub-transaction unit in sequence according to the calling order, so that the sub-transaction unit performs sub-transaction processing according to the main transaction context, and exchanges information with the main transaction unit according to the main transaction context.
[0010] A second aspect of the present disclosure is to provide a business processing method, which is applied to any sub-transaction unit in a distributed transaction platform, wherein the distributed transaction platform includes a main transaction unit and at least one sub-transaction unit; the method includes:
[0011] Acquire a main transaction context sent by a main transaction unit, wherein the main transaction context includes identification information and status information of the main transaction;
[0012] Sub-transaction processing is performed according to the context, and information interaction is performed with the main transaction unit according to the main transaction context.
[0013] A third aspect of the present disclosure is to provide a main transaction processing device, which is applied to a distributed transaction platform. The distributed transaction platform includes a main transaction unit and at least one sub-transaction unit. The device includes:
[0014] An acquisition module, used to acquire a business processing request, wherein the business processing request includes identification information of at least one sub-transaction called by the main transaction and a calling sequence;
[0015] A storage module, configured to store the identification information and status information of the main transaction in a transaction processor preset in the main transaction unit according to the business processing request;
[0016] A generating module, used for generating a main transaction context according to the identification information and the state information;
[0017] A sending module is used to send the main transaction context to each sub-transaction unit in sequence according to the calling order, so that the sub-transaction unit performs sub-transaction processing according to the main transaction context, and exchanges information with the main transaction unit according to the main transaction context.
[0018] A fourth aspect of the present disclosure is to provide a sub-transaction processing device, which is applied to any sub-transaction unit in a distributed transaction platform, wherein the distributed transaction platform includes a main transaction unit and at least one sub-transaction unit; the device includes:
[0019] A context acquisition module, used to acquire a main transaction context sent by a main transaction unit, wherein the main transaction context includes identification information and status information of the main transaction;
[0020] A processing module is used to perform sub-transaction processing according to the context, and to perform information interaction with the main transaction unit according to the main transaction context.
[0021] A fifth aspect of the present disclosure is to provide an electronic device, comprising: a memory, a processor;
[0022] Memory; Memory for storing instructions executable by the processor;
[0023] The processor is used to call the program instructions in the memory to execute the business processing method as described in the first aspect or the second aspect.
[0024] The sixth aspect of the present disclosure is to provide a computer-readable storage medium, in which computer execution instructions are stored. When the computer execution instructions are executed by a processor, they are used to implement the business processing method as described in the first aspect or the second aspect.
[0025] The seventh aspect of the present disclosure is to provide a computer program product, including a computer program, which implements the business processing method as described in the first aspect or the second aspect when executed by a processor.
[0026] The business processing method, device, equipment, readable storage medium and product provided by the present disclosure obtain a distributed transaction platform including a main transaction unit and at least one sub-transaction unit by unitizing the distributed transaction platform. According to the business processing request, the relevant information of the main transaction is stored in the transaction processor of the main transaction unit, and information is exchanged with each sub-transaction unit through the main transaction context, so that each sub-unit can exchange information with the main transaction unit according to the main transaction context. Then, when any sub-transaction unit fails, the main transaction unit can accurately perform a task rollback operation on the sub-transaction unit. In addition, by unitizing the distributed transaction platform, when any sub-transaction unit fails, other sub-transaction units can still operate normally, and the disaster tolerance is strong. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure, and a person skilled in the art can also obtain other drawings based on these drawings.
[0028] Figure 1 This is a schematic diagram of the system architecture of the existing distributed transaction platform;
[0029] Figure 2 A schematic diagram of the structure of a distributed transaction platform provided in an embodiment of the present disclosure;
[0030] Figure 3 A flowchart of a business processing method provided in Embodiment 1 of the present disclosure;
[0031] Figure 4 A flowchart of a business processing method provided in Embodiment 2 of the present disclosure;
[0032] Figure 5 A flowchart of a service processing method provided in Embodiment 3 of the present disclosure;
[0033] Figure 6 A schematic diagram of the structure of a main transaction processing device provided in Embodiment 4 of the present disclosure;
[0034] Figure 7 A schematic diagram of the structure of a sub-transaction processing device provided in Embodiment 5 of the present disclosure;
[0035] Figure 8 This is a schematic diagram of the structure of an electronic device provided in Embodiment 6 of the present disclosure. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. All other embodiments obtained based on the embodiments in the present disclosure belong to the scope of protection of the present disclosure.
[0037] In response to the above-mentioned technical problems that the business processing efficiency of the existing distributed transaction platform is low and the disaster tolerance is not high, the present disclosure provides a business processing method, device, equipment, readable storage medium and product.
[0038] The present disclosure provides business processing methods, devices, equipment, readable storage media and products that can be used in various distributed transaction platform transaction processing scenarios.
[0039] It should be noted that the business processing method, device, equipment, readable storage medium and product provided by the present disclosure can be used in the distributed field. It can also be used in any field other than the distributed field. The business processing method, device, equipment, readable storage medium and product provided by the present disclosure are not limited to the application field.
[0040] Figure 1 The system architecture diagram of the existing distributed transaction platform is as follows: Figure 1As shown, the existing distributed transaction platform includes a main transaction 11 and subtransactions 12 and 13, wherein the main transaction 11 calls up subtransactions 12 and 13 in sequence. The main transaction 11 and subtransactions 12 and 13 are respectively connected to the transaction receiver 14 in communication, so that they can exchange information with the transaction receiver 14. The transaction receiver 14 is connected to the transaction processor 15 in communication to realize the data storage function. Before executing the actual business transaction, the subtransaction will also register the subtransaction information with the transaction platform and associate it with the corresponding main transaction 11 information. When an exception occurs in the transaction, the transaction processor 15 will notify all subtransactions to execute the reverse transaction to ensure the consistency of the entire transaction. Since the main transaction 11 and the subtransactions rely on the same set of the same transaction receiver 14 and the transaction processor 15, the efficiency of the distributed transaction platform in processing business is low. When any transaction fails, the entire business cannot continue to be processed, and the disaster tolerance is low.
[0041] In the process of solving the above technical problems, the inventors found through research that the distributed transaction platform can be transformed into a unit. After the transformation, there is only one main transaction unit, and the existing services continue to provide support in the main transaction unit. There are multiple sub-transaction units, and each sub-transaction unit has a complete set of transaction platform services to ensure that transaction transactions can be closed in one unit. Therefore, even if any transaction unit fails, other transaction units can still operate normally.
[0042] Figure 2 A schematic diagram of the structure of a distributed transaction platform provided in an embodiment of the present disclosure, such as Figure 2 As shown, the distributed transaction platform includes a main transaction unit 21 and a sub-transaction unit 22, each of which includes a transaction receiver 23 and a transaction processor 24. Each sub-transaction unit has a complete set of transaction platform services to ensure that the transaction can be closed in one unit.
[0043] Figure 3 A flow chart of a business processing method provided in Embodiment 1 of the present disclosure is applied to a main transaction unit in a distributed transaction platform, wherein the distributed transaction platform includes a main transaction unit and at least one sub-transaction unit; Figure 3 As shown, the method includes:
[0044] Step 301: Obtain a business processing request, wherein the business processing request includes identification information and a calling sequence of at least one sub-transaction called by a main transaction.
[0045] The execution subject of this embodiment is a main transaction processing device, which can be coupled to the main transaction unit. The main transaction unit and each sub-transaction unit include a separate transaction receiver and a transaction processor. The transaction receiver is used to exchange information with other transaction units, and the transaction processor is used to store data.
[0046] In this embodiment, the main transaction unit can obtain a business processing request, wherein the business processing request includes identification information and a calling sequence of at least one sub-transaction called by the main transaction. Thus, the main transaction unit can sequentially call up the sub-transactions for transaction processing according to the identification information and the calling sequence in the business processing request.
[0047] Optionally, the main transaction unit can call up each sub-transaction unit, and after each sub-transaction unit completes transaction processing, the main transaction process is terminated to ensure the completion of the processed business.
[0048] Step 302: According to the business processing request, the identification information and status information of the main transaction are stored in a transaction processor preset in the main transaction unit.
[0049] In this embodiment, after obtaining the business processing request, the identification information and status information of the main transaction can be stored in the transaction processor preset in the main transaction unit according to the business processing request. The transaction processor can store a main transaction table and a sub-transaction table, and the main transaction table is used to store unit information such as identification information and status information of the main transaction unit. The sub-transaction table is used to store unit information such as identification information of each sub-transaction unit.
[0050] Therefore, after obtaining the service processing request, the main transaction unit may initiate a request to the transaction receiver, and record unit information such as identification information and status information into the main transaction table.
[0051] Step 303: Generate a main transaction context according to the identification information and state information.
[0052] In this embodiment, in order to realize information interaction with sub-transactions, it is also necessary to enable the sub-transaction unit to determine the information of the main transaction unit that needs to perform data interaction. Therefore, the main transaction context can be generated according to the identification information and the state information.
[0053] The main transaction unit and the sub-transaction unit can exchange information through the transaction context. Optionally, the main transaction unit can send the main transaction context to the sub-transaction unit. The sub-transaction unit can send the sub-transaction context to the main transaction unit.
[0054] Step 304: Send the main transaction context to each sub-transaction unit in sequence according to the calling order, so that the sub-transaction unit performs sub-transaction processing according to the main transaction context, and exchanges information with the main transaction unit according to the main transaction context.
[0055] In this embodiment, since the number of sub-units that the main transaction unit needs to call is at least one, and different sub-transactions may have different calling orders. Therefore, the main transaction unit can send the main transaction context to each sub-transaction unit in sequence according to the calling order. Accordingly, after obtaining the main transaction context, the sub-transaction unit can perform sub-transaction processing according to the main transaction context, and exchange information with the main transaction unit according to the main transaction context.
[0056] The business processing method provided in this embodiment obtains a distributed transaction platform including a main transaction unit and at least one sub-transaction unit by unitizing the distributed transaction platform. The relevant information of the main transaction is stored in the transaction processor of the main transaction unit according to the business processing request, and information is exchanged with each sub-transaction unit through the main transaction context, so that each sub-unit can exchange information with the main transaction unit according to the main transaction context. Then, when any sub-transaction unit fails, the main transaction unit can accurately perform a task rollback operation on the sub-transaction unit. In addition, by unitizing the distributed transaction platform, when any sub-transaction unit fails, other sub-transaction units can still operate normally, and the disaster tolerance is strong.
[0057] Further, based on the first embodiment, after step 304, the following steps are further included:
[0058] If it is detected that the last sub-transaction unit in the calling sequence completes the sub-transaction processing operation, the main transaction process is terminated.
[0059] In this embodiment, the main transaction unit can call up each sub-transaction unit, and after each sub-transaction unit completes the transaction processing, the main transaction process is terminated to ensure the completion of the processed business. Specifically, it can be detected according to the calling sequence whether the last sub-transaction unit in the calling sequence completes the sub-transaction processing operation. If it is completed, the main transaction process can be terminated.
[0060] By ending the main transaction process after each sub-transaction unit has completed transaction processing, the integrity of the currently processed business can be guaranteed.
[0061] Figure 4 A flowchart of a business processing method provided in Embodiment 2 of the present disclosure is provided. Based on any of the above embodiments, Figure 4 As shown, it also includes:
[0062] Step 401: Obtain a subtransaction context sent by each subtransaction unit, wherein the subtransaction context includes identification information of the subtransaction unit.
[0063] Step 402: Store the sub-transaction context sent by each sub-transaction unit into a transaction processor preset in the main transaction unit.
[0064] In this embodiment, in a distributed transaction platform, a transaction may involve multiple transaction units. During the unit transformation process, not all transaction units have completed the unit transformation. Only some transaction units may have completed the transformation. It is necessary to ensure the smooth upgrade of the application side. At the same time, during the transformation process, the main and sub-transactions may be in different units. How to synchronize the information and status of the main and sub-transactions is also a problem that needs to be solved. For example, suppose that the main transaction and sub-transaction 1 have completed the unit transformation, but sub-transaction 2 has not been completed. At this time, when the transaction is rolled back, how to find the sub-transaction of the corresponding unit to initiate a reverse transaction is a problem that needs to be solved.
[0065] Therefore, in order to ensure the smooth upgrade of the unitized transformation of the distributed transaction platform, the unit information of the main transaction and the unit information of the sub-transaction can be persistently stored in the transaction processor in the main transaction unit. Among them, the transaction processor can store a main transaction table and a sub-transaction table. The main transaction table is used to store unit information such as identification information and status information of the main transaction unit. The sub-transaction table is used to store unit information such as identification information of each sub-transaction unit.
[0066] After obtaining the main transaction context sent by the main transaction unit, the sub-transaction unit can generate a sub-transaction context based on its own unit information, such as the identification information of the sub-transaction unit. The sub-transaction context is fed back to the main transaction unit according to the main transaction identification in the main transaction context. Accordingly, the main transaction unit can obtain the sub-transaction context sent by each sub-transaction unit, and the sub-transaction context includes the identification information of the sub-transaction unit. The sub-transaction context sent by each sub-transaction unit is stored in the transaction processor preset in the main transaction unit. Optionally, the sub-transaction context can be stored in the sub-transaction table of the transaction processor preset in the main transaction unit.
[0067] The business processing method provided in this embodiment transmits the unit information of the main transaction unit and the sub-transaction unit through the message context, and stores it in a transaction processor preset in the main transaction unit. When a transaction rollback is required, it can be processed accurately according to the content stored in the transaction processor, thereby improving the disaster tolerance of the distributed transaction platform.
[0068] Further, based on any of the above embodiments, after step 402, the method further includes:
[0069] If it is detected that the transaction processing of any sub-transaction unit fails, a transaction rollback operation is performed on the transaction processed by the sub-transaction unit according to the context of the sub-transaction unit stored in the transaction processor in the main transaction unit.
[0070] In this embodiment, it is possible to detect in real time whether the transaction processing of the sub-transaction unit is successful. When the processing fails, a rollback operation is required. By transmitting the unit information of the main transaction unit and the sub-transaction unit in the form of a message context and storing it in a transaction processor preset in the main transaction unit, when it is detected that the transaction processing of any sub-transaction unit fails, a transaction rollback operation is performed on the transaction processed by the sub-transaction unit according to the context of the sub-transaction unit stored in the transaction processor in the main transaction unit.
[0071] The business processing method provided in this embodiment stores the unit information of the main transaction unit and the sub-transaction unit persistently in the transaction processor of the main transaction unit. When a problem occurs in the transaction processing of any sub-transaction unit, the sub-transaction unit can be accurately located and a rollback operation can be implemented, thereby improving the efficiency of transaction processing and the disaster tolerance of the distributed transaction platform.
[0072] Figure 5 A flowchart of a business processing method provided in Embodiment 3 of the present disclosure is applied to any sub-transaction unit in a distributed transaction platform, wherein the distributed transaction platform includes a main transaction unit and at least one sub-transaction unit; the method includes:
[0073] Step 501: Obtain a main transaction context sent by a main transaction unit, wherein the main transaction context includes identification information and status information of the main transaction;
[0074] Step 502: Perform sub-transaction processing according to the context, and perform information exchange with the main transaction unit according to the main transaction context.
[0075] The execution subject of this embodiment is a sub-transaction processing device, and the sub-transaction processing device can be coupled to the sub-transaction unit.
[0076] In this embodiment, the main transaction unit can generate a main transaction context according to the identification information and the state information, and send the main transaction context to each sub-transaction unit in sequence according to the calling order. Accordingly, after obtaining the main transaction context, the sub-transaction unit can perform sub-transaction processing according to the main transaction context, and exchange information with the main transaction unit according to the main transaction context.
[0077] The business processing method provided in this embodiment obtains a distributed transaction platform including a main transaction unit and at least one sub-transaction unit by unitizing the distributed transaction platform. The main transaction related information is stored in the transaction processor of the main transaction unit according to the business processing request, and information is exchanged with each sub-transaction unit through the main transaction context, so that each sub-unit can exchange information with the main transaction unit according to the main transaction context. When any sub-transaction unit fails, other sub-transaction units can still operate normally, and the disaster tolerance is strong.
[0078] Further, based on the third embodiment, step 501 includes:
[0079] A subtransaction context is generated according to the main transaction context based on the identification information and unit information of the subtransaction.
[0080] The sub-transaction context is sent to the transaction processor in the main transaction unit for storage.
[0081] In this embodiment, after obtaining the main transaction context, the sub-transaction unit can generate a sub-transaction context based on its own unit information, such as identification information of the sub-transaction unit, after obtaining the main transaction context sent by the main transaction unit. The sub-transaction context is fed back to the main transaction unit according to the main transaction identifier in the main transaction context. Accordingly, the main transaction unit can obtain the sub-transaction context sent by each sub-transaction unit, and the sub-transaction context includes the identification information of the sub-transaction unit. The sub-transaction context sent by each sub-transaction unit is stored in a transaction processor preset in the main transaction unit.
[0082] The business processing method provided in this embodiment stores the unit information of the sub-transaction unit persistently in the transaction processor in the main transaction unit. When a problem occurs in the transaction processing of any sub-transaction unit, the sub-transaction unit can be accurately located and a rollback operation can be implemented, thereby improving the efficiency of transaction processing and the disaster tolerance of the distributed transaction platform.
[0083] Further, based on the third embodiment, before sending the sub-transaction context to the transaction processor in the main transaction unit for storage, the method further includes:
[0084] Whether the current running state of the main transaction unit is normal is determined through the main transaction context.
[0085] When the main transaction unit is in a normal operating state, the sub-transaction context is sent to a transaction processor in the main transaction unit for storage.
[0086] In this embodiment, in order to register the unit information of the sub-transaction unit, it is necessary to ensure that the main transaction is currently in a normal operating state. For example, if the current main transaction unit is in a rollback state, the storage of the sub-transaction unit context information cannot be achieved. Therefore, before sending the context information, the sub-transaction unit can determine in advance whether the current operating state of the main transaction unit is normal through the main transaction context. When the main transaction unit is in a normal operating state, the sub-transaction context is sent to the transaction processor in the main transaction unit for storage.
[0087] The business processing method provided in this embodiment determines the current state of the main transaction unit before sending context information, thereby enabling information interaction between the main transaction unit and the sub-transaction unit, thereby ensuring the accuracy of transaction processing.
[0088] Figure 6 The schematic diagram of the structure of the main transaction processing device provided in the fourth embodiment of the present disclosure is applied to a distributed transaction platform, wherein the distributed transaction platform includes a main transaction unit and at least one sub-transaction unit. Figure 6 As shown, the device includes: an acquisition module 61, a storage module 62, a generation module 63 and a sending module 64. Among them, the acquisition module 61 is used to obtain a business processing request, and the business processing request includes the identification information and the calling sequence of at least one sub-transaction called by the main transaction. The storage module 62 is used to store the identification information and the state information of the main transaction in the transaction processor preset in the main transaction unit according to the business processing request. The generation module 63 is used to generate the main transaction context according to the identification information and the state information. The sending module 64 is used to send the main transaction context to each sub-transaction unit in turn according to the calling sequence, so that the sub-transaction unit performs sub-transaction processing according to the main transaction context, and exchanges information with the main transaction unit according to the main transaction context.
[0089] Furthermore, based on the fourth embodiment, it also includes: an acquisition module, which is also used to acquire the sub-transaction context sent by each sub-transaction unit, and the sub-transaction context includes the identification information of the sub-transaction unit. A storage module is also used to store the sub-transaction context sent by each sub-transaction unit in a transaction processor preset in the main transaction unit.
[0090] Furthermore, based on any of the above embodiments, the device also includes: a rollback module, which is used to perform a transaction rollback operation on the transaction processed by any sub-transaction unit according to the context of the sub-transaction unit stored in the transaction processor in the main transaction unit if it is detected that the transaction processing of any sub-transaction unit fails.
[0091] Further, based on any of the above embodiments, the device also includes: a termination module, which is used to terminate the main transaction process if it is detected that the last sub-transaction unit in the calling sequence completes the sub-transaction processing operation.
[0092] Figure 7 The schematic diagram of the structure of the sub-transaction processing device provided in the fifth embodiment of the present disclosure is applied to any sub-transaction unit in a distributed transaction platform, wherein the distributed transaction platform includes a main transaction unit and at least one sub-transaction unit. Figure 7 As shown, the device includes: a context acquisition module 71 and a processing module 72. The context acquisition module 71 is used to acquire the main transaction context sent by the main transaction unit, and the main transaction context includes the identification information and status information of the main transaction. The processing module 72 is used to perform sub-transaction processing according to the context, and to exchange information with the main transaction unit according to the main transaction context.
[0093] Further, based on any of the above embodiments, the processing module is used to: generate a subtransaction context based on the main transaction context and the identification information and unit information of the subtransaction, and send the subtransaction context to a transaction processor in the main transaction unit for storage.
[0094] Further, based on any of the above embodiments, the device further includes: a determination module, configured to determine whether the current operation state of the main transaction unit is normal through the main transaction context; and a sending module, configured to send the sub-transaction context to a transaction processor in the main transaction unit for storage when the main transaction unit is in a normal operation state.
[0095] In order to implement the above embodiment, the present disclosure also provides an electronic device, including: a processor and a memory;
[0096] The memory stores computer-executable instructions;
[0097] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the service request processing method as described in any of the above embodiments.
[0098] Figure 8 This is a schematic diagram of the structure of an electronic device provided in Embodiment 6 of the present disclosure, such as Figure 8As shown, the electronic device 800 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (Portable Media Players, PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 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.
[0099] like Figure 8 As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803. Various programs and data required for the operation of the electronic device 800 are also stored in the RAM 803. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0100] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0101] 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 product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 809, or installed from a storage device 808, or installed from a ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0102] Yet another embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the service request processing method as described in any of the above embodiments is implemented.
[0103] Yet another embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the service request processing method as described in any of the above embodiments.
[0104] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0105] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A business processing method, characterized in that: A main transaction unit applied to a distributed transaction platform, the distributed transaction platform comprising a main transaction unit and at least one sub-transaction unit; each sub-transaction unit has a complete set of transaction platform services that ensure a closed loop of transaction transactions within a unit; the main transaction unit and each sub-transaction unit comprises a separate transaction receiver and a transaction processor, the transaction receiver is used to exchange information with other transaction units; the method comprises: Acquire a business processing request, wherein the business processing request includes identification information of at least one sub-transaction called by the main transaction and a calling sequence; According to the business processing request, the identification information and the status information of the main transaction are stored in the main transaction table of the transaction processor preset in the main transaction unit; Generate a main transaction context according to the identification information and state information of the main transaction; Sending the main transaction context to each sub-transaction unit in sequence according to the calling order, so that the sub-transaction unit performs sub-transaction processing according to the main transaction context, and exchanges information with the main transaction unit according to the main transaction context; Acquire a subtransaction context sent by each subtransaction unit, wherein the subtransaction context includes unit information of the subtransaction unit; The sub-transaction context sent by each sub-transaction unit is stored in the sub-transaction table of the transaction processor preset in the main transaction unit; If it is detected that the transaction processing of any sub-transaction unit fails, a transaction rollback operation is performed on the transaction processed by the sub-transaction unit according to the context of the sub-transaction unit stored in the transaction processor in the main transaction unit.
2. The method according to claim 1, characterized in that After sending the main transaction context to each sub-transaction unit in sequence according to the calling order, the method further includes: If it is detected that the last sub-transaction unit in the calling sequence completes the sub-transaction processing operation, the main transaction process is terminated.
3. A business processing method, characterized in that: Applicable to any one sub-transaction unit in a distributed transaction platform according to any one of claims 1 to 2, wherein the distributed transaction platform comprises a main transaction unit and at least one sub-transaction unit; Each sub-transaction unit has a complete set of transaction platform services that ensure the closed loop of transaction transactions within a unit; the main transaction unit and each of the sub-transaction units include a separate transaction receiver and a transaction processor, and the transaction receiver is used to exchange information with other transaction units; the method includes: Acquire a main transaction context sent by a main transaction unit, the main transaction context including identification information and status information of the main transaction; the identification information and status information of the main transaction are stored by the main transaction unit in a main transaction table of the transaction processor preset in the main transaction unit according to a business processing request; the business processing request includes identification information and a calling sequence of at least one sub-transaction called by the main transaction; Perform sub-transaction processing according to the context, and perform information interaction with the main transaction unit according to the main transaction context; Generate a subtransaction context based on the main transaction context and the unit information of the subtransaction; The sub-transaction context is sent to the sub-transaction table of the transaction processor in the main transaction unit for storage, so that when the main transaction unit detects that any sub-transaction unit transaction processing fails, the transaction processed by the sub-transaction unit is rolled back according to the context of the sub-transaction unit stored in the transaction processor in the main transaction unit.
4. The method according to claim 3, characterized in that Before sending the sub-transaction context to the transaction processor in the main transaction unit for storage, the method further includes: Determining whether the current running state of the main transaction unit is normal through the main transaction context; When the main transaction unit is in a normal operating state, the sub-transaction context is sent to a transaction processor in the main transaction unit for storage.
5. A master transaction processing device, characterized in that: Applied to a distributed transaction platform, the distributed transaction platform includes a main transaction unit and at least one sub-transaction unit; each sub-transaction unit has a complete set of transaction platform services that ensure the closed loop of transaction transactions within a unit; the main transaction unit and each sub-transaction unit include a separate transaction receiver and a transaction processor, the transaction receiver is used to exchange information with other transaction units; the device includes: An acquisition module, used to acquire a business processing request, wherein the business processing request includes identification information of at least one sub-transaction called by the main transaction and a calling sequence; The acquisition module is further used to acquire the subtransaction context sent by each subtransaction unit, wherein the subtransaction context includes unit information of the subtransaction unit; the storage module is used to store the identification information and state information of the main transaction in a transaction processor preset in the main transaction unit according to the business processing request; The storage module is further used to store the sub-transaction context sent by each sub-transaction unit in a transaction processor preset in the main transaction unit; A generating module, used for generating a main transaction context according to the identification information and state information of the main transaction; A sending module, configured to send the main transaction context to each sub-transaction unit in sequence according to the calling order, so that the sub-transaction unit performs sub-transaction processing according to the main transaction context, and exchanges information with the main transaction unit according to the main transaction context; The rollback module is used to perform a transaction rollback operation on the transaction processed by any sub-transaction unit according to the context of the sub-transaction unit stored in the transaction processor in the main transaction unit if it is detected that the transaction processing of any sub-transaction unit fails.
6. A sub-transaction processing device, characterized in that: Applicable to any one sub-transaction unit in a distributed transaction platform according to any one of claims 1 to 2, wherein the distributed transaction platform comprises a main transaction unit and at least one sub-transaction unit; Each sub-transaction unit has a complete set of transaction platform services that ensure the closed loop of transaction transactions within a unit; the main transaction unit and each of the sub-transaction units include a separate transaction receiver and a transaction processor, and the transaction receiver is used to exchange information with other transaction units; the device includes: a context acquisition module, configured to acquire a main transaction context sent by a main transaction unit, wherein the main transaction context includes identification information and status information of the main transaction; the identification information and status information of the main transaction are stored by the main transaction unit in a main transaction table of the transaction processor preset in the main transaction unit according to a business processing request; the business processing request includes identification information and a calling sequence of at least one sub-transaction called by the main transaction; A processing module, configured to perform sub-transaction processing according to the context, and to perform information interaction with the main transaction unit according to the main transaction context; The processing module is further used to send the sub-transaction context to the sub-transaction table of the transaction processor in the main transaction unit for storage, so that when the main transaction unit detects that the transaction processing of any sub-transaction unit fails, the transaction processed by the sub-transaction unit is rolled back according to the context of the sub-transaction unit stored in the transaction processor in the main transaction unit.
7. An electronic device, characterized in that: include: Memory, processor; Memory; a memory for storing instructions executable by the processor; The processor is used to call the program instructions in the memory to execute the business processing method as described in any one of claims 1-2 or 3-4.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the business processing method as described in any one of claims 1-2 or 3-4.
9. A computer program product, characterized in that It comprises a computer program, which, when executed by a processor, implements the business processing method according to any one of claims 1-2 or 3-4.
Citation Information
Patent Citations
Distributed transaction processing method and system
CN106775959A
Transaction processing method, device and equipment
CN109901914A
Distributed transaction processing method and device based on service-free architecture
CN113051044A