Two Phase Commit :
The Two Phase commit (2pc) consist of 2 steps, Prepare and Commit.
Upon receiving a Commit request from the application, the transaction manager begins the Prepare phase of all the enlisted participants by calling the Prepare method on each enlisted resource, in order to obtain each resource's vote on the transaction.
In the second phase of the transaction, if the transaction manager receives successful prepares from all the resource managers (all the resource managers have invoked Prepared at the end of phase 1), it invokes the Commit method for each resource manager. The resource managers can then make the changes durable and complete the commit.
Each resource participating in a transaction is managed by a resource manager and their actions are coordinated by the transaction manager. We should first know what type of resource we are using , either a durable or a volatile resource.[Durable Resource : database] [Volatile Resource : in Memory structure]
Then we have to implement the IEnlistmentNotification
0 comments:
Post a Comment