Hemant Bothra 310ae50248 Issue 989 final-batch (#1119)
* Adding support for maven assembly plugin to generate executable jar with all dependencies in built

* Merge branch 'master' into issue-989

# Conflicts:
#	abstract-document/pom.xml
#	pom.xml

* Adding maven assemly plugin for projects with name A

* Update in format as per checkstyle, i.e. Spcae in place of tab with size of 2

* batch set - 2 having all project with B and C

* issue-989 d-e-f

* fixing eip pom and adding g-h-i-l-m-n Skipping naked object as it seems it doesn't have main method, will consider this at end

* Adding for O and P projects Skipping Object-Mother as we don't have main method for same.

* Final batch
2019-12-29 14:41:21 +02:00
..
2019-11-13 21:01:10 +00:00
2019-12-29 14:41:21 +02:00

layout, title, folder, permalink, categories, tags
layout title folder permalink categories tags
pattern Saga saga /patterns/saga/ Concurrency
Cloud distributed

Also known as

This pattern has a similar goal with two-phase commit (XA transaction)

Intent

This pattern is used in distributed services to perform a group of operations atomically. This is an analog of transaction in a database but in terms of microservices architecture this is executed in a distributed environment

Explanation

A saga is a sequence of local transactions in a certain context. If one transaction fails for some reason, the saga executes compensating transactions(rollbacks) to undo the impact of the preceding transactions. There are two types of Saga:

  • Choreography-Based Saga. In this approach, there is no central orchestrator. Each service participating in the Saga performs their transaction and publish events. The other services act upon those events and perform their transactions. Also, they may or not publish other events based on the situation.

  • Orchestration-Based Saga In this approach, there is a Saga orchestrator that manages all the transactions and directs the participant services to execute local transactions based on events. This orchestrator can also be though of as a Saga Manager.

Class diagram

alt text

Applicability

Use the Saga pattern, if:

  • you need to perform a group of operations related to different microservices atomically
  • you need to rollback changes in different places in case of failure one of the operation
  • you need to take care of data consistency in different places including different databases
  • you can not use 2PC(two phase commit)

Credits