Lambda Function for Mixing Ingredients
Learn to create a Lambda function for mixing ingredients.
We'll cover the following
Now, let's focus on the next step, which is the mixing state, since we've already checked the availability of ingredients in the ingredient preparation state.
For the mixing step, we can implement it with a Map
state. A Map
state allows us to process elements of an array in parallel by invoking a specified iterator. In the context of our sweets factory, if we had multiple mixing machines that could work simultaneously, the Map
state could represent the parallel processing of these machines to mix ingredients for different batches.
The Lambda function code for mixing ingredients
Let's start with creating a Lambda function for the mixing process. The purpose of this Lambda function is to simulate the process of mixing the ingredients for each batch. We'll use a Wait
state in combination with the Lambda function to represent the mixing process. Instead of waiting inside the Lambda function, we can calculate the wait time in the Lambda function and then use the Wait
state in the Step Functions workflow to handle the actual waiting.
Get hands-on with 1400+ tech skills courses.