Created
July 10, 2017 23:30
-
-
Save theburningmonk/cf194c7dc5ac1f1acdb278d94eb1dfa7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Comment": "Applying the Saga pattern with AWS Lambda and Step Functions", | |
"StartAt": "BookHotel", | |
"States": { | |
"BookHotel": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:us-east-1:{AccountID}:function:lambda-saga-dev-book-hotel", | |
"Catch": [ | |
{ | |
"ErrorEquals": ["States.ALL"], | |
"ResultPath": "$.BookHotelError", | |
"Next": "CancelHotel" | |
} | |
], | |
"ResultPath": "$.BookHotelResult", | |
"Next":"BookFlight" | |
}, | |
"BookFlight": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:us-east-1:{AccountID}:function:lambda-saga-dev-book-flight", | |
"Catch": [ | |
{ | |
"ErrorEquals": ["States.ALL"], | |
"ResultPath": "$.BookFlightError", | |
"Next": "CancelFlight" | |
} | |
], | |
"ResultPath": "$.BookFlightResult", | |
"Next":"BookRental" | |
}, | |
"BookRental": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:us-east-1:{AccountID}:function:lambda-saga-dev-book-rental", | |
"Catch": [ | |
{ | |
"ErrorEquals": ["States.ALL"], | |
"ResultPath": "$.BookRentalError", | |
"Next": "CancelRental" | |
} | |
], | |
"ResultPath": "$.BookRentalResult", | |
"End": true | |
}, | |
"CancelHotel": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:us-east-1:{AccountID}:function:lambda-saga-dev-cancel-hotel", | |
"Catch": [ | |
{ | |
"ErrorEquals": ["States.ALL"], | |
"ResultPath": "$.CancelHotelError", | |
"Next": "CancelHotel" | |
} | |
], | |
"ResultPath": "$.CancelHotelResult", | |
"Next":"Fail" | |
}, | |
"CancelFlight": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:us-east-1:{AccountID}:function:lambda-saga-dev-cancel-flight", | |
"Catch": [ | |
{ | |
"ErrorEquals": ["States.ALL"], | |
"ResultPath": "$.CancelFlightError", | |
"Next": "CancelFlight" | |
} | |
], | |
"ResultPath": "$.CancelFlightResult", | |
"Next":"CancelHotel" | |
}, | |
"CancelRental": { | |
"Type": "Task", | |
"Resource": "arn:aws:lambda:us-east-1:{AccountID}:function:lambda-saga-dev-cancel-rental", | |
"Catch": [ | |
{ | |
"ErrorEquals": ["States.ALL"], | |
"ResultPath": "$.CancelRentalError", | |
"Next": "CancelRental" | |
} | |
], | |
"ResultPath": "$.CancelRentalResult", | |
"Next":"CancelFlight" | |
}, | |
"Fail": { | |
"Type": "Fail" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment