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 DTC transaction might have been initiated on the client side, client/server resource managers use a DTC-implemented mechanism to propagate a transaction from the client side to the server side.
To propagate a transaction, the resource manager proxy on the client side provides a function that an application can call to request a resource manager to enlist in a transaction. After obtaining the transaction to enlist in, the resource manager proxy uses ITransactionExport to propagate the transaction to the transaction coordinator.
To export a transaction
The application client calls the IResourceManager2::Enlist2 method, passing it the transaction in which it wants the resource manager to enlist.
Within the IResourceManager2::Enlist2 method, the resource manager proxy does the following:
Invokes ITransactionExport::Export, passing it the ITransaction interface provided by the client. (See Obtaining the Whereabouts of the Participating DTC for information about how to obtain the ITransactionExport interface.
If the preceding step succeeds, the resource manager proxy obtains the transaction cookie by invoking ITransactionExport::GetTransactionCookie.
The resource manager proxy sends the transaction cookie to the resource manager via a communication pipe that is used for the transmission of all messages between the proxy and the resource manager server.
- Invokes ITransactionExport::Export, passing it the ITransaction interface provided by the client. (See Obtaining the Whereabouts of the Participating DTC for information about how to obtain the ITransactionExport interface.
After the resource manager server receives the transaction cookie, it invokes ITransactionImport::Import, providing it with the cookie that it received from its proxy. This invocation translates the cookie to an ITransaction interface, and if it succeeds, the resource manager has an interface to the client-initiated transaction.