Platform SDK: Transaction Server

Transaction Propagation

A transaction begun in one process can be propagated to another process. Resource managers built on a client/server architecture, have a server side and a client side. The server side enlists in a transaction so that it can participate in the two-phase commit. However, because the transaction (MS DTC transaction) might have been initiated on the client side, such resource managers use a mechanism to propagate a transaction from the client side to the server side. This mechanism is implemented entirely by MS DTC. See the Life of a Transaction: Exporting a Transaction topic for more detailed information.

Exporting a Transaction

The resource manager proxy (RM proxy) on the client side can provide a function which an application can call to request a resource manager to enlist in a transaction. The transaction (ITransaction *) to enlist in can be provided via a parameter to the enlist function. After obtaining the transaction to enlist in, the RM proxy uses the ITransactionExport interface to propagate the transaction to the transaction coordinator.

To export a transaction

  1. The application client obtains an ITransaction interface by invoking the ITransactionDispenser::BeginTransaction method.
  2. The application client calls the RM_Enlist function, passing it the ITransaction transaction on which it wants the RM to enlist.
  3. Within the RM_Enlist function, the RM proxy does the following:

Importing a Transaction

After the resource manager server receives the transaction cookie, it invokes the ITransactionImport::Import method, providing it with the cookie that it had received from its proxy. This invocation translates the cookie to an ITransaction interface, and if it succeeds, then the resource manager also has an interface to the same transaction which the application client had obtained in step 1 of Exporting a Transaction earlier in this topic.