Microservices Saga Pattern
Introduction
One of the main concerns in the microservices architecture is distributed transaction management because a single transaction from user can span across various services. It gets more complicated when the transaction fails and it should be rolled back in all the previous engaged services. One of the patterns which has been introduced for solving this concern is named Saga.
This project is a sample of the Saga pattern which I implemented for my colleages at ISC in order to give them a better picture of distributed transaction management in microservices architecture.
Technical Overview
In this project a distributed transaction takes place between two services named tweet and mail. An action in tweet service needs to be confirmed by the mail service. If mail service does not confirm the action, the compensation transaction begins. Two services talk to each other using Apache Kafka and use a MySQL database. They both provide REST API, and Docker is used for virtualizing two services and the database. The hexagonal architecture of the project is presented in the slider above.
Languages/Technologies Used
Technology | Usage |
---|---|
Java is used for developing backend services | |
Spring Boot framework is used for developing backend services based on microservices architecture | |
Spring frameworks, including Spring Cloud, Spring Data, etc. are used for developing backend services. | |
Apache Kafka is a streaming platform for exchanging messages between mail and tweet servies. | |
Docker is used for virtualization and containerizing services, including backend and frontend services. | |
Git is used for version control |
Project information
- Category: Web
- Project date: Winter 2018
- Github Repository: https://github.com/abradat/microservice-saga
Project Description
Saga is a pattern for managing distributed transactions in microservices.