Giter Site home page Giter Site logo

heidsoft-java / springboot-microservices-distributed-transaction-2pc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anil-jaglan/springboot-microservices-distributed-transaction-2pc

0.0 0.0 0.0 84 KB

Spring Boot microservices to perform distributed transaction using 2-Phase Commit (2PC)

License: MIT License

Java 100.00%

springboot-microservices-distributed-transaction-2pc's Introduction

Distributed Transactions in Microservices Using 2-Phase Commit (2PC)

The services in this project are designed with microservice architecture for performing distributed transaction using 2-Phase Commit (2PC).

Each microservice exposes REST API interfaces that can be accessed through OpenAPI endpoint (/swagger-ui.html)

Tech Stack

  1. SpringBoot
  2. Spring Data JPA
  3. MySQL Database
  4. RabbitMQ

Pre-Requisites

  1. RabbitMQ
    • Start RabbitMQ in Docker with command docker run -d --hostname my-rabbit --name some-rabbit -p 8080:15672 rabbitmq:3-management Learn more
  2. MySQL Database
    • Start MySQL in Docker with command docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag Learn more

Usage

  1. Start discovery-server. Default port is 8761.
  2. Start all microservices: transaction-server, account-service, order-service, product-service
  3. Add some test data to account-service and product-service
  4. Send order creation request to order-service for testing the flow.

Architecture

In this microservice-based architecture design, discovery-server plays an important role for registering and retrieving the service instances from a centralize location.

The transaction-server is responsible for maintaining transaction status for multiple services for a given transactionId.

There are three applications: order-service, account-service and product-service.

The application order-service is communicating with account-service and product-service. All these applications are using MySQL database as a backend store.

Architecutre

Distributed Transaction Flow

Application Flow

springboot-microservices-distributed-transaction-2pc's People

Contributors

anil-jaglan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.