74
SIDNEY SHEK ARCHITECT ATLASSIAN @SIDNEYSHEK Event sourcing and CQRS from the trenches

Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

SIDNEY SHEK • ARCHITECT • ATLASSIAN • @SIDNEYSHEK

Event sourcing and CQRSfrom the trenches

Page 2: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Universe of Users

Id Name Username APIKey1 Homer homer d0a2 Bart bart f003 Maggie maggie baa

users

Page 3: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Universe of Users

Id Name Username APIKey1 Homer homer d0a2 Bart bart f003 Lisa Jr maggie baa

users

Page 4: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Universe of Users

Id Name Username APIKey1 Homer homers d0a2 Bart bart f003 Lisa Jr maggie baa

users

Page 5: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Universe of Users

Id Name Username APIKey1 Homer homer d0a2 Bart bart f003 Maggie maggie baa

users

events

Seq Event Time

123 SetUsername(3, Maggie) 0

Page 6: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Universe of Users

Id Name Username APIKey1 Homer homer d0a2 Bart bart f003 Lisa Jr maggie baa

users

events

Seq Event Time

123 SetUsername(3, Maggie) 0

124 SetName(3, Lisa Jr) 10

Page 7: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Universe of Users

Id Name Username APIKey1 Homer homers d0a2 Bart bart f003 Lisa Jr maggie baa

users

events

Seq Event Time

123 SetUsername(3, Maggie) 0

124 SetName(3, Lisa Jr) 10

125 SetUsername(1, homers) 15

Page 8: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Universe of Users

Id Name Username APIKey1 Homer homers d0a2 Bart bart f003 Lisa Jr maggie baa

users

events

Seq Event Time

123 SetUsername(3, Maggie) 0

124 SetName(3, Lisa Jr) 10

125 SetUsername(1, homers) 15

Id Name Derived1 Homer Homer12 Bart Bart23 Lisa Jr Lisa Jr3

users_new

Page 9: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Universe of Users

Id Name Username APIKey1 Homer homers d0a2 Bart bart f003 Lisa Jr maggie baa

users

events

Seq Event Time

123 SetUsername(3, Maggie) 0

124 SetName(3, Lisa Jr) 10

125 SetUsername(1, homers) 15

Id Name Derived1 Homer Homer12 Bart Bart23 Lisa Jr Lisa Jr3

users_new

Page 10: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Our Identity System requirements

Page 11: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Our Identity System requirements

• Users, groups and memberships

Page 12: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Our Identity System requirements

• Users, groups and memberships• Searching for users

Page 13: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Our Identity System requirements

• Users, groups and memberships• Searching for users

• Retrieve by email

Page 14: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Our Identity System requirements

• Users, groups and memberships• Searching for users

• Retrieve by email

• High volume low latency reads

Page 15: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Our Identity System requirements

• Users, groups and memberships• Searching for users

• Retrieve by email

• Incremental synchronisation

• High volume low latency reads

Page 16: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Our Identity System requirements

• Users, groups and memberships• Searching for users

• Retrieve by email

• Incremental synchronisation

• Audit trails for changes

• High volume low latency reads

Page 17: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Our Identity System requirements

• Users, groups and memberships• Searching for users

• Retrieve by email

• Incremental synchronisation

• Audit trails for changes

• High volume low latency reads

• Highly available• Disaster recovery• Zero-downtime upgrades

Page 18: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Our Identity System requirements

• Users, groups and memberships• Searching for users

• Retrieve by email

• Incremental synchronisation

• Audit trails for changes

• High volume low latency reads

• Highly available• Disaster recovery• Zero-downtime upgrades

• Testing with production-like data

Page 19: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Evolving thearchitecture

Page 20: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

DynamoDB

SaveAPI

Core app

EventStream

Services

REST callse.g. Add User

Query viewsQuery viewsQuery views

Page 21: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Command QueryResponsibilitySegregation

Page 22: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Domain (bus. logic)

Database

UI

User

User Search for users

Users and groups

Page 23: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Command (write logic)

Database

UI

User

Query viewsQuery viewsQuery views

User

Search for users

Users and groups

Page 24: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Command (write logic)

UI

User

Query viewsQuery viewsQuery views

User

Search for users

Users and groups

ElasticSearch

Page 25: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

DynamoDB

Commands

Core app

EventStream

Services

REST callse.g. Add User

Query viewsQuery views

Query sync

EventStreamEventStream

Query views

Page 26: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

DynamoDB

Commands

Core app

EventStream

Services

REST callse.g. Add User

Query viewsQuery views

Query sync

EventStreamEventStream

Query views

KinesisLambda

ElasticSearch

Events

Page 27: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

DynamoDB

Commands

Groups

EventStream

Services

REST callse.g. Add User

Query viewsQuery views

Query sync

EventStreamEventStream

Query views

KinesisLambda

PlatformEvents

Kinesis

ExternalEvents

EventTxf

Users

Page 28: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Events as an API

Page 29: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

UserAdded(id, name, email1)

Insert / Update Delta ‘Set’ events

UserUpdated(id, email = Some(email))

UserNameSet(id, name)UserEmailSet(id, email1)

UserEmailSet(id, email2)

Fits nicely with CRUD + PATCH

Assume insert before update

Encourages idempotent processing

Minimally sized events to avoid conflict

Single code path for query sync

vs

Page 30: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Sharding forthroughput

Multiple streamsSingle stream

Transactions andconsistent data

resolution Better availability vs consistencycompromise

Page 31: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Rules for splitting streams

1. Place independent events on different streams

Page 32: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Rules for splitting streams

1. Place independent events on different streams

2. Split streams by event type and unique Id

Page 33: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Rules for splitting streams

1. Place independent events on different streams

2. Split streams by event type and unique Id

3. Identify the ‘transactions’ you really need

Page 34: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Rules for splitting streams

1. Place independent events on different streams

2. Split streams by event type and unique Id

3. Identify the ‘transactions’ you really need

4. Use hierarchical streams to maximise number of streams

Page 35: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Rules for splitting streams

1. Place independent events on different streams

2. Split streams by event type and unique Id

3. Identify the ‘transactions’ you really need

4. Use hierarchical streams to maximise number of streams

5. Splitting and joining streams later is possible

Page 36: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

But… no guaranteed order between streams

Page 37: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Query views get populated eventually

Page 38: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Query views get populated eventually

• A field should only be updated by a single event stream

Page 39: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Query views get populated eventually

• A field should only be updated by a single event stream

• No foreign key constraints

Page 40: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Query views get populated eventually

• A field should only be updated by a single event stream

• No foreign key constraints

• In general, unique or data constraints ‘enforced’ on write

Page 41: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Let go oftransactions

and consistency

Page 42: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Why do we need transactions?

Page 43: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Why do we need transactions?

• Enforce business constraints e.g. uniqueness

Page 44: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Why do we need transactions?

• Enforce business constraints e.g. uniqueness

• Guaranteed to see what I just wrote

Page 45: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Write and Read Consistency

Page 46: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

But CAP theorem…

Page 47: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

CAP or PACELC?

Page 48: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

CAP or PACELC?

During a network Partition, choose betweenAvailability versus Consistency

Page 49: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

CAP or PACELC?

During a network Partition, choose betweenAvailability versus Consistency

Else choose betweenLatency versus Consistency

Page 50: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

There is a middle ground…

Page 51: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

1. Read at seq X2. Run business rule

3. Stream must be at X to write

Check-and-Set writes

Optional forced reads

Query view must be at stream seq X

Potential false positives

Enforce timed waits

Do not use as default

Potential increased latency

Smaller streams alleviate problems

Potentially conflicting events on same stream

Page 52: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Tokens to emulate transactions and consistency

User: homer (id 4)

All Users: Seq 100

User 4: Seq 23

Page 53: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Tokens to emulate transactions and consistency

• Returned on read and write via ETagUser: homer (id 4)

All Users: Seq 100

User 4: Seq 23

Page 54: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Tokens to emulate transactions and consistency

• Returned on read and write via ETag

• Pass as request header for:

User: homer (id 4)

All Users: Seq 100

User 4: Seq 23

Page 55: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Tokens to emulate transactions and consistency

• Returned on read and write via ETag

• Pass as request header for:• Condition write (‘transaction’)

User: homer (id 4)

All Users: Seq 100

User 4: Seq 23

Page 56: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Tokens to emulate transactions and consistency

• Returned on read and write via ETag

• Pass as request header for:• Condition write (‘transaction’)• Force query view update (‘consistency’)

User: homer (id 4)

All Users: Seq 100

User 4: Seq 23

Page 57: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Tokens to emulate transactions and consistency

• Returned on read and write via ETag

• Pass as request header for:• Condition write (‘transaction’)• Force query view update (‘consistency’)• Caching

User: homer (id 4)

All Users: Seq 100

User 4: Seq 23

Page 58: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Using tokens to enforce state

Client Core App

Page 59: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Using tokens to enforce state

Client Core App

Create User A

Page 60: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Using tokens to enforce state

Client Core App

Create User A

Token TU1

Page 61: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Using tokens to enforce state

Client Core App

Create User A

Create Group B

Token TU1

Page 62: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Using tokens to enforce state

Client Core App

Create User A

Create Group B

Token TU1

Token TG1

Page 63: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Using tokens to enforce state

Client Core App

Create User A

Create Group B

Add User A to Group B (tokens TU1, TG1)

Token TU1

Token TG1

Page 64: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Using tokens to enforce state

Client Core App

Create User A

Create Group B

Add User A to Group B (tokens TU1, TG1)

Force query view to TU1, TG1

Token TU1

Token TG1

Page 65: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Using tokens to enforce state

Client Core App

Create User A

Create Group B

Add User A to Group B (tokens TU1, TG1)

Force query view to TU1, TG1

Token TU1

Token TG1

Token TG2

Page 66: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Conflict resolutioninstead of

transactions

Page 67: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Resolve conflicts on query

• Conflicting events on same stream

Handles multi-region writes

Needs to be implemented on all query nodes

No falsely failed transactions

Potential temporary glitches

• Defined resolution algorithm on replay• e.g. Last Write Wins• Convergent/Commutative Replicated Data Types

(CRDTs)

More resilient query views

Page 68: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Summary

Page 69: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Key takeaways

• Start small and challenge everything!

Page 70: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Key takeaways

• Start small and challenge everything!

• Incremental architecture for incremental demos

Page 71: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Key takeaways

• Start small and challenge everything!

• Incremental architecture for incremental demos

• Think “Events as an API”

Page 72: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

Key takeaways

• Start small and challenge everything!

• Incremental architecture for incremental demos

• Think “Events as an API”

• Accept weaker transactions and eventual consistency

Page 73: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

“We should using event sourcing more

than we do”Martin Fowler (very loosely paraphrased)

Page 74: Event sourcing and CQRS from the trenches · Event sourcing and CQRS from the trenches. Universe of Users Id Name Username APIKey 1 Homer homer d0a 2 Bart bart f00 3 Maggie maggie

event sourcing lib:bitbucket.org/atlassianlabs/eventsrc