Git Product home page Git Product logo

sample-spring-microservices-transactions's Introduction

Distributed transactions in microservices Demo Project Twitter

In this project I'm demonstrating a simple architecture of microservices that perform distributed transactions. The example application applications are simple Spring Boot app that expose some HTTP endpoints for CRUD operations and connects to Postgres using Spring Data JPA.

Getting Started

All the examples are described in a separated articles on my blog. Here's a full list of available examples:

  1. Rollback or confirmation of distributed transaction across order-service, account-service and product-service. A detailed guide may be find in the following article: Distributed Transaction in Microservices with Spring Boot

Usage

  1. Start discovery-server. It is available on port 8761.
  2. Start RabbitMQ on Docker with command docker run -d --name rabbit -h rabbit -p 5672:5672 -p 15672:15672 rabbitmq:3-management
  3. Start transaction-server
  4. Start Postgres on Docker with command docker run -d --name postgres -p 5432:5432 -e POSTGRES_USER=trx -e POSTGRES_PASSWORD=trx123 -e POSTGRES_DB=trx postgres
  5. Start microservices: account-service, product-service and order-service. The app order-service is listening on port 8080.
  6. Add some test data to product-service and account-service
  7. Send some tests requests. For example: $ curl http://localhost:8080/orders -H "Content-Type: application/json" -d "{\"productId\":1, \"count\":10, \"customerId\":1}"

sample-spring-microservices-transactions's People

Contributors

piomin 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.