Slide 1

Slide 1 text

Living without REST: Event-Driven Architecture Edson Yanaga Director of Developer Experience @yanaga

Slide 2

Slide 2 text

Edson Yanaga @yanaga

Slide 3

Slide 3 text

Edson Yanaga @yanaga - Follow: - With a picture of the session - Mention @yanaga - With hashtag #fullstackporto Raffle Rules

Slide 4

Slide 4 text

https://bit.ly/mono2microdb

Slide 5

Slide 5 text

Code is easy, state is hard

Slide 6

Slide 6 text

Join developers.redhat.com 6 HTTP + REST

Slide 7

Slide 7 text

Latency Availability Performance

Slide 8

Slide 8 text

Cache and/or Polling

Slide 9

Slide 9 text

Eventual Consistency

Slide 10

Slide 10 text

Join developers.redhat.com 10 First, a look back at the past…

Slide 11

Slide 11 text

How was data managed 10 years ago?

Slide 12

Slide 12 text

Terrified about Entity Beans

Slide 13

Slide 13 text

Hibernate to the rescue!

Slide 14

Slide 14 text

Replacing XML with @Annotations

Slide 15

Slide 15 text

POJOs as an (Anemic) Domain Model

Slide 16

Slide 16 text

Event Sourcing

Slide 17

Slide 17 text

Join developers.redhat.com 17 ID CUSTOMER_ID BALANCE 1001 990 1000 1002 991 0 1003 991 -500 1004 992 300 Account

Slide 18

Slide 18 text

Join developers.redhat.com 18 ID ACCOUNT_ID TIMESTAMP OP AMOUNT 1 1001 1234567890 C 1000 2 1002 1234567891 C 200 3 1001 1234567900 D 300 4 1001 1234567995 D 150 Transactions

Slide 19

Slide 19 text

Enables you to think in the Events that happened in the system

Slide 20

Slide 20 text

CQS (Command-Query Separation) “Asking a question should not change the answer” (Bertrand Meyer)

Slide 21

Slide 21 text

CQRS (Command Query Responsibility Segregation)

Slide 22

Slide 22 text

Join developers.redhat.com 22 CQRS (Command Query Responsibility Segregation)

Slide 23

Slide 23 text

Join developers.redhat.com 23 ID NAME PHONE ADDRESS BIRTH 1 Burr 222-222-2323 901 South St 12/12/1968 2 Edson 222-333-3434 112 North Dr 03/03/1978 3 John 111-456-4545 666 Iron St 06/06/1966 4 Doe 333-789-7890 777 Boeing Dr 07/07/1977 INSERT INTO CUSTOMER(ID,NAME,PHONE,ADDRESS,BIRTH); SELECT * FROM CUSTOMER;

Slide 24

Slide 24 text

Join developers.redhat.com 24 SELECT ID, NAME, PHONE FROM CUSTOMER; SELECT ID, NAME, ADDRESS FROM CUSTOMER;

Slide 25

Slide 25 text

Join developers.redhat.com 25 CQRS with separate data stores

Slide 26

Slide 26 text

Join developers.redhat.com 26 SELECT ID, NAME, AGE, AVG_BILL FROM CUSTOMER_REPORT_VIEW; SELECT ID, PHONE, LAST_PAYMENT_AMOUNT FROM CUSTOMER_BILLING_VIEW;

Slide 27

Slide 27 text

CQRS & Event Sourcing

Slide 28

Slide 28 text

Join developers.redhat.com 28 ID CUSTOMER_ID BALANCE 1001 990 1000 1002 991 0 1003 991 -500 1004 992 300 Account ID ACCOUNT_ID TIMESTAMP OP AMOUNT 1 1001 1234567890 C 1000 2 1002 1234567891 C 200 3 1001 1234567900 D 300 4 1001 1234567995 D 150 Transactions

Slide 29

Slide 29 text

Join developers.redhat.com 29 ID CUSTOMER_ID BALANCE 1001 990 1000 1002 991 0 1003 991 -500 1004 992 300 Account ID ACCOUNT_ID TIMESTAMP OP AMOUNT 1 1001 1234567890 C 1000 2 1002 1234567891 C 200 3 1001 1234567900 D 300 4 1001 1234567995 D 150 Transactions READ MODEL WRITE MODEL

Slide 30

Slide 30 text

Why CQRS?

Slide 31

Slide 31 text

Performance

Slide 32

Slide 32 text

Distribution Availability Integration Analytics

Slide 33

Slide 33 text

Join developers.redhat.com 33 Canonical Source of Information (Write Data Store)

Slide 34

Slide 34 text

Join developers.redhat.com 34 Canonical Source of Information (Write Data Store) Read Data Store Read Data Store

Slide 35

Slide 35 text

Join developers.redhat.com 35 Canonical Source of Information (Write Data Store) Read Data Store Read Data Store Events Events

Slide 36

Slide 36 text

Join developers.redhat.com 36 Now, Back to the Future!

Slide 37

Slide 37 text

Event-Driven Architecture

Slide 38

Slide 38 text

Events are facts that happened in the system

Slide 39

Slide 39 text

Low-level Events vs Domain-level Events

Slide 40

Slide 40 text

Key Technologies

Slide 41

Slide 41 text

ActiveMQ Artemis Kafka Camel Debezium Quarkus Microprofile

Slide 42

Slide 42 text

Join developers.redhat.com 42 bit.ly/eda-tutorial

Slide 43

Slide 43 text

Join developers.redhat.com Feedback welcome! @yanaga

Slide 44

Slide 44 text

plus.google.com/+RedHat linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHatNews Thank you!