state or events? · accounting credit card risk payments notification when there is a withdrawal in...

13
STATE OR EVENTS? WHICH SHALL I KEEP? JakubPilimon

Upload: others

Post on 30-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

STATE OR EVENTS?WHICH SHALL I KEEP?

JakubPilimon

Page 2: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

WHOAMI

SPRING DEVELOPER ADVOCATE AT PIVOTAL

Blogger, Programmer and Trainer @ Bottega

Loves to tackle complex enterprises with: Domain-Driven Design, Test-Driven Development and Spring tools. Being a microservice freak, architecture is his main area of interest too.

When he does not program he rides motorbike, skis or grows his beard.

Also, here is his DZone MVB awarded blog: pillopl.github.io

Co-founder of #dddbyexamples initiative: github.com/ddd-by-examples

JakubPilimon

Page 3: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

LIVE CODING AGENDA

‣ OOP MODELING WITH TDD ‣ EVENT SOURCING ‣ EVENT-DRIVEN ARCHITECTURE

JakubPilimon

Page 4: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

EVENTS

JakubPilimon

Page 5: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

EVENTS AND COMMANDS

JakubPilimon

Page 6: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

INVARIANTS

JakubPilimon

Page 7: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

EFFECT OF EVENTS ON INVARIANTS

JakubPilimon

Page 8: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

JakubPilimon

Page 9: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

ACCOUNTINGCREDIT CARD

RISK PAYMENTS NOTIFICATION

When there is a withdrawal in accounting

Risk has to send information to credit bureau

After doing so, outgoing payment have to be created

And client has to be informed via e-mail

JakubPilimon

Page 10: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

ACCOUNTINGCREDIT CARD

RISK PAYMENTS

NOTIFICATION

CreditBureauNotified

CreditBureau Call

CardWithdrawn PaymentCreated

JakubPilimon

Page 11: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

ACCOUNTINGCREDIT CARD

RISK PAYMENTS

NOTIFICATION

Call Credit BureauCreatePayment

?

CardWithdrawnNotifyClient

JakubPilimon

Page 12: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

ACCOUNTINGCREDIT CARD

?

JakubPilimon

Page 13: state or events? · ACCOUNTING CREDIT CARD RISK PAYMENTS NOTIFICATION When there is a withdrawal in accounting Risk has to send information to credit bureau After doing so, outgoing

QUESTIONS?

JakubPilimon

https://github.com/ddd-by-examples/event-source-cqrs-sample

https://gitlab.com/pilloPl/eventsourced-credit-cards

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