Presentation is loading. Please wait.

Presentation is loading. Please wait.

© Copyright 2010 Imaginet. All rights reserved. Distributed Architecture Patterns CQRS & Event Sourcing.

Similar presentations


Presentation on theme: "© Copyright 2010 Imaginet. All rights reserved. Distributed Architecture Patterns CQRS & Event Sourcing."— Presentation transcript:

1 © Copyright 2010 Imaginet. All rights reserved. Distributed Architecture Patterns CQRS & Event Sourcing

2 © Copyright 2010 Imaginet. All rights reserved. Dylan Smith Senior ALM Consultant Application Lifecycle Expert PROFILE Dylan is an ALM (Application Lifecycle Management) consultant for Imaginet where he spends his time helping teams become more successful at delivering software. Dylan has over a decade experience designing and architecting mission critical applications. In the past 5 years Dylan has focused on agile development techniques and practices. He has led the shift to agile and lean development practices across multiple teams, projects and companies. “CQRS+ES differs from most design patterns in that it provides clear business benefits in addition to the obvious technical benefits.”

3 © Copyright 2010 Imaginet. All rights reserved. Overview Review Typical Architecture What is CQRS? What is Event Sourcing? CODE !!! Benefits / Concerns

4 © Copyright 2010 Imaginet. All rights reserved. Data Storage Domain Object Application Services Remote Facade Client Request DTO DTO Returned Request DTO DTO Returned Send DTO Status Returned Send DTO Status Returned Repository Domain Object Typical Distributed Architecture

5 © Copyright 2010 Imaginet. All rights reserved. Data Storage Domain Object Command Handlers Remote Facade Client Request DTO DTO Returned Request DTO DTO Returned Send Command Ack/Nak Response Send Command Ack/Nak Response Repository Domain Object Query Handlers Remote Facade Data Storage CQRS

6 © Copyright 2010 Imaginet. All rights reserved. Sample Read Data Model

7 © Copyright 2010 Imaginet. All rights reserved. Purchase Order Line Items (n) Shipping Information

8 © Copyright 2010 Imaginet. All rights reserved. Order Created Added 4 Hats Added 2 Shirts Shipping Info Added

9 © Copyright 2010 Imaginet. All rights reserved. Event Store Domain Object Command Handlers Remote Facade Client Request DTO DTO Returned Request DTO DTO Returned Send Command Ack/Nak Response Send Command Ack/Nak Response Repository Domain Object Query Handlers Remote Facade Data Storage Event Bus CQRS + ES Event Handlers

10 © Copyright 2010 Imaginet. All rights reserved. Event Store Data Model

11 © Copyright 2010 Imaginet. All rights reserved.

12 Command

13 © Copyright 2010 Imaginet. All rights reserved. Event

14 © Copyright 2010 Imaginet. All rights reserved. Command Handler

15 © Copyright 2010 Imaginet. All rights reserved. Domain Object

16 © Copyright 2010 Imaginet. All rights reserved. Event Handler

17 © Copyright 2010 Imaginet. All rights reserved. Query Handler

18 © Copyright 2010 Imaginet. All rights reserved. Data Transfer Object

19 © Copyright 2010 Imaginet. All rights reserved.

20 vs

21 © Copyright 2010 Imaginet. All rights reserved. Scalability

22 © Copyright 2010 Imaginet. All rights reserved.

23

24 Sample Unit Test

25 © Copyright 2010 Imaginet. All rights reserved. Sample Unit Test #2

26 © Copyright 2010 Imaginet. All rights reserved.

27

28 Client Domain Read Model Events Commands DTOs

29 © Copyright 2010 Imaginet. All rights reserved.

30

31

32 NoSQL Databases

33 © Copyright 2010 Imaginet. All rights reserved. Other Topics (Time Permitting) Event Versioning When to use CQRS/ES? Using CQRS or ES separately Concurrency Eventual Consistency Asynchronous Commands

34 © Copyright 2010 Imaginet. All rights reserved. Recommended Reading

35 © Copyright 2010 Imaginet. All rights reserved. Sample Code Super Simple CQRS Example github.com/gregoryyoung/m-r NCQRS ncqrs.org The CQRS Kitchen thecqrskitchen.codeplex.com Lokad-CQRS code.google.com/p/lokad-cqrs Fohjin github.com/MarkNijhof/Fohjin

36 © Copyright 2010 Imaginet. All rights reserved. Summary CQRS – Enables specialization: of design/architecture, and people Event Sourcing – All about capturing intent and not losing data

37 © Copyright 2010 Imaginet. All rights reserved. Questions?


Download ppt "© Copyright 2010 Imaginet. All rights reserved. Distributed Architecture Patterns CQRS & Event Sourcing."

Similar presentations


Ads by Google