Enlists a resource manager in a transaction.
HRESULT Enlist (
ITransaction * |
pTransaction, |
ITransactionResourceAsync * |
pRes, |
GUID * |
pUOW, |
LONG * |
pisoLevel, |
ITransactionEnlistmentAsync ** |
ppEnlist); |
Parameters
pTransaction [in]
Pointer to the transaction object in which the resource manager wishes to enlist.
pRes [in]
Pointer to the resource manager's ITransactionResourceAsync interface. The resource manager developer must implement the methods on this interface.
PUOW [in/out]
Pointer to the transaction identifier GUID.
pisoLevel [out]
Pointer to the value of the client specified isolation level.
ppEnlist [out]
Pointer to the pointer to the ITransactionEnlistAsync interface on the enlistment object.
Return Values
S_OK
Success.
E_INVALIDARG
One or more parameters were invalid.
E_OUTOFMEMORY
Unable to allocate memory.
E_UNEXPECTED
Something unexpected happened.
XACT_E_ABORT
The transaction has aborted.
XACT_E_CONNECTION_DOWN
Lost connection with the TM.
XACT_E_NOTRANSACTION
For some reason the transaction could not be found. Perhaps it was not exported or it could have been aborted and forgotten before the enlist call was made.
XACT_E_LOGFULL
Unable to enlist as the LOG is full.
XACT_E_TOOMANY_ENLISTMENTS
The coordinator already has maximum number of Resources Enlisted in the transaction is unable to enlist any more. Typically Coordinators should not have an arbitrary limit as to the maximum number of enlistments they can support.
Comments
An instance of ITransactionResourceAsync is pass as an argument. This interface is implemented by the RM and there is an instance of it per transaction. If the Coordinator is successful in enlisting the RM on the requested transaction then the RM will receive an instance of ITransactionEnlistmentAsync as an out parameter to the Enlist method. The thing to note is that an ITransaction instance is being provided to the method as in argument, however the transaction in the general case would have been begun by the application. The RM somehow needs to obtain that transaction from the client before it can request to be enlisted in it. The process for propagating the transaction from the application to the RM is discussed later. In brief the application calls a function or invokes a method in the RM proxy, asking it to enlist in the transaction. The RM proxy then with the help of MS DTC proxy is responsible for propagating the transaction to the resource manager server.