23 Kasım 2021 Salı

Yazılım Mimarisi - Event Driven Architecture (EDA) With Event-Carried State Transfer pattern

Event-Carried State Transfer Pattern Nedir?
Açıklaması şöyle
As the name suggests, the main characteristic for the event-carried state transfer pattern is that the events contain state, which is quite different from notification events that just contain an identifier to retrieve state from the producer.
Örnek
Şöyle yaparız
{
  "specversion" : "1.0",
  "type" : "com.example.orderPlaced",
  "order" : {
    "id" : "A001-1234-1234",
    "time" : "2020-12-15T00:00:00Z",
    "products" : [{
      "id" : "1234321",
      "name" : "eBook Seven Languages in Seven Weeks",
      "price" : 25.00,
      "quantity" : 1
    }]
  }
}
Açıklaması şöyle. Burada önemli olan event'in içinde işlenmesi için gerekli alanların da olması. Böylece işleyen kod gidip tekrar çağrı yapıp bu bilgileri toparlamak zorunda kalmıyor
Including state in events eliminates the need for the consumer to make a call back to the producer to retrieve state. Instead, consumers build a private replica of state by storing the state from events they consume.
Fat Event vs Delta Event
Açıklaması şöyle
In many publications an event that contains any state is referred to as a fat event. That would make all events that leverage the event-carried state transfer pattern fat events. Some authors, including myself, make distinctions between delta events and fat events. Delta events contain just the properties that changed, so just enough detail, nothing more.


Hiç yorum yok:

Yorum Gönder