Refactoring to Event Sourcing

@JakubPilimon

jakub.pilimon@gmail.com

github.com/pilloPl

@JakubPilimon
Software Consultant

Currently @ Vattenfall IT Services
Trainer @ Bottega IT Minds
pillopl.github.io

OOP / DDD / TDD / Architecture

Why events?

  • Inversion of Control
  • Event Sourcing
  • Event Driven Architecture

Live coding agenda

  • Aggregate modeling
  • Event Sourcing
  • Event Driven Architecture

1. State = Initial State + UserCreated(name: John) applied
new User() and u.name = John
State: user {name = John}

2. State = Previous (after 1) State + UserActivated applied
u {name = John} and u.active = true
State: user {name = John, active = true}

3. State = Previous (after 2) State + UserNameChanged applied
user { name = John, active = true} and u.name = Barry
State:  user {name = Barry, active = true}

...

1. insert into users_info ...

 

2. update user set active = true where id ...

 

3. update user set name = Barry where id ...

 

4 update user set active = false where id ...

 

 

...

message broker

Producer

Consumer

Thank you!

 

@JakubPilimon

jakub.pilimon@gmail.com

https://github.com/pilloPl/webinar-process-manager

https://github.com/pilloPl/webinar-events

Devternity

By Jakub Pilo