Add Wait State

Learn about using the Wait state in a workflow.

The Wait state is used to introduce a delay in the execution of a workflow for a specified amount of time. It can be useful for scenarios where we need to wait for a certain process to complete or for specific conditions to be met. In our sweets-making process, we'll use the Wait state to simulate the time it takes for the mixing of ingredients to be completed.

Using the Wait state in ingredient mixing state

We'll introduce a Wait state after the Map state (MixingIngredients), and we'll set the SecondsPath field in the Wait state to read the mixing time from the output of the MixIngredient Lambda function. Using SecondsPath, we can dynamically set the wait time for a Wait state based on the input it receives, making it more flexible and adaptable to different scenarios.

In our use case, we want to wait for a certain amount of time for each ingredient-mixing process. The mixing time for each ingredient is determined dynamically and can vary. By using the SecondsPath, we can set the waiting time based on the input payload, making the workflow adaptable to different mixing times for different ingredients.

For example, let's assume our Lambda function responsible for mixing ingredients returns a payload like this:

Get hands-on with 1200+ tech skills courses.