{
    "Comment": "Generate delivery file of products for a store.",
    "StartAt": "ProductHydrator",
    "States": {
        "ProductHydrator": {
            "Type": "Task",
            "Resource": "${product_hydrator_lambda_arn}",
            "Retry": [
                {
                    "ErrorEquals": [
                      "States.Timeout",
                      "Lambda.ServiceException",
                      "Lambda.AWSLambdaException",
                      "Lambda.SdkClientException",
                      "Lambda.TooManyRequestsException"
                    ],
                    "BackoffRate": 2,
                    "IntervalSeconds": 60,
                    "MaxAttempts": 3,
                    "Comment": "Retry on timeout"
                }
            ],
            "Catch": [
                {
                  "ErrorEquals": [
                    "States.ALL"
                  ],
                  "Next": "OrderFinalizer",
                  "Comment": "Error after retry"
                }
            ],
            "Next": "MetadataGenerator"
        },
        "MetadataGenerator": {
            "Type": "Task",
            "Resource": "${metadata_generator_lambda_arn}",
            "ResultPath": "$.metadataResult",
            "Next": "OrderFinalizer",
            "Retry": [
                {
                    "ErrorEquals": [
                        "States.Timeout",
                        "Lambda.ServiceException",
                        "Lambda.AWSLambdaException",
                        "Lambda.SdkClientException",
                        "Lambda.TooManyRequestsException"
                    ],
                    "BackoffRate": 2,
                    "IntervalSeconds": 60,
                    "MaxAttempts": 3,
                    "Comment": "Retry on timeout"
                }
            ]
        },
        "OrderFinalizer": {
            "Type": "Task",
            "Resource": "${order_finalizer_lambda_arn}",
            "Retry": [
                {
                  "ErrorEquals": [
                    "States.Timeout",
                    "Lambda.ServiceException",
                    "Lambda.AWSLambdaException",
                    "Lambda.SdkClientException",
                    "Lambda.TooManyRequestsException"
                  ],
                  "BackoffRate": 2,
                  "IntervalSeconds": 60,
                  "MaxAttempts": 3,
                  "Comment": "Retry on timeout"
                }
              ],
            "End": true
        }
    }
}
