Skip to content

Commit

Permalink
Add 'Understanding Eventsourcing' chapters 22-23
Browse files Browse the repository at this point in the history
  • Loading branch information
TorbenRahbekKoch committed Dec 10, 2024
1 parent ae5869a commit 9c4d3d1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion public/data/blogs/blogs.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
"title": "Understanding Event Sourcing - a review",
"teaser": "Understand the events, use the source",
"dir": "",
"date": "2024-12-09",
"date": "2024-12-10",
"categories": ["review"]
}
]
Expand Down
28 changes: 28 additions & 0 deletions public/data/blogs/understanding-eventsourcing/entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,31 @@ Axon also makes it easy to test the slices. It is interesting to see how aggrega
are initialized. That can sometimes be a puzzle to figure that out.

The rule with maximum three items in the card is implemented by counting _ItemAdded_-events.

### 22. Implementing state view slices using Live-Projections

A _Live report_ or _Live projection_ is a query which is calculated from the events
every time it is requested. This is rarely too slow. If it is you can chose a
stored projection.

The code in the is highly dependent on the Axon framework but the principles used
are very simple.

Axon does not provide any help for testing queries, so the has an example of a more
manual approach using Test Containers. It gets the job done.

### 23. Implementing Remove-Item and Clear-Cart

In here it is stated very clearly that the command handler is not responsible
for changing the state and attributes of the aggregate. The job of the command
handler is _to enforce invariants, validate business rules and apply the correct
events in case all rules apply_.

_The sole purpose of the command handler is to make a decision whether a command can
be processed by validating the existing state of the system._

_The only purpose of the event-sourcing handler is to evolve the state of the aggregate._

_An aggregate's internals only changes because of events that occured, never because of an action._

Just to make that clear!
16 changes: 16 additions & 0 deletions public/data/quotes.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,22 @@
"author": "Ryan Singer",
"languages": ["dk", "en"],
"source": "Shape Up"
},{
"quote": "The sole purpose of the command handler is to make a decision whether a command can be processed by validating the existing state of the system",
"author": "Martin Dilger",
"languages": ["dk", "en"],
"source": "Understanding Eventsourcing"
},{
"quote": "The only purpose of the event-sourcing handler is to evolve the state of the aggregate",
"author": "Martin Dilger",
"languages": ["dk", "en"],
"source": "Understanding Eventsourcing"
},{
"quote": "An aggregate's internals only changes because of events that occured, never because of an action",
"author": "Martin Dilger",
"languages": ["dk", "en"],
"source": "Understanding Eventsourcing"
}

]
}

0 comments on commit 9c4d3d1

Please sign in to comment.