Open MateuszNaKodach opened 1 year ago
Story telling sie psuje, kiedy wprowadzamy agregat.
Broni inwariantów, a jeszcze jest konceptem biznesowym.
Course Aggregate
Storage:
Update Course Capacity - musimy ladowac caly
Event Source - ladujemy wszystkie eventy
Jak bysmy caly system zrobili, to wtedy nie ma concurrency.
To jest słaby przykłąd, bo tutaj nie ma żadnej reguły:
Alternatywne rozwiazanie:
Nowa regula: student nie moze dolaczyc do wiecej niz 10 kursów:
Podobne eventy dla niego:
Mozemy miec czlowieka, ktory patrzy na stan systemu i podejmuje decyzje i tak samo czesc software, ktora tez podejmuje decyzje.
Odczytam tylko konieczne eventy... Bedziemy dzielic eventy na certain query:
To co pozwoliło nam pozbyć się agregatu, conditional append: zamiast samego append:
No new events matching the query after the last event. Decision events doesnt changed..
Mamy eventy rozne (bo rozne agregaty), ale one reprezentuja ten sam fakt przykładowo:
W story telling to jest jedno:
Co mozemy zrobic? Dodajemy "domain indentifiers" - tagi:
Mamy 1 event, ale 2 pointers.
Jak to teraz dziala?
Bierzemy z 1 stream te 2 eventy. Sprawdza 2 business rules:
Domain Event:
Czy ten przykłąd, który podają nie robi tak, że teraz w jednym stream mamy ten kurs i zapisy WSZYSTKICH na WSZYSTKIe kursy?
Tutaj chyba nie maja znaczenia streamy w ogóle, tylko domain identifier.
Nie bylo potrzeba Sagi teraz. Ale jesli bediemy mieli wiele Contextów, to oczywiscie jest to potrzebne.
Jak sie odbywa refaktor granic:
The aggregate is dead:
Clustering commands into logical groups and delegate to the same model the exeution. Difference - this is model needs to be isolated from each others.
killing the aggregate = admit the possiblity of contaiminations, bez psucia consistency - dynamic approach
The Aggregate is dead. Long live the Aggregate! by Sara Pellegrini & Milan Savic @ Spring I/O 2023 https://www.youtube.com/watch?v=IgigmuHHchI
The aggregate is dead. Long live the aggregate! (Sara Pellegrini & Milan Savić) https://www.youtube.com/watch?v=0iP65Durhbs
https://sara.event-thinking.io/2023/04/kill-aggregate-chapter-1-I-am-here-to-kill-the-aggregate.html
https://www.youtube.com/watch?v=DhhxKoOpJe0&t=150s
contention - co to znaczy w tym kontekscie?