A simple Event-Sourcing Example Using Lambda and DynamoDB [Includes Snapshots]by@theburningmonk
4,583 reads

A simple Event-Sourcing Example Using Lambda and DynamoDB [Includes Snapshots]

tldt arrow
Read on Terminal Reader🖨️

Too Long; Didn't Read

An event-sourced system uses snapshots of the current state of an account. The most recent snapshot is Version 22, with a Balance of 60. There have been 3 events since then. There are one snapshot for every 10 rows in the table, to be precise. These snapshots allow me to limit the number of rows I need to fetch on every request. In this case, I have a constant cost of fetching 10 items every time. It means I have to build up the current balance of the account from these events. To rebuild it, I find the most recent snapshots and apply the events since the snapshot was taken.

Company Mentioned

Mention Thumbnail
featured image - A simple Event-Sourcing Example Using Lambda and DynamoDB [Includes Snapshots]
Yan Cui HackerNoon profile picture

@theburningmonk

Yan Cui

Learn More
LEARN MORE ABOUT @THEBURNINGMONK'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa