Obtaining the Whereabouts

Resource managers which are designed as client/server systems, will generally have the resource manager server on one node and the resource manager proxy on other nodes. If the application client begins the transaction and wants the resource manager to enlist in the transaction, then it will do so by invoking a function in the RM proxy (such as RM_Enlist) and providing it with the ITransaction which it wants the resource manager to enlist in.

If the transaction is begun on Node A, then before the resource manager on Node B can enlist in the transaction, the transaction needs to be propagated to the transaction coordinator on Node B. RM proxy needs to request MS DTC on its node to propagate the transaction to node B. Before making this request, it needs to know which MS DTC should the transaction be propagated to. To obtain this information, the RM proxy, sends a message to its resource manager asking for the whereabouts of the MS DTC which the resource manager is working with. The resource manager does the following steps to obtain the whereabouts:

  1. It obtains the ITransactionImportWhereabouts interface. There are multiple ways to obtain this interface, such as by calling IResourceManagerFactory::QueryInterface, or by calling DtcGetTransactionManager function, or by calling the QueryInterface method on the IUnknown that the resource manager might have obtained from a previous call to DtcGetTransactionManager.
  2. It then calls ITransactionImportWhereabouts::GetWhereabouts, to obtain the whereabouts of the MS DTC which it is working with. Having obtained this information once, it can be cached and therefore, future calls of this method can be avoided. What is obtained from this call is a binary large object (BLOB).

After obtaining the whereabouts BLOB, the resource manager sends it to the RM proxy. RM proxy after receiving the whereabouts BLOB does the following steps to obtain an ITransactionExport interface.

  1. It obtains the ITransactionExportFactory interface from the MS DTC proxy. This interface is obtained by invoking ITransactionDispenser::QueryInterface. See the section titled "Obtaining Transaction Dispenser from a Transaction" for more details.
  2. It then invokes ITransactionExportFactory::Create, passing it the whereabouts BLOB which it had received from the resource manager. As a result of this invocation, it obtains an ITransactionExport interface to an export object, which it can then keep for exporting transaction to the MS DTC with which its resource manager is working.

Note Even in cases where the RM proxy might be on the same node as the resource manager, the steps for obtaining the whereabouts and propagating the transaction need to be performed.