2. What’s ahead Real quick overview of CQRS Some related patterns Event sourcing Pub-sub Experience Report from 2 CQRS projects (WIP) 1 Enterprise IT app in Insurance 1 cloud based app in Education
3.
4.
5. Separate methods for Commands & Queries From: Object-Oriented Software Construction, 2nd Edition by Bertrand Meyer
9. ID : 123 Name : The Art of War Author: Sun Tzu ISBN: 1234ABCD5678 Event: BookIsbnChanged NewValue: 4321DCBA8765
10. …there are times when we don't just want to see where we are, we also want to know how we got there http://martinfowler.com/eaaDev/EventSourcing.html
12. Experience Report 1: Application to be used to let Brokers create quotes and policies High Volume, low margin Integration with legacy app for reporting Legacy (& painful) Database
13. Document Generator Gateway DMS Policy Store Rating Data Reference Data Legacy Rating Engine Reports Reference Data Documents Domain & Plugins Handlers Façade – API (MVC) Client Web App
14. Experience Report 2: Users are regional reps of an exam board Globally located Integrate with back office systems Business benefit Allow business to grow with growing costs Provide a better service to customers
15. Main Event Store Reports Reports Handler API Handler Query API Domain API Domain Smart Client Web Client
16. Now go see: Videos CQRS E-VANs - Greg Young, UdiDahan, Mark Nijhof Event Sourcing - InfoQ Ian Cartwright Blogs Greg Young (CodeBetter) UdiDahan Mark Nijhof (Elegant Code) Code Samples/Frameworks (all Event Sourced) http://github.com/MarkNijhof/Fohjin (.NET) http://github.com/erikrozendaal/cqrs-lottery (Java) http://code.google.com/p/axonframework/ (Java)
Hinweis der Redaktion
Not the opinions of my employer
Queries should not have side effects (change *observable* state) – state that can be observed by a clientFilling a cache is OKCommands should be void
So at it’s simplest CQS represents a form of CQRSSeparate sub-systems for C & Q – but still one databaseSeparate systems for C & Q, with multiple databases – persisting snapshots of current stateSeparate system for C & Q with event sourcing & multiple databases
Capturing all state changes made to an object as Event ObjectsAdvantages:Rebuild state from eventsTemporal Queries – rebuild state to a point in timeDebugging – replay events that led to a problemSnapshotsDisadvantagesCan look a bit magical
2 Phase State Transition
Transactional boundary around writing policiesPolicy Store holds documents
Events recorded per AREvents Published to LondonWhen ready London can merge in eventsExisting data started from snapshots