Transaction propagation between an application program and a resource manager is very common. It occurs when an application program initiates a transaction, tells the resource manager to enlist in the transaction, and directs the resource manager to do work under the protection of the transaction.
Application Program-to-Resource Manager Transaction Propagation
Many resource managers are implemented like the one shown above. The resource manager is composed of two parts. It includes a resource manager server process (RM) that manages the resource. It includes a resource manager proxy (RM proxy) that implements the application programming interfaces through which application programs invoke resource manager functions. The RM proxy is commonly implemented as a DLL. When the application program invokes a resource manager function, the RM proxy validates the input parameters, marshals the parameters into a request message, and sends the request message to the resource manager. When the resource manager receives the request message, it unmarshals the input parameters and performs the requested operation. When the operation is complete, the resource manager marshals the output parameters into a response message, and sends the response message to the RM proxy. The RM proxy unmarshals the response message and returns the output parameters to the application program.
As the resource manager developer, you are responsible for propagating the transaction from the application program to the resource manager. You choose the syntax of the RM proxy function that the application uses to pass the transaction to your RM proxy. You implement the code to propagate the transaction from the RM proxy to the resource manager. MS DTC provides an OLE Transactions export interface which RM proxy uses to marshal a transaction object. Your RM proxy sends the marshaled form of the transaction object to the resource manager. MS DTC provides an OLE Transactions import interface that your resource manager uses to unmarshal the transaction object. After unmarshaling the transaction object, your resource manager enlists in the transaction.