When a typical workflow starts, the TransactScope class initializes its internal DynamoDB client object and the actions container. The service component represents the client application, which understands the business logic to begin, commit, or rollback transactions. The following figure illustrates the transaction workflow, which is described in the following paragraphs. To help translate the different data types into corresponding DynamoDB item attributes, we use an extension class named AttributeValueExtensions. The TransactExtensions class offers the ability to add transaction action requests for database PUT, UPDATE, and DELETE operations to the TransactScope instance. In the middle of the framework, and to control the transaction logic-such as adding or removing items to the transaction-we use an extension class named TransactExtensions. When needed, the application user calls the methods available to begin, commit, or roll back transactions. You can use it to simplify the transaction process used by the application client, encapsulating DynamoDB API calls. The framework begins with the TransactScope class, which is designed as an interface for the transaction client application. The transaction framework presented in this post wraps the DynamoDB API into a common transaction scope class, which maintains the transaction items that are to be committed or rolled back. Offer interface segregation so the client of the framework doesn’t need to worry about DynamoDB transaction APIs formatting.Decouple the transaction process with a dedicated framework for single-responsibility that multiple client applications can use.Present the DynamoDB API in a format familiar to developers.You can implement this design pattern in any other platform or using different programming languages. In this post, we use ASP.NET Core in C# to show how to use the framework. In this post, we introduce a framework that uses a layered approach to standardize and present DynamoDB transactions in a format that is familiar to developers. With the DynamoDB API, you can enforce the ACID attributes across one or more tables within a single AWS account and AWS Region.ĭevelopers are familiar with the ACID transaction concept, but they sometimes struggle when working with the DynamoDB transaction APIs because transactions in SQL are presented and committed in a different format. These sequences of multiple operations represent a unit of work that is committed to the tables or rolled back all together. A database transaction is a sequence of multiple operations that are performed on one or more tables. Amazon DynamoDB supports transactions to give atomicity, consistency, isolation, and durability (ACID), helping you maintain data consistency in your workloads.
0 Comments
Leave a Reply. |