Building event-driven systems

@JakubPilimon

jakub.pilimon@gmail.com

github.com/pilloPl

@JakubPilimon
Software developer/architect
Trainer @ Bottega IT Minds
pillopl.github.io


OOP / DDD / TDD / Architecture

Event sourcing as a persistence mechanism

CQRS

Event-driven systems

Spring Cloud Stream

Achitectural patterns and challenges

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

User

Service

UI

When user is deactivated, payments has to be cancelled


when payment is cancelled, shipments have to be cancelled 

and e-mail has to be sent

 

Communicator

User

Service

Accounting

UserDeactivated

PaymentCancelled

Shipping

ShipmentsCancelled

User

Service

?

UserDeactivated

CancelPayment

CancelShipment

SendEmail

Payments

Shipping

Communicator

Thank you!

@JakubPilimon

jakub.pilimon@gmail.com

github.com/pilloPl

Made with Slides.com