TransactionManager.Reenlist(Guid, Byte[], IEnlistmentNotification) Method

Definition

Reenlists a durable participant in a transaction.

public static System.Transactions.Enlistment Reenlist (Guid resourceManagerIdentifier, byte[] recoveryInformation, System.Transactions.IEnlistmentNotification enlistmentNotification);

Parameters

resourceManagerIdentifier
Guid

A Guid that uniquely identifies the resource manager.

recoveryInformation
Byte[]

Contains additional information of recovery information.

enlistmentNotification
IEnlistmentNotification

A resource object that implements IEnlistmentNotification to receive notifications.

Returns

An Enlistment that describes the enlistment.

Exceptions

recoveryInformation is invalid.

-or-

Transaction Manager information in recoveryInformation does not match the configured transaction manager.

-or-

RecoveryInformation is not recognized by System.Transactions.

RecoveryComplete(Guid) has already been called for the specified resourceManagerIdentifier. The reenlistment is rejected.

The resourceManagerIdentifier does not match the content of the specified recovery information in recoveryInformation.

Remarks

Important

Calling this method with untrusted data is a security risk. Call this method only with trusted data. For more information, see Validate All Inputs.

A resource manager facilitates resolution of durable enlistments in a transaction by reenlisting the transaction participant after resource failure.

The resourceManagerIdentifier parameter is used to consistently label the participant of a transaction in the event of a resource failure. When calling the Reenlist method, the resource manager must provide the same resourceManagerIdentifier as it used when it originally called the EnlistDurable method during enlistment, or a TransactionException is thrown.

When a participant is reenlisted using this method, the phase 2 methods of IEnlistmentNotification that correspond to the transaction's outcome (that is, Commit, Rollback, or InDoubt ) are called as appropriate.

After the participants are successfully reenlisted, you should then call RecoveryComplete to complete the recovery.

You should only call this method when a resource manager restarts from failure. In addition, you should only reenlist unresolved transactions logged by a resource manager during the initial Prepare phase of a two-phase commit. Any attempt to call this method at invalid times can produce erroneous results.

If the transaction manager fails, and your resource manager performs recovery only a short time after you called the Prepared method on an enlistment in phase 1 of the Two-Phase Commit protocol, your resource manager might either receive the InDoubt or Rollback callback.

For more information on recovery, see Performing Recovery.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1