cqrs + event sourcing pyxis v2 - en

19
CQRS + EVENT SOURCING Design to build a bullet proof architectu re

Upload: eric-de-carufel

Post on 05-Dec-2014

838 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Cqrs + event sourcing   pyxis v2 - en

CQRS + EVENT SOURCING

Design to build a bullet proof architecture

Page 2: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc.

/studio

Expertise

Quality

Respect

Agile Big Data custom CQRS Desktop Event

Sourcing Microsoft .NET

C# Scrum Software development Training

Web

we a

re

Page 3: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 3

SPLIT COMMAND AND REQUEST

Page 4: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 4

TRADITIONAL SYSTEM

User interface

Relational database

Business logic

CRUD

Data updates

Page 5: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc.

PROBLEMS

5

Page 6: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 7

WHY ARE WE STILL DOING THIS?

Page 7: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc.

WHY ARE WE STILL DOING THIS?

8

Page 8: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 10

LEAP OF FAITH…

Page 9: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 11

SPLIT COMMAND AND QUERY

User interface

Relational database

Business logic

RequestsCommands

Data updates

TRADITIONAL SYSTEM

Page 10: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 12

CQRS - C O M M A N D A N D Q U E RY R E S P O N S I B I L I T Y S E G R E G AT I O N

User interface

Read model

Command handlers

Requests

Relational database

Commands

Domain

Data updates

Page 11: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 13

Use verbs instead of nouns Ask yourself how the user will use your system Talk in domain language

No simple data editing, more domain actionsSubmit commands

Serializable message Imperative mode Well defined language

Can a command be refused?

CALL TO ACTION

Page 12: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc.

Commands Change system state Asynchronous (for better or worst)

Requests No system state change Denormalized model Distributable (Charding) Scalable At least 90% of system access Performance

14

CQRS

Page 13: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 15

ARE WE THERE YET?

Page 14: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 16

CQRS - C O M M A N D A N D Q U E RY R E S P O N S I B I L I T Y S E G R E G AT I O N

User interface

Read model

Command handlers

Requests

Relational database

Commands

Domain

Data updates

Page 15: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 17

CQRS + EVENT SOURCINGSQL

Domain

User interface

Event Store

Read model

Command handlers

Event h

andle

rs

Denorm

alize

r

Service BUS

Events

XML

HTML

RequestsCommands

Page 16: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 18

Model based on behavior not structureSequential and cumulativeEvents can be played backAppend onlyAny data structure can be built from eventsAudit

EVENT SOURCING

Page 17: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc.

Rolling Snapshot Optimization

Aggregate root Transaction scope Built from events Commands

ApplyEvent

Events Can’t fail No business logic

19

EVENTS

Page 18: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 20

CQRS PIPELINE

User interface Commands Domain changes Events Denormalizer

Event store

Read models

Page 19: Cqrs + event sourcing   pyxis v2 - en

© Pyxis Technologies inc. 21

Remember Events are the only truth Domain is the heart of the system Read models are flexible and volatile

Questions?Eric De Carufel

[email protected] http://blog.decarufel.net http://pyxis-tech.com

THE END