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

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

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

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

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


Receive Stories from @theburningmonk

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!