Skip to content

An ecommerce system implement with Saga Choreography pattern

License

Notifications You must be signed in to change notification settings

TranHuyZIT/saga-choreography

Repository files navigation

Distributed Transactions Using Saga Pattern - Choreography

Introduction

This project is a sample implementation of the Saga Pattern using Choreography. It is a simple application that allows users to create a new order and pay for it. The application is implemented using Spring Boot and Spring Cloud Stream. The communication between the services is done using Apache Kafka.

What is Saga Pattern?

  • The Saga Pattern is a pattern for managing distributed transactions. It is a sequence of local transactions.
  • Each local transaction updates the database and publishes a message or event to trigger the next local transaction in the saga.
  • If a local transaction fails because it violates a business rule then the saga executes a series of "compensating transactions" that undo the changes that were made by the preceding local transactions.
  • For example, you can take a look at the image below:

Saga Patern

Getting Started

Prerequisites

You need to have the following installed on your machine:

Running the Application

First start the Kafka cluster, Database and administation tools by running the following command:

docker-compose up -d

Then start each services by running the following command:

./mvnw spring-boot:run

About

An ecommerce system implement with Saga Choreography pattern

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published