Event Sourcing: Rehydrating Aggregates with Snapshots

Опубликовано: 15 Ноябрь 2024
на канале: CodeOpinion
19,153
703

Once you understand how Event Sourcing works, the most common thought is: "What happens when you have a lot of Events? Won't it be inefficient to fetch every event from the EventStore and replay all of them to get to current state?". It might be. But to combat this, you can leverage snapshots to give you a representation of your aggregates state at a point in time. You can then use this as a checkpoint and them only replay the events since the snapshot.

🔔 Subscribe:    / @codeopinion  

💥 Join this channel to get access to source code & demos!
   / @codeopinion  

🔥 Don't have the JOIN button? Support me on Patreon!
  / codeopinion  

📝 Blog: https://codeopinion.com
👋 Twitter:   / codeopinion  
✨ LinkedIn:   / dcomartin  

0:00 Intro
2:24 Snapshots
5:19 Code Implementation
5:39 Aggregate
7:05 Repository
9:31 Creating a Snapshot
10:18 Demo

#eventsourcing #cqrs #softwarearchitecture