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

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

by Yan Cui2mAugust 23rd, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

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
Yan Cui

Yan Cui

@theburningmonk

AWS Serverless Hero. Independent Consultant. Developer Advocate at Lumigo.

Learn More
LEARN MORE ABOUT @THEBURNINGMONK'S
EXPERTISE AND PLACE ON THE INTERNET.

Share Your Thoughts

About Author

Yan Cui HackerNoon profile picture
Yan Cui@theburningmonk
AWS Serverless Hero. Independent Consultant. Developer Advocate at Lumigo.

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here
L O A D I N G
. . . comments & more!