METHOD AND SYSTEM FOR DISTRIBUTED
TRANSACTION PROCESSING WITH
ASYNCHRONOUS MESSAGE DELIVERY
FIELD OF THE INVENTION
This invention relates generally to transaction processing, and more particularly to distributed transaction processing in a network with asynchronous communications in the form of messages. 10
BACKGROUND OF THE INVENTION
In distributed databases, a transaction may involve operations to be performed at different sites. The operations in a transaction must be performed atomically (i.e., either all of them are performed or none of them is performed.) Atomic transaction implementation is typically based on a commit protocol, such as the widely used two-phase commit protocol. In a "prepare" phase of the two-phase commit protocol, 2Q a transaction coordinator asks all resource managers involved in the transaction to vote whether each of them can guarantee the execution of its part of the transaction. If all votes are positive, the transaction coordinator in a "commit" phase asks each resource manager to actually carry out its 2J respective operation.
The implementation of the conventional two-phase commit for distributed transaction processing in a network with asynchronous communications poses significant problems. With asynchronous communications, one application sends 30 a request to a receiving application regardless of whether the receiving application is operating. The request is passed through the network which includes nodes that can come on or off at random intervals. There is no guarantee when the request will reach the receiving application and when the 35 requesting application will receive a response from the receiving application. In the conventional commit process, after sending a positive vote in the prepare phase, a resource manager may have to lock up its resource so that it will be able to fulfill its promise of performing the requested 40 operation when it receives a commit instruction from the transaction coordinator. When applied to distributed databases, the two-phase commit protocol locks up the data in a database involved in the transaction so that no changes requested by other clients can be made. Due to the unpre- 45 dictable delivery time of asynchronous communications, the database may be locked up for an unacceptably long time and become useless.
SUMMARY OF THE INVENTION
In accordance with the present invention, there is provided a method and system for processing distributed transactions that integrates the execution of operations of a transaction on separate computers with the exactly-once in-order message delivery of a message queuing system to 55 allow the transaction operations to be performed atomically and asynchronously. In a distributed transaction, a first application on a first computer requests a local resource manager to perform a first operation and uses a message queue (MQ) server to send a request message to a second 60 application on a remote computer for the performance of a second operation. The local resource manager and the MQ server of the first computer are coordinated to perform the first operation and send the request message in a local committed transaction. The message is delivered exactly 65 once and in sequence to a target message queue for the second application on the remote computer. The second
application uses the MQ server of the remote computer to read the message and uses a second resource manager to perform the requested second operation in a second local committed transaction. As part of the second local committed transaction, the MQ server of the remote computer sends an acknowledgment which is delivered by the message queuing system to the MQ server of the first computer.
In accordance with another aspect of the invention, a connector computer is used to bridge two different message queuing systems to allow the processing of a distributed transaction which involves computers in the two message queuing systems. The connector computer is connected to both message queuing systems and has a connector application. When an application in the first message queuing system initiates a transaction and sends a request message to an application on a second computer in the second message queuing system, the message is routed to a message queue of the connector computer. The connector application translates the message into the format of the second message queuing system and forwards the translated message to the second computer.
The advantages of the invention will become apparent with reference to the following detailed description when taken in conjunction with the drawings in which:
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of a computer system that may be used to implement a method and apparatus for implementing distributed transaction processing in a message queuing system according to the invention;
FIG. 2 is a schematic diagram showing two computers in a message queuing system that are involved in a distributed transaction;
FIG. 3 is a schematic diagram showing participants of a two-phase commit protocol;
FIG. 4 is a flow chart showing steps in an exemplary distributed transaction coordinated according to the invention;
FIG. 5 is a schematic diagram showing two message queuing systems bridged by connector computers; and
FIG. 6 is a schematic diagram showing two computers in two different message queuing systems that pass messages in a distributed transaction via a connector computer.
While the invention is susceptible of various modifications and alternative constructions, certain illustrated embodiments hereof have been shown in the drawings and will be described below. It should be understood, however, that there is no intention to limit the invention to the specific forms disclosed, but, on the contrary, the invention is to cover all modifications, alternative constructions and equivalents falling within the spirit and scope of the invention as defined by the appended claims.
DETAILED DESCRIPTION OF THE
Turning now to the drawings, FIG. 1 and the following discussion are intended to provide a brief, general, description of a suitable computing environment in which the invention may be implemented. Although not required, the invention will be described in the general context of computer-executable instructions, such as program modules, being executed by a personal computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Moreover, those skilled