CN113760467A - Transaction processing method, device, computer system and storage medium - Google Patents
Transaction processing method, device, computer system and storage medium Download PDFInfo
- Publication number
- CN113760467A CN113760467A CN202110059504.0A CN202110059504A CN113760467A CN 113760467 A CN113760467 A CN 113760467A CN 202110059504 A CN202110059504 A CN 202110059504A CN 113760467 A CN113760467 A CN 113760467A
- Authority
- CN
- China
- Prior art keywords
- transaction
- template
- tool
- project
- creating
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/466—Transaction processing
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The present disclosure provides a transaction processing method, including: acquiring a transaction request instruction; in response to the transaction request instruction, invoking a transaction template tool; wherein the transaction template tool is referenced in a project object model file in the target project and is used for executing the transaction, the transaction template tool comprising an annotation object, a context object, and a transaction template encapsulation object; based on the transaction template tool, the transaction is executed. The present disclosure also provides a transaction processing apparatus, a computer system and a computer readable storage medium.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a transaction processing method, an apparatus, a computer system, and a storage medium.
Background
With the rapid development of artificial intelligence, automatic control, communication, and computer technologies, business processes through business operations are increasingly applied to various aspects of life. Such as logistics, online shopping, and online money transfer. The transaction has the characteristics of atomicity, consistency, isolation, durability and the like, and can ensure the consistency of data.
In implementing the disclosed concept, the inventors found that there are at least the following problems in the related art: when the business processing is performed, in order to ensure that the transaction takes effect, the operation of realizing the transaction is complex.
Disclosure of Invention
In view of the above, the present disclosure provides a transaction processing method, an apparatus, a computer system and a computer readable storage medium.
One aspect of the present disclosure provides a transaction processing method, including:
acquiring a transaction request instruction;
responding to the transaction request instruction, and calling a transaction template tool; the transaction template tool is referred to in a project object model file in a target project and is used for executing the transaction, and the transaction template tool comprises an annotation object, a context object and a transaction template packaging object; and
and executing the transaction based on the transaction template tool.
According to an embodiment of the present disclosure, the executing the transaction based on the transaction template tool includes:
based on the annotation object, opening a transaction switch of the transaction; and
and statically calling the transaction template in the transaction template packaging object to be used for executing the transaction based on the transaction template packaging object and the context object.
According to an embodiment of the present disclosure, further comprising:
creating the transaction template tool; wherein, the tool for creating the transaction template comprises:
creating an engineering project file decoupled from the target engineering; the project files comprise annotation objects, context objects and transaction template packaging objects; and
and packaging the project files to generate the template transaction tool.
According to an embodiment of the present disclosure, the creating of the engineering project file decoupled from the target engineering includes:
creating an annotation object; wherein, the annotation object comprises the annotation of the affair switch for starting the affair;
creating a context object; wherein, the context object stores the context of the target project;
acquiring a transaction template based on the context object; and
and creating a transaction template packaging object for packaging the transaction template so that the transaction template is called in a static calling mode.
According to an embodiment of the present disclosure, wherein: the creating of the project file decoupled from the target project further comprises:
and configuring the address of the annotation object into the extension mechanism file of the target project so as to automatically assemble the annotation object when the transaction is executed.
According to an embodiment of the present disclosure, the method further includes:
judging whether the transaction execution is successful;
submitting the successful execution result of the transaction under the condition that the execution of the transaction is successful; and
in the event of a transaction execution failure as described above, a transaction rollback is implemented.
In another aspect of the present disclosure, a transaction processing apparatus is provided, including:
the acquisition module is used for acquiring a transaction request instruction;
the calling module is used for responding to the transaction request instruction and calling a transaction template tool; the transaction template tool is referred to in a project object model file in a target project and is used for executing the transaction, and the transaction template tool comprises an annotation object, a context object and a transaction template packaging object; and
and the execution module is used for executing the affair based on the affair template tool.
According to an embodiment of the present disclosure, the apparatus further includes:
the creating module is used for creating the transaction template tool; wherein, the creating module comprises:
the creating unit is used for creating an engineering project file decoupled from the target engineering; the project files comprise annotation objects, context objects and transaction template packaging objects; and
and the packaging unit is used for packaging the project files and generating the template transaction tool.
In yet another aspect of the present disclosure, there is also provided a computer system including:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method described above.
In yet another aspect of the present disclosure, there is also provided a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to implement the above-described method.
In yet another aspect of the present disclosure, a computer program product is also provided, which includes a computer program including computer executable instructions for implementing the above-mentioned transaction processing method when executed.
According to the embodiment of the present disclosure, because the get transaction request instruction is adopted; in response to the transaction request instruction, invoking a transaction template tool; wherein the transaction template tool is referenced in a project object model file in the target project and is used for executing the transaction, the transaction template tool comprising an annotation object, a context object, and a transaction template encapsulation object; and based on the transaction template tool, the technical means for executing the transaction avoids the problems that a large transaction is introduced by adopting a transaction annotation mode and the class containing the transaction template needs to be injected into the context of the Springboot, so that the technical problem that the operation of the transaction is complicated during the transaction processing in the prior art is at least partially solved, and the technical effect of convenient and fast transaction execution is further achieved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an exemplary system architecture to which the transaction processing methods and apparatus of the present disclosure may be applied;
FIG. 2 schematically illustrates an application scenario of a transaction processing method according to an embodiment of the present disclosure;
FIG. 3 schematically shows a flow diagram of a transaction processing method according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a create transaction template tool according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates creating an engineering project file decoupled from a target engineering in accordance with an embodiment of the present disclosure;
FIG. 6 schematically shows a flow diagram of executing a transaction according to an embodiment of the disclosure;
FIG. 7 schematically illustrates a flow diagram of a transaction processing method according to another embodiment of the disclosure;
FIG. 8 schematically shows a block diagram of a transaction device according to an embodiment of the present disclosure; and
FIG. 9 schematically illustrates a block diagram of a computer system suitable for implementing a transaction processing method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
The embodiment of the disclosure provides a transaction processing method and device. The method comprises the steps of obtaining a transaction request instruction; in response to the transaction request instruction, invoking a transaction template tool; wherein the transaction template tool is referenced in a project object model file in the target project and is used for executing the transaction, the transaction template tool comprising an annotation object, a context object, and a transaction template encapsulation object; and executing the transaction based on the transaction template tool.
Fig. 1 schematically illustrates an exemplary system architecture 100 to which the transaction processing method and apparatus may be applied, according to an embodiment of the disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired and/or wireless communication links, and so forth.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as a shopping-type application, a web browser application, an internet banking-type application, a search-type application, an instant messaging tool, a mailbox client, and/or social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the transaction processing method provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the transaction processing device provided by the embodiment of the present disclosure may be generally disposed in the server 105. The transaction processing method provided by the embodiment of the present disclosure may also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the transaction processing device provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Alternatively, the transaction processing method provided by the embodiment of the present disclosure may also be executed by the terminal device 101, 102, or 103, or may also be executed by another terminal device different from the terminal device 101, 102, or 103. Accordingly, the transaction processing apparatus provided in the embodiment of the present disclosure may also be disposed in the terminal device 101, 102, or 103, or disposed in another terminal device different from the terminal device 101, 102, or 103.
For example, the transaction template tool may be originally stored in any of the terminal devices 101, 102, or 103 (e.g., but not limited to terminal device 101), or stored on an external storage device and may be imported into terminal device 101. Then, the terminal device 101 may locally execute the transaction processing method provided by the embodiment of the present disclosure, or send a transaction to another terminal device, a server, or a server cluster, and execute the transaction processing method provided by the embodiment of the present disclosure by another terminal device, a server, or a server cluster that receives the transaction.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
According to an embodiment of the present disclosure, the Spring boot is a completely new framework, and the design purpose of the framework is to simplify the initial building and development process of a new Spring application. The framework uses a specific way to configure, thereby eliminating the need for developers to define a templated configuration.
Transactions, according to embodiments of the present disclosure, generally refer to things to be or are done. In computer terminology, refers to a program execution unit (unit) that accesses and possibly updates various data items in a database. Transactions are typically caused by the execution of user programs written in a high level database manipulation language or programming language (e.g., SQL, C + +, or Java) and are bounded in the form of begin transactions and end transactions statements (or function calls). A transaction consists of an ensemble of operations performed between a transaction start (begin transaction) and a transaction end (end transaction). A transaction refers to a logical set of operations that the individual execution units that make up the transaction must either succeed together or fail together. The characteristics of a transaction include atomicity, consistency, isolation, and durability.
Fig. 2 schematically shows an application scenario diagram of a transaction processing method according to an embodiment of the present disclosure.
As shown in fig. 2, an application scenario of the transaction processing method of the present disclosure may be, for example, 100 yuan for the three-to-four transfers; in the transfer process, money is added to the account with the third account and money is reduced to the account with the fourth account, and the two operations need to be in sequence. Once a problem occurs between these two operations, for example, if the account with Zhang three receives 100 dollars, but the account with Lile four does not have a corresponding subtraction of 100 dollars, then the transfer process becomes problematic. In this case, using transactions, one account add operation, one account subtract operation, the implementation either succeeds together or fails together.
According to other embodiments of the present disclosure, the application scenario of the transaction processing method of the present disclosure may also be that, after the order is placed, the payment state recorded in the order form needs to be modified, and meanwhile, the payment state recorded in the settlement order also needs to be modified. In this case, the transaction, the payment status operation of the order record, the payment status operation of the statement of account, succeed together or fail together.
Fig. 3 schematically shows a flow chart of a transaction processing method according to an embodiment of the present disclosure.
As shown in fig. 3, the method includes operations S301 to S303.
In operation S301, a transaction request instruction is obtained.
In operation S302, a transaction template tool is invoked in response to the transaction request instruction; wherein the transaction template tool is referenced in a project object model file in the target project and is used to execute the transaction, the transaction template tool including an annotation object, a context object, and a transaction template encapsulation object.
In operation S303, a transaction is executed based on the transaction template tool.
In implementing the present disclosure, it is found that the following several ways can be employed to implement the transaction. Such as a transaction annotation mode. The transaction annotation mode can ensure the transaction of the method only by adding the annotation @ Transactional to the implementation class or the method of the implementation class. However, there are many problems with the way the transaction is annotated. For example:
(1) when a transaction contains many operations such as query, update, and data insertion, the transaction execution time is naturally long.
(2) The lock has large competition, when all the connections operate on the same data at the same time, queuing occurs, and the transaction time naturally becomes longer.
(3) There are other non-DB operations in the transaction, such as some RPC requests, which are unstable factors, affected by many factors, network fluctuations, slow downstream service response, etc. If these factors once present, pile up a large number of large transactions, it is possible to cause Mysql connection occupancy to exhaust, leading to service false death, thus causing an avalanche.
(4) The transaction note @ Transactional is implemented such that Spring generates a proxy class for the Bean. When executed, it determines whether the class or the method has an annotation to decide whether to open the transaction. So if not used correctly, the IOC mechanism of Spring does not discover the used Bean, resulting in the proxy class not being able to proxy the operation, which would result in the annotation not being valid, i.e., the transaction not being valid.
In addition, the transaction can be realized by adopting a transaction template, namely, the transaction is realized by obtaining the Bean of the transaction template, and the transaction template is provided in an anonymous internal class mode.
However, there are many problems with the current way of implementing transactions through transaction templates. For example, in the current transaction template mode, a class currently containing a transaction template needs to be injected into a Springboot context, so that when performing service processing, a corresponding class containing the transaction template can be found, and the corresponding class is called by means of @ Resource or @ automated, so as to implement a transaction through the transaction template in the class.
The existing transaction template is not convenient enough, the class of the transaction template needs to be injected into the application context of the spring boot, and note is added to the starting class to start a transaction switch of the transaction. And then calling the corresponding class by means of @ Resource or @ automatic and the like.
Furthermore, in a multi-threaded environment, for example, a concurrent asynchronous execution environment, there may be an environment in which one method is executed multiple times at the same time, and in this case, the corresponding bean cannot be obtained by an annotation manner. But needs to be acquired in the application context of SpringBoot and then transaction operation is carried out.
Based on this, the current common transaction template mode undoubtedly increases the complexity of transaction implementation and also disperses the efforts of developers.
According to the embodiment of the disclosure, the transaction template tool is used for managing and executing the transaction, and the transaction is realized by adopting the transaction template, so that the granularity of executing the transaction can be conveniently controlled, and the occurrence of large transactions is avoided.
According to the embodiment of the disclosure, the transaction template tool is referred to in the project object model file in the target project, and may be referred to as a transaction template tool when the target project needs to use the transaction template tool, and after the operation is completed and the target project is started, the transaction can be directly executed by using the transaction template tool.
According to an embodiment of the present disclosure, the transaction template tool includes an annotation object therein, the annotation object including an annotation that requires opening a transaction. The transaction template tool includes the annotation of a transaction switch used for starting the transaction in the annotation object; instead of configuring the startup file for the project in the prior art, annotations are added to the startup file.
According to the embodiment of the disclosure, the annotation object is placed in the transaction template tool, attention to the transaction opening notice is not needed, and the transaction opening operation is convenient.
According to the embodiment of the disclosure, the transaction template tool further comprises a context object, the context object can be used for obtaining and calling the transaction template in the transaction template packaging object, the corresponding transaction template is called without using the ways of @ Resource or @ automatic and the like in the prior art, attention items in the transaction execution process are not needed, and the transaction execution operation is convenient.
In summary, the transaction template tool of the embodiment of the present disclosure can conveniently control the granularity of executing the transaction, and avoid the occurrence of large transactions; on the other hand, attention matters in the process of starting and executing the transaction are not needed to be concerned, so that the transaction executing operation is convenient.
The method shown in fig. 3 is further described with reference to fig. 4-6 in conjunction with specific embodiments.
FIG. 4 schematically illustrates a create transaction template tool according to an embodiment of the disclosure.
As shown in FIG. 4, the create transaction template tool may include operations S401-S402 as follows.
In operation S401, creating an engineering project file decoupled from a target engineering; the project file comprises an annotation object, a context object and a transaction template packaging object.
In operation S402, the project item files are packaged to generate a template transaction tool.
According to an embodiment of the present disclosure, in creating the transaction template tool, it is decoupled from the target project. The project file can be a Maven project file which is created independently, and then a configuration class is created in the project file to obtain an annotation object and a context object.
According to an embodiment of the present disclosure, the engineering project files are packaged to generate a template transaction tool (trans-tool-spring-boot-startup), specifically, the packaging tool may be used to package the engineering project files into Jar files for an mvn tool, for example, to obtain the transaction template tool.
According to the embodiment of the disclosure, because an anonymous internal class submission mode is used, the granularity of the transaction can be conveniently controlled during code review, and the occurrence of large transactions is avoided. The code evaluation method has the advantages that the code standardization is improved, the burden of a developer is reduced, meanwhile, code evaluation personnel can provide more visual evaluation performance for the reasonability of affairs, and the online risk is reduced. The labor of the developer is reduced, the developer is more concentrated on service development, and the system is more robust and safer.
FIG. 5 schematically illustrates creating an engineering project file decoupled from a target engineering in accordance with an embodiment of the present disclosure.
As shown in FIG. 5, creating a project file decoupled from a target project may include operations S501-S504 as follows.
In operation S501, an annotation object is created; wherein the annotation object includes an annotation of a transaction switch that opens the transaction.
In operation S502, a context object is created; wherein the context object of the target project is stored in the context object.
In operation S503, a transaction template is acquired based on the context object.
In operation S504, a transaction template encapsulation object is created for encapsulating the transaction template so that the transaction template is invoked in a static calling manner.
According to the embodiment of the disclosure, creating the annotation object may be creating a configuration class in the engineering project file, and adding the annotation @ enableltransactionmanagement of a transaction switch for starting a transaction in the configuration class to obtain the annotation object.
According to the embodiment of the disclosure, in the project file of the disclosure, the context of the target project stored in the context object is directly utilized, and the transaction template is obtained based on the context object.
According to the embodiment of the disclosure, before the generation of the transaction template encapsulation object, a static tool class is obtained; the static tool class transctool may be developed by a user, but is not limited thereto, as long as the static tool class can implement a manner of encapsulating a transaction template and providing a static call.
According to the embodiment of the disclosure, a transaction template TransactionTemplate is encapsulated by using a static tool class, so as to generate a transaction template encapsulation object, and the transaction template encapsulation object provides a way for statically calling the transaction template. The static calling mode may be understood as that after the target project is started, the memory is directly allocated, and the transaction template is loaded into the memory for calling the transaction template. In the embodiment of the disclosure, the transaction template is more convenient and faster by adopting a static calling mode.
According to the embodiment of the disclosure, before the engineering project file is packaged and the template transaction tool operation is generated, an operation of configuring the address of the annotation object into the extension mechanism file of the target engineering is also required.
According to the embodiment of the disclosure, the addresses of the annotation object and the context object are configured into the extension mechanism file of the target project. Specifically, the annotation object and the context object address are configured in an extension mechanism file (spring. factors file) of spring book under/src/main/resources/META-INF/path, so that the annotation object can be automatically assembled when the target project is started.
FIG. 6 schematically shows a flow diagram for executing a transaction according to an embodiment of the disclosure.
As shown in FIG. 6, executing a transaction includes operations S601-S602.
In operation S601, a transaction switch of the transaction is turned on based on the annotation object.
In operation S602, a transaction template in the transaction template encapsulation object is statically called for use in executing the transaction based on the transaction template encapsulation object and the context object.
According to an embodiment of the present disclosure, the transaction template tool starts a transaction based on an annotation object, since the annotation object has added thereto an annotation of a transaction switch that starts the transaction; in the present disclosure, the transaction template tool calls the transaction template in a static manner using the context object for executing the transaction. And realizing a static calling mode of the transaction template through a static tool class.
According to the embodiment of the disclosure, the implementation mode adopted in the disclosure is that a transaction template encapsulation object is created, the transaction template is encapsulated independently, and when the transaction template is used, the transaction template is invoked in a static invoking mode based on the context object. Instead of the prior art, the transaction template is injected into the context object of the corresponding SpringBoot through the configuration class, and the corresponding transaction template is called through annotating @ Resource or @ automated and the like when the transaction template is used.
According to the embodiment of the disclosure, compared with the implementation mode of creating and calling in the prior art, the transaction template tool of the disclosure is more convenient and less error in the aspects of creating the target project, executing the transaction by utilizing the target project and the like.
According to the embodiment of the disclosure, the transaction is realized by adopting a transaction template tool without paying attention to the matters of attention to the starting and using of the transaction. Furthermore, in a multi-threaded environment, the transaction template tool automatically guarantees correct injection of multi-threaded objects. The present disclosure provides a convenient and fast transaction implementation.
FIG. 7 schematically shows a flow diagram of a method of processing a transaction according to another embodiment of the present disclosure.
As shown in FIG. 7, executing the transaction includes operations S710-S740, S751, and S752.
In operation S710, a transaction request instruction is acquired.
In operation S720, in response to the transaction request instruction, invoking a transaction template tool; wherein the transaction template tool is referenced in a project object model file in the target project and is used to execute the transaction, the transaction template tool including an annotation object, a context object, and a transaction template encapsulation object.
In operation S730, a transaction is executed based on the transaction template tool.
In operation S740, it is determined whether the transaction execution is successful;
in operation S751, in case the transaction execution is successful, committing a transaction execution success result; and
in operation S752, in case of a failure of the transaction execution, a transaction rollback is implemented.
According to an embodiment of the present disclosure, an atomic operation of a transaction is implemented through operations S740, S751, and S752.
Fig. 8 schematically shows a block diagram of a transaction device according to an embodiment of the present disclosure.
As shown in fig. 8, the transaction processing apparatus 800 includes an obtaining module 810, a calling module 820, and an executing module 830.
An obtaining module 810, configured to obtain the transaction request instruction.
A calling module 820 for calling the transaction template tool in response to the transaction request instruction; wherein the transaction template tool is referenced in a project object model file in the target project and is used to execute the transaction, the transaction template tool including an annotation object, a context object, and a transaction template encapsulation object.
An execution module 830 for executing the transaction based on the transaction template tool.
According to an embodiment of the present disclosure, the transaction processing apparatus further includes:
a creation module for creating a transaction template tool; wherein the creation module comprises:
the creating unit is used for creating an engineering project file decoupled from the target engineering; the engineering project file comprises an annotation object, a context object and a transaction template packaging object; and
and the packaging unit is used for packaging the project files and generating a template transaction tool.
According to an embodiment of the present disclosure, executing a transaction based on a transaction template tool includes:
based on the annotation object, opening a transaction switch of the transaction; and
based on the transaction template package object and the context object, a transaction template in the transaction template package object is statically invoked for use in executing the transaction.
According to an embodiment of the present disclosure, wherein the creating unit is further configured to create an annotation object; wherein the annotation object comprises an annotation of a transaction switch for starting a transaction; creating a context object; wherein, the context of the target project is stored in the context object; based on the context object, acquiring a transaction template; and creating a transaction template packaging object for packaging the transaction template so that the transaction template can be called in a static calling mode.
According to the embodiment of the disclosure, the creating unit is further used for configuring the addresses of the annotation object and the context object into the extension mechanism file of the target project so as to automatically assemble the annotation object when the transaction is executed.
According to an embodiment of the present disclosure, the transaction processing apparatus further includes a determination module.
According to an embodiment of the present disclosure, the determining module is configured to determine whether the transaction execution is successful; submitting a transaction execution success result under the condition that the transaction execution is successful; and in the event of a failure of the transaction execution, performing a transaction rollback.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any number of the transaction device 800 including the obtaining module 810, the calling module 820 and the executing module 830 may be combined and implemented in one module/unit/sub-unit, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to an embodiment of the present disclosure, at least one of the transaction device 800 including the obtaining module 810, the invoking module 820 and the executing module 830 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware by any other reasonable manner of integrating or packaging a circuit, or may be implemented in any one of three implementations of software, hardware and firmware, or in a suitable combination of any of them. Alternatively, at least one of the transaction device 800 including the obtaining module 810, the calling module 820 and the executing module 830 may be at least partially implemented as a computer program module, which when executed, may perform a corresponding function.
It should be noted that the transaction processing device portion in the embodiment of the present disclosure corresponds to the transaction processing method portion in the embodiment of the present disclosure, and the description of the transaction processing device portion specifically refers to the transaction processing method portion, which is not described herein again.
FIG. 8 schematically illustrates a block diagram of a computer system suitable for implementing the above-described method, according to an embodiment of the present disclosure. The computer system illustrated in FIG. 8 is only one example and should not impose any limitations on the scope of use or functionality of embodiments of the disclosure.
As shown in fig. 9, a computer system 900 according to an embodiment of the present disclosure includes a processor 901 which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)902 or a program loaded from a storage section 908 into a Random Access Memory (RAM) 903. Processor 901 may comprise, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 901 may also include on-board memory for caching purposes. The processor 901 may comprise a single processing unit or a plurality of processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 903, various programs and data necessary for the operation of the system 900 are stored. The processor 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. The processor 901 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 902 and/or the RAM 903. Note that the programs may also be stored in one or more memories other than the ROM 902 and the RAM 903. The processor 901 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 909, and/or installed from the removable medium 911. The computer program, when executed by the processor 901, performs the above-described functions defined in the system of the embodiment of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 902 and/or the RAM 903 described above and/or one or more memories other than the ROM 902 and the RAM 903.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method provided by the embodiments of the present disclosure, when the computer program product is run on an electronic device, the program code being adapted to cause the electronic device to carry out the transaction processing method provided by the embodiments of the present disclosure.
The computer program, when executed by the processor 901, performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, and downloaded and installed through the communication section 909 and/or installed from the removable medium 911. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.
Claims (10)
1. A transaction processing method, comprising:
acquiring a transaction request instruction;
calling a transaction template tool in response to the transaction request instruction; wherein the transaction template tool is referenced in a project object model file in a target project and is used for executing the transaction, the transaction template tool comprising an annotation object, a context object, and a transaction template encapsulation object; and
executing the transaction based on the transaction template tool.
2. The method of claim 1, the executing the transaction based on the transaction template tool comprising:
based on the annotation object, opening a transaction switch of the transaction; and
based on the transaction template package object and the context object, statically calling a transaction template in the transaction template package object for use in executing the transaction.
3. The method of claim 1, further comprising:
creating the transaction template tool; wherein the creating the transaction template tool comprises:
creating an engineering project file decoupled from the target engineering; wherein, the project file comprises an annotation object, a context object and a transaction template packaging object; and
and packaging the project files to generate the template transaction tool.
4. The method of claim 3, wherein the creating an engineering project file decoupled from the target engineering comprises:
creating an annotation object; wherein the annotation object includes an annotation of a transaction switch that opens the transaction;
creating a context object; wherein the context of the target project is stored in the context object;
acquiring a transaction template based on the context object; and
and creating a transaction template packaging object for packaging the transaction template so that the transaction template is called in a static calling mode.
5. The method of claim 4, wherein the creating an engineering project file decoupled from the target engineering further comprises:
and configuring the address of the annotation object and the address of the context object into an extension mechanism file of the target project so as to automatically assemble the annotation object when the transaction is executed.
6. The method of claim 1, further comprising:
judging whether the transaction execution is successful;
submitting the transaction execution success result under the condition that the transaction execution is successful; and
in the event of a failure of the transaction execution, a transaction rollback is implemented.
7. A transaction processing device, comprising:
the acquisition module is used for acquiring a transaction request instruction;
the calling module is used for responding to the transaction request instruction and calling a transaction template tool; wherein the transaction template tool is referenced in a project object model file in a target project and is used for executing the transaction, the transaction template tool comprising an annotation object, a context object, and a transaction template encapsulation object; and
and the execution module is used for executing the transaction based on the transaction template tool.
8. The apparatus of claim 7, further comprising:
a creation module for creating the transaction template tool; wherein the creation module comprises:
the creating unit is used for creating an engineering project file decoupled from the target engineering; wherein, the project file comprises an annotation object, a context object and a transaction template packaging object; and
and the packaging unit is used for packaging the project files and generating the template transaction tool.
9. A computer system, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-6.
10. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110059504.0A CN113760467A (en) | 2021-01-15 | 2021-01-15 | Transaction processing method, device, computer system and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110059504.0A CN113760467A (en) | 2021-01-15 | 2021-01-15 | Transaction processing method, device, computer system and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113760467A true CN113760467A (en) | 2021-12-07 |
Family
ID=78786399
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110059504.0A Pending CN113760467A (en) | 2021-01-15 | 2021-01-15 | Transaction processing method, device, computer system and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113760467A (en) |
-
2021
- 2021-01-15 CN CN202110059504.0A patent/CN113760467A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10162624B1 (en) | Web shell for dynamically generated cross-platform applications | |
US11816492B2 (en) | Third party integration of plugins and widgets | |
US11042387B2 (en) | Deploying cross-platform applications on mobile devices with native and web components | |
US10185626B2 (en) | Automatic application error detection and rollback | |
US11561889B2 (en) | Orchestration for automated performance testing | |
US11157259B1 (en) | Semantic and standard user interface (UI) interoperability in dynamically generated cross-platform applications | |
US10379914B2 (en) | System and method for achieving specific behaviors by intercepting file access calls in a mainframe rehosting platform | |
CN112930530B (en) | Client application for network application execution | |
EP4155935A1 (en) | Cloud migration for legacy on-premises process code | |
CN113176907A (en) | Interface data calling method and device, computer system and readable storage medium | |
CN113986679A (en) | Performance analysis method and device based on configuration information hot loading | |
CN113010561A (en) | Data acquisition method and device based on super account book and computer system | |
CN110717992B (en) | Method, apparatus, computer system and readable storage medium for scheduling model | |
CN116089301A (en) | Component sharing method, device, electronic equipment and storage medium | |
CN113760467A (en) | Transaction processing method, device, computer system and storage medium | |
CN114035864A (en) | Interface processing method, interface processing device, electronic device, and storage medium | |
CN113448578A (en) | Page data processing method, processing system, electronic device and readable storage medium | |
CN112506781A (en) | Test monitoring method, test monitoring device, electronic device, storage medium, and program product | |
CN111859403A (en) | Method and device for determining dependency vulnerability, electronic equipment and storage medium | |
CN116192784B (en) | Message notification method, device and equipment based on broadcast robot | |
US11966723B2 (en) | Automatic management of applications in a containerized environment | |
US20230179569A1 (en) | Systems and methods for verifying a firewall for a cloud provider | |
US12026558B2 (en) | Integration extensions | |
WO2022237826A1 (en) | User interface testing method and system, cluster, medium, and program product | |
US20240143340A1 (en) | Hybrid multi-tenant framework for reconfiguring software components |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |