Transaction Outcome Events
Applications can use the ITransactionOutcomeEvents interface to receive an asynchronous notice of a transaction's outcome. The application implements the methods in the ITransactionOutcomeEvents interface and registers the interface with the connection point mechanism. When MS DTC determines the outcome of a transaction, it calls the appropriate method in the ITransactionOutcomeEvents interface to inform the application of the outcome.
The ITransactionOutcomeEvents interface has the following methods.
|
|
|
|
Method |
Description |
ITransactionOutcomeEvents
::Committed |
Raised for committed transactions. |
ITransactionOutcomeEvents
::Aborted |
Raised for aborted transactions. |
ITransactionOutcomeEvents
::HeuristicDecision |
Raised when one of the participants in the transaction makes an heuristic decision to commit or abort the transaction. Heuristic decisions are not supported in the current release. |
ITransactionOutcomeEvents
::InDoubt |
Raised when the application calls either Commit or Abort and then loses communication with the commit coordinator before completion of phase one of the two-phase commit protocol. |
To use transaction outcome events, follow these steps
-
Implement the methods in the ITransactionOutcomeEvents interface.
-
Each time you initiate a new transaction, call the QueryInterface method on the transaction object with an riid of IID_IConnectionPointContainer to obtain the IConnectionPointContainer interface.
-
Call the IConnectionPointContainer::FindConnectionPoint method with an riid of IID_ITransactionOutcomeEvents to obtain the IConnectionPoint that supports the ITransactionOutcomeEvents sink.
-
Call the Release method on the IConnectionPointContainer interface.
-
Call the Advise method on the IConnectionPoint interface and pass the pointer to the ITransactionOutcomeEvents interface that you implemented. Advise will return a Connection Key.
-
When the transaction commits or aborts, MS DTC will call the appropriate ITransactionOutcomeEvents method to report the transaction's outcome.
-
Call the Unadvise method on the IConnectionPoint interface and pass the Connection Key that was returned from Advise.
-
Call the Release method on the IConnectionPoint interface.
-
Call the Release method on the transaction object.
You must repeat steps 2 through 9 for each transaction for which you require transaction outcome notification.
For more information about:
-
The ITransactionOutcomeEvents interface and its methods, see Chapter 5, "MS DTC Programmer's Reference."
-
The OLE events architecture, see IConnectionPoint in the Microsoft Developer Network (MSDN) Development Library.
-