Top Banner
Materialized view Event sourcing CQRS Eventual consistency Saga 1
28

Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

Jun 20, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

■ Materialized view

■ Event sourcing

■ CQRS

■ Eventual consistency

■ Saga

1

Page 2: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

●●●●●●

Page 3: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

●●●

Page 4: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 5: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

●●●

A B

A B

Page 6: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

ř ů

ž š ěů

ž

Page 7: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 8: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 9: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

●●

Page 10: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

public class OrderPlacedEvent implements Event {

UUID eventId;

UUID srcId;

List items;

public OrderPlacedEvent(UUID SrcId, List<Item>

items){

//set instance variables

}

}

public class RetrievePaymentCommand implements Command{

UUID commandId;

String accountId;

BigDecimal amount;

public RetrievePaymentCommand(String accountId,

BigDecimal amount ){

//set instance variables

}

public void execute(){

//code to be executed

}

}

Order system Payment system

Page 11: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

●●

Page 12: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 13: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 14: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 15: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 16: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

●●

●●

Page 17: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 18: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 19: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 20: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

Transakce = sekvence operací (insert, update, delete...), které tvoří logický celek

konzistentní stav | |konzistentní stav

commit

nekonzistentní mezistav

Rollback on error

Page 21: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

Koordinátor transakce

Databáze 1 Databáze 2

Koordinátor transakce

Databáze 1 Databáze 2

●●●●

Page 22: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

Monolitické relační systémy

(ACID)

Homogenní distribouvané

systémy(ACID + 2PC)

Heterogenní distribouvané

systémy(Micro services +

eventual consistency)

Heterogenní distribouvané

systémy(NOSQL + PAC)

1. 2.

3.

4.

Page 23: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 24: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 25: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

Sága a eventual consistency

Page 26: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID

Sága a eventual consistency

Page 27: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID
Page 28: Materialized view Event sourcing CQRS Eventual ......Event sourcing CQRS Eventual consistency Saga 1 A B A B ř ů žšě ů ž public class OrderPlacedEvent implements Event {UUID