Event Sourcing Design Pattern

A sample implementation of the event sourcing design pattern using AWS Step Functions

Event Sourcing pattern ensures that all changes to application state are stored as a sequence of events. Not just can we query these events, we can also use the event log to reconstruct past states, and as a foundation to automatically adjust the state to cope with retroactive changes.
The example implementation demonstrates implementation of event sourcing pattern to capture product inventory state changes. All product inventory events are sent to a Step Functionsworkflow, which executes series of task and persists the state of product as a sequence of state-changing events. Each task contains mock logic that processes a specific product event (ex: productReceived, productShipped etc.). It then passes on the updated product state to the next processing task. The updated product state along with event which caused the state change is stored in the Product Inventory Event log.

< Back to all workflows

GitHub icon View this workflow on GitHub


Clone repo

git clone https://github.com/aws-samples/step-functions-workflows-collection/tree/main/event-sourcing/cd step-functions-workflows-collection/event-sourcing/

Deploy

sam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

1. Delete the stack: sam delete --stack-name STACK_NAME.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Anirudha Joshi

Anirudha Joshi

Principal Customer Solutions Manager at AWS, helping customers to modernize on cloud. I enjoy Serverless and Event Driven Architectures

Follow on LinkedIn