When an MSMQ application performs a transaction, it must work with all the transactional services (Microsoft® Distributed Transaction Coordinator [MS DTC] and all resource managers) needed to complete the transaction. This includes all the resource mangers associated with the transaction, including MSMQ and MS DTC as the transaction manager.
From a system perspective, the process for performing a transaction starts with the transaction application asking MS DTC or MSMQ for a new transaction object. Once a transaction object is available, the application can then make any number of transactional calls, as well as any number of non-transactional calls, to all the resource managers needed by the application.
It is the application's responsibility to check the return values of all the functions called. If all calls succeed, the application can call the Commit method of the transaction object. This does not mean the transaction is committed; it only means that the application is ready to commit.
MS DTC now starts a two-phase commit procedure, asking each participating resource manager to prepare itself and to inform MS DTC if it is ready to commit. If all the resource managers commit, MS DTC commits the transaction. If even one resource manager does not commit, the transaction is aborted.
All this activity by MS DTC is invisible to the transaction application. The application only sees the return value of the Commit function it calls. When a successful Commit is returned to the application, the transaction is completed.
Note When a transaction is completed, it does not mean the work is completed. When the transaction manager commits the transaction, it only means that each resource manager guarantees that it will do its part of the transaction at some later time.