Saturday, April 23, 2022

AWS Step Functions - I/O Manipulation & Execution - Part #02

 [AWS SF : Modelling Step Functions Visually using Workflow Studio]




This series of articles will cover the Features and Usage of Step Functions. These are from the point of view of Integration with AWS API Gateway and REST Endpoints (Spring Boot) hosted on Elastic Beanstalk/EC2. Also, The discussion is from a purview of Data Management in Microservices, Transaction Management, Service Orchestration and Saga Design Pattern. 
 
[Important InformationThe article is based on the experience of the author working on the PoC/Prototype/Pilot of AWS Step Functions, Elastic Beanstalk* (EC2), AWS API Gateway* for a Neo Bank Startup of Philippines/Singapore. It contains knowledge collated, referenced from various manuals, blogs and tutorials on the internet. The transaction shown below is a mock use-case or a mock business transactionAny Images are copyright of their respective owners and only used for non-commercial purposes. I have verified and certify that it contains no copyright or confidential business information.]
 
 
 The topics covered in this specific article are :
  • Compensating Transaction 
  • Input Manipulation  
  • Output Manipulation 
  • Pass State – Transformation 
  • Executing Step Functions  
  • API Gateway
 
Compensating Transaction

Compensating Transaction is not a concept of AWS Step Functions at a Physical Level. But at a logical level for business use-case fulfilment, especially in defining data management patterns like Saga, are implemented in AWS Step Functions as a normal Step/Action. For example, If the [Credit Payee Account] step fails then the [Reverse Debit Payer Account] compensating transaction step is invoked.
 


Fig.7 : Compensating Transaction (Logical Concept Shown Using Mock Use-Case)

   
Input Manipulation

The input manipulation is provided to filter, manipulate, and transform the input. Usually, the output from the previous step becomes the input for the next step. Here, we may want to select only a partial section of the incoming data or we may want to add custom fields or manipulate them before we can process the logic for the step.
 
 
 
Fig.8 : Step Input Manipulation (Shown Using Mock Use-Case)
 
 
Output Manipulation

The output manipulation is like the input manipulation - filter, manipulate, and transform the output.
 

Fig.9 : Step Output Manipulation (Shown Using Mock Use-Case)
   

Pass State – Transformation

Few times in a Business Transaction or Use-Case, It merits to have a out n out Transformation State. It can be used to signify or emphasize the need to perform Data Transformation, Data Massaging or any form of Data Filtering. It has the same steps as Configuration, Input and Output.
 
 
 
Fig.10 : Pass-Stated to Transform Data (Shown Using Mock Use-Case) 

   
Executing Step Functions

Once you are done creating the Step Functions, you may go ahead and execute it. Once you click on ‘Start Execution’ in AWS Console – It will invoke all the Steps of the Workflow. If there is any error or failure, then it will end the execution at the step. Overall, once a Step Function execution is complete, we will get the Execution Input, Execution Output, Graph Inspector (Visual with Step Input and Step Output for Each Step) and the Execution Even History (Timestamps and Status of each Task/Step).

 
 
Fig.11 : Executing Step Functions within AWS (Mock Use-Case)
 
 
Watch this Space for Part-03 of this Article! 

No comments: