IEnlistmentNotification Interface

IEnlistmentNotification Interface

 

Describes an interface that a resource manager should implement to provide two phase commit notification callbacks for the transaction manager upon enlisting for participation.

Namespace:   System.Transactions
Assembly:  System.Transactions (in System.Transactions.dll)

type IEnlistmentNotification = interface end

NameDescription
System_CAPS_pubmethodCommit(Enlistment)

Notifies an enlisted object that a transaction is being committed.

System_CAPS_pubmethodInDoubt(Enlistment)

Notifies an enlisted object that the status of a transaction is in doubt.

System_CAPS_pubmethodPrepare(PreparingEnlistment)

Notifies an enlisted object that a transaction is being prepared for commitment.

System_CAPS_pubmethodRollback(Enlistment)

Notifies an enlisted object that a transaction is being rolled back (aborted).

In order for a resource manager to participate in a transaction, it must enlist in the transaction through the transaction manager. The Transaction class defines a set of methods whose names begin with Enlist that provide this functionality. The different Enlist methods correspond to the different types of enlistment that a resource maanger may have.

This class describes an interface that a resource manager should implement to provide two phase commit notification callbacks for the transaction manager upon enlisting for participation. For each resource manager's implementation of the IEnlistmentNotification interface, you should enlist it using the M:System.Transactions.Transaction.EnlistVolatile method or the M:System.Transactions.Transaction.EnlistDurable method of the Transaction class, depending on whether your resource is volatile or durable. For more information on enlistment and 2PC, see 7bf66ce7-4190-4910-89d7-df4ad43e9f31 and 74b3cfe1-d33a-45b8-91f4-dfd6f6598c4d respectively.

The transaction manager notifies the enlisted object at different phases of the Two Phase Commit Protocol by the following methods.

Method

Description

Prepare

This method of an enlisted object is used as a callback by the Transaction Manager during the first phase of a transaction, when the transaction manager asks participants whether they can commit the transaction.

Commit

This method of an enlisted object is used as a callback by the Transaction Manager during the second phase of a transaction if the transaction is commited.

Rollback

This method of an enlisted object is used as a callback by the Transaction Manager during the second phase of a transaction if the transaction is aborted (that is, rolled back).

InDoubt

This method of an enlisted object is used as a callback by the Transaction Manager during the second phase of a transaction if the transaction is in doubt.

System_CAPS_noteNote

You should be aware that notifications might not be sent sequentially, or in a particular order.

The following example shows an implementation of this interface, as well as enlisting the object as a participant in a transaction using the M:System.Transactions.Transaction.EnlistVolatile method.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft