![]() The pattern uses Amazon SNS to send text (SMS) messages to subscribers, notifying them of failed or successful transactions.ĪWS Step Functions is a serverless orchestration service that lets you combine AWS Lambda functions and other AWS services to build business-critical applications. ![]() Each Lambda function creates, updates, or deletes the rows in the respective DynamoDB tables, depending on whether a transaction is confirmed or rolled back. This pattern deploys separate Lambda functions for each task that is highlighted in the diagram as well as three DynamoDB tables for flights, car rentals, and payments. For example, an error with payment processing (“ProcessPayment”) triggers a refund (“RefundPayment”), which then triggers a cancellation of the rental car and flight (“CancelRentalReservation” and “CancelFlightReservation”), which ends the entire transaction with a failure message. However, if the system encounters any errors in running any of these transactions, it starts to fail backward. The workflow consists of reserving air travel (“ReserveFlight”), reserving a car (“ReserveCarRental”), processing payments (“ProcessPayment”), confirming flight reservations (“ConfirmFlight”), and confirming car rentals (“ConfirmCarRental”) followed by a success notification when these steps are complete. The following workflow diagram illustrates the typical flow of the travel reservation system. The proposed architecture uses AWS Step Functions to build a saga pattern to book flights, book car rentals, and process payments for a vacation. Testing and debugging can become difficult when you’re using this design, because you have to have all services running in order to simulate the transaction pattern. However complexity increases with the number of microservices and the number of steps. If your transaction involves a small number of steps (three to five), the saga pattern might be a great fit. Prerequisites and limitationsĮvent sourcing is a natural way to implement the saga orchestration pattern in a microservices architecture where all components are loosely coupled and don’t have direct knowledge of one another. The pattern can be deployed with an infrastructure as code (IaC) framework such as the AWS Cloud Development Kit (AWS CDK), the AWS Serverless Application Model (AWS SAM), or Terraform.įor more information about the saga pattern and other data persistence patterns, see the guide Enabling data persistence in microservices on the AWS Prescriptive Guidance website. ![]() The sample application also uses Amazon API Gateway and Amazon Simple Notification Service (Amazon SNS) to implement a saga execution coordinator. This pattern demonstrates how to automate the setup and deployment of a sample application (which handles travel reservations) with serverless technologies such as AWS Step Functions, AWS Lambda, and Amazon DynamoDB. If a business transaction fails, saga orchestrates a series of compensating transactions that undo the changes that were made by the preceding transactions. This continues until the last transaction in the chain is complete. When you use the saga pattern, every service that performs a transaction publishes an event that triggers subsequent services to perform the next transaction in the chain. The saga pattern is a failure management pattern that helps establish consistency in distributed applications and coordinates transactions between multiple microservices to maintain data consistency. The distributed saga pattern is typically used for this purpose. In this case, some control logic is needed to undo the transactions that have already been processed. Because these microservices cannot use a single atomicity, consistency, isolation, durability (ACID) transaction, you might end up with partial transactions. In a distributed architecture, business transactions can span multiple microservices. As a result of decoupling, each microservice component has its own data persistence layer. In a microservices architecture, the main goal is to build decoupled and independent components to promote agility, flexibility, and faster time to market for your applications. ![]() Technologies: Modernization Serverless Cloud-nativeĪWS services: Amazon API Gateway Amazon DynamoDB AWS Lambda Amazon SNS AWS Step Functions
0 Comments
Leave a Reply. |