{"id":18217296,"url":"https://github.com/ckswls56/springboot-microservices-distributed-transaction-2pc","last_synced_at":"2026-02-10T06:33:26.496Z","repository":{"id":260745615,"uuid":"881257330","full_name":"ckswls56/springboot-microservices-distributed-transaction-2pc","owner":"ckswls56","description":"springboot 2 phase commit","archived":false,"fork":false,"pushed_at":"2024-11-02T08:54:32.000Z","size":90,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-22T11:50:34.111Z","etag":null,"topics":["2phasecommit","msa","springboot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ckswls56.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-31T07:55:51.000Z","updated_at":"2024-11-02T08:54:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c0a0fa2-1f15-4d45-98ec-066ec59d365f","html_url":"https://github.com/ckswls56/springboot-microservices-distributed-transaction-2pc","commit_stats":{"total_commits":9,"total_committers":3,"mean_commits":3.0,"dds":0.4444444444444444,"last_synced_commit":"19910ebfc32a829166a4677a3c6e702ffa5b0a00"},"previous_names":["ckswls56/springboot-microservices-distributed-transaction-2pc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ckswls56/springboot-microservices-distributed-transaction-2pc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckswls56%2Fspringboot-microservices-distributed-transaction-2pc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckswls56%2Fspringboot-microservices-distributed-transaction-2pc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckswls56%2Fspringboot-microservices-distributed-transaction-2pc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckswls56%2Fspringboot-microservices-distributed-transaction-2pc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ckswls56","download_url":"https://codeload.github.com/ckswls56/springboot-microservices-distributed-transaction-2pc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckswls56%2Fspringboot-microservices-distributed-transaction-2pc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29292097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T03:42:42.660Z","status":"ssl_error","status_checked_at":"2026-02-10T03:42:41.897Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2phasecommit","msa","springboot"],"created_at":"2024-11-03T17:04:34.236Z","updated_at":"2026-02-10T06:33:26.472Z","avatar_url":"https://github.com/ckswls56.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributed Transactions in Microservices Using 2-Phase Commit (2PC)\r\n\r\nThe services in this project are designed with microservice architecture for performing distributed transaction using 2-Phase Commit (2PC).\r\n\r\nEach microservice exposes REST API interfaces that can be accessed through OpenAPI endpoint (/swagger-ui.html)\r\n\r\n## Tech Stack\r\n 1. SpringBoot\r\n 2. Spring Data JPA\r\n 3. MySQL Database\r\n 4. RabbitMQ\r\n\r\n\r\n## Pre-Requisites\r\n 1. RabbitMQ\r\n    - Start RabbitMQ in Docker with command `docker run -d --hostname my-rabbit --name some-rabbit -p 8080:15672 rabbitmq:3-management` [Learn more](https://hub.docker.com/_/rabbitmq)\r\n 2. MySQL Database\r\n    - Start MySQL in Docker with command `docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag` [Learn more](https://hub.docker.com/_/mysql)\r\n\r\n## Usage\r\n 1. Start `discovery-server`. Default port is 8761.\r\n 2. Start all microservices: `transaction-server`, `account-service`, `order-service`, `product-service`\r\n 3. Add some test data to `account-service` and `product-service`\r\n 4. Send order creation request to `order-service` for testing the flow.\r\n\r\n## Architecture\r\n\r\n In this microservice-based architecture design, `discovery-server` plays an important role for registering and retrieving the service instances from a centralize location.\r\n \r\n The `transaction-server` is responsible for maintaining transaction status for multiple services for a given transactionId.\r\n\r\n There are three applications: `order-service`, `account-service` and `product-service`.\r\n \r\n The application `order-service` is communicating with `account-service` and `product-service`. All these applications are using MySQL database as a backend store.\r\n\r\n![Architecutre](./resources/distributed-txn-architecture.png)\r\n\r\n\r\n## Distributed Transaction Flow\r\n\r\n\r\n\r\n![Application Flow](./resources/distributed-txn-flow.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckswls56%2Fspringboot-microservices-distributed-transaction-2pc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fckswls56%2Fspringboot-microservices-distributed-transaction-2pc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckswls56%2Fspringboot-microservices-distributed-transaction-2pc/lists"}