Git Product home page Git Product logo

saga-choreography's Introduction

SAGA Pattern

Bu paternde her service bağımsız bir service üzerinde çalıştığı için o service üzerinde verinin güncellendiği transectionlardır. Bu yönteme göre transection dış etki ile (butone basma vs) tetiklenir ve artık sonraki tüm transectionlar bir önceki transectionun başarılı durumuna göre devam eder. Herhangi bir transectionda meydana gelecek bir hata ile tüm transectionlar iptal edilerek Atomicity prensibine bağlılık saplanmış olunur. Sagayı uygulamak için 2 farklı yöntem vardır. Bunlar Event/Choreography ve Commend/Orchestration dur.

  • Event/Choreography Bu yöntem ile bir transection event fırlatır ve diğer transectionlar evente göre kendi locallerinde çalışır. Her service bir öncekinin işini bitirip haber vermesini bekler. Son transection gerçekleştiğinde işlem sonlandırılmış olur. Tramsectionlar birbirlerinden izoledir ve birbirleri hakkında bilgi sahibi olmak zorunda değildirler. Serviceler ve transectionlar arttıkça yönetilebilirliği zorlaşmaktadır.

Senaryo;

  • Sipariş Servisi çalıştırılır.
  • Sipariş oluşturuldu eventi fırlatılır.
  • Bu eventi dinleyen stok servisi tetiklenir.
  • Stok yeterli ise ödeme servisine event fırlatılır. Stok yatersiz ise sipariş servisine event fırlatılıp siparişin durumu güncellenir.
  • Ödeme servisinden ödeme alındı yada hata eventi fırlatılır.
  • Ödeme başarılı ise sipariş serviste siparişin durumu tamamlandıya çekilir.
  • Ödemenin başarısız olması durumunda Stok service ve Sipariş servise event fırlatılır. Stok eski haline getirilip siparişin durumu güncellenir.

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.