Skip to content

Latest commit

 

History

History
47 lines (25 loc) · 858 Bytes

File metadata and controls

47 lines (25 loc) · 858 Bytes

Two-Phase Commit (2PC) in Microservice Architecture 📌 Objective

This project demonstrates how to implement and simulate a distributed transaction using the Two-Phase Commit (2PC) protocol across three microservices:

Order Service (localhost:8081)

Payment Service (localhost:8082)

Coordinator Service (localhost:8080)

🏗️ Architecture Overview

  1. Order Service

    Manages order placement.

    Exposes:

     POST /prepare_order
    
     POST /commit_order
    
     POST /rollback_order
    
  2. Payment Service

    Handles payment processing.

    Exposes:

     POST /prepare_payment
    
     POST /commit_payment
    
     POST /rollback_payment
    
  3. Coordinator Service

    Orchestrates the 2PC protocol.

    Steps:

     Sends prepare to services.
    
     If all succeed, sends commit.
    
     If any fail, sends rollback