Event Sourcing

2,697 views
2,445 views

Published on

Event Sourcing Tech Talk by Derek Comartin @ Windsor Hackforge

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,697
On SlideShare
0
From Embeds
0
Number of Embeds
1,719
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Event Sourcing

  1. 1. Event Sourcing @derek_comartin CodeOpinion.com
  2. 2. Agenda ● Typical Data Persistence ● Overview ● Events ● Why? ● Queries ● Drawbacks
  3. 3. Typical Data Persistence ● Maintain current state ● Concurrent users, data update conflicts. ● Auditing
  4. 4. Overview ● Old concept ● Using already (transaction log) ● Capture Intent ● Event = State Change ● Sequence of Events ● Append Only
  5. 5. Events ● Describes state change ● Past tense ● Source of truth ● Audit log
  6. 6. Event Stream Started Shopping Added T-Shirt Added Socks Removed Socks Added Coupon
  7. 7. Event StartedShopping { CartId: f5a7f55d-1e33-440c-836c-ea50fc59a274, CustomerId: f98902b3-e8cf-4b7a-b561-5e39a06b5e0c, Date: 2014-01-03 15:36:08, } AddedSocksToShoppingCart { CartId: f5a7f55d-1e33-440c-836c-ea50fc59a274, ProductId: ed00fa0b-6412-4cc6-bbac-14702bfeff3f, Quantity: 1, }
  8. 8. Why? ● Captures business intent ● Transaction & Audit log ● Build/Rebuild to any model ● Debugging ● Integration with other systems
  9. 9. Queries ● Generate Read Model from Events ● Secondary Data Source required ● Eventual Consistency Started Shopping Added T-Shirt Added Socks Removed Socks Added Coupon Any model you can think of! Cart Table CartId ProductId Quantity Denormalized Table CartId CustomerName ProductId Quantity Price
  10. 10. CQRS/ES Data Storage Domain Object Domain Object Command Handlers Client Command DTO Message Queue Read Layer Facade Query DTO Event Storage Events Message Queue Event Handlers Data Storage
  11. 11. Drawbacks ● Multiple Models / Data Sources ● Versioning ● Performance ● Maturity / Public Knowledge

×