This repository contains the source code for orchestrating microservices using the Saga Pattern with AWS Step Functions. The blueprint demonstrates implementing the Saga Pattern in an e-commerce application using AWS Step Functions.
In this blog post, you can read more about Saga pattern and composable commerce example walkthrough
infrastructure
Contains infrastructure code written with AWS SAM, defined in template.yml.lambdas
: Contains all AWS Lambda function source code.
- AWS account with access to AWS Step Functions, Lambda, and other necessary services.
- Node.js for changing AWS Lambda functions' code
- AWS CLI installed and configured.
- SAM
Step 1: Clone the Repository
git clone https://github.com/aliliarif/saga-step-functions
Step 2: Install Dependencies
cd saga-step-functions
npm install
Step 3: Deploy
cd infrastructure
sam build
sam deploy --guided --capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND
Sample JSON for Order process failure
{
"body": "{\"failCreateOrder\": true}"
}
Sample JSON for Inventory update failure
{
"body": "{\"failInventoryUpdate\": true}"
}
Sample JSON for Payment process failure
{
"body": "{\"failProcessPayment\": true}"
}
Clean up the resources deployed by SAM project
cd infrastructure
sam delete