There has been a revolution; organizations must become real time; to become real time, they must become event driven.
– Neil Avery
Commands
Note: E.g. HTTP POST
Queries
Note: Request/response
Events, two versions...
Directed events
Note:
SQS
Almost commands...
First class events
Note:
First class thingimagiggies (Martin Fowler)
Can be inside a service or browser, but for a distributed system, we need distributed events.
SNS, publish/subscribe
Past tense.
- Semantic
- Atomic
- Related
- (Behavioral)
- (Projectable)
type: conversation:MessageAdded
data:
conversation: 1a2s3d4f
message: 2s3d4f5g
Note: Client fetches updates from API.
type: conversation:MessageAdded
audience:
users:
- 2s3d4f5g
- 3d4f5g6h
data:
content: {"blocks": ...}
conversation: 1a2s3d4f
message: 8f7d6s5a
writer: 3d4f5g6h
Note:
Authorization handling on event broker.
Martin Fowler version: Event-Carried State Transfer
- Switching source of truth.
- Necessary for FIRST class events.
- Immutable data store.
- reducer
- projection
- saga
Event-first thinking changes how you think about what you are building
When the event is required to store anything, no change will be unlogged.
Avoiding race conditions both in frontend and command handlers:
- When fetching data, you get version number.
- Do something.
- Send change command for that version.
Note:
Frontend uses ETag as version number (If-None-Match If-Match)
We can do this without event sourcing, by adding a version in the data storage
and validate that. But we don't. And, we won't.
Domain Driven Design
- SOA done right
- Finding the right boundaries (DDD)
Note:
- How it can positively affect the developer experience?
- How to maintain, test, monitor those services?
- Where is the limit? We don’t have a huge team to maintain dozens of services so maybe we need to apply some boundaries when splitting services.
- Why do we need it? Examples of things that we struggle with that could be solved by such things.
- Data. Like proof that such system will reduce load/help with scale and reliability.
One or many? Storage boundary.
- Notification creator
- Web pusher
- Mobile pusher
- Mailer
- Pull ...