Vehicle Recall Pipeline

This workflow models a complete end-to-end vehicle recall management pipeline using AWS Step Functions. It validates the recall notice, identifies affected vehicles, notifies registered owners, schedules dealership inspections, orders replacement parts, records regulatory compliance, and closes the recall case.
{
  "Comment": "End-to-end vehicle recall management pipeline — validates the recall notice, identifies affected vehicles, notifies registered owners, orders replacement parts, schedules dealership inspections, records regulatory compliance, and closes the recall case.",
  "StartAt": "ValidateRecall",
  "States": {
    "ValidateRecall": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${ValidateRecallFunctionArn}",
        "Payload.$": "$"
      },
      "ResultPath": "$.validation",
      "Retry": [
        {
          "ErrorEquals": [
            "Lambda.ServiceException",
            "Lambda.AWSLambdaException",
            "Lambda.SdkClientException"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 3,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "ValidationError"
        }
      ],
      "Next": "IsRecallValid"
    },
    "IsRecallValid": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.validation.Payload.isValid",
          "BooleanEquals": true,
          "Next": "IdentifyAffectedVehicles"
        }
      ],
      "Default": "ValidationError"
    },
    "ValidationError": {
      "Type": "Fail",
      "Error": "InvalidRecallNotice",
      "Cause": "Recall notice failed validation"
    },
    "IdentifyAffectedVehicles": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${IdentifyAffectedVehiclesFunctionArn}",
        "Payload.$": "$.validation.Payload"
      },
      "ResultPath": "$.vehicles",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "IdentificationError"
        }
      ],
      "Next": "HasAffectedVehicles"
    },
    "IdentificationError": {
      "Type": "Fail",
      "Error": "VehicleIdentificationFailed",
      "Cause": "Unable to identify affected vehicles from the registry"
    },
    "HasAffectedVehicles": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.vehicles.Payload.hasAffectedVehicles",
          "BooleanEquals": true,
          "Next": "NotifyOwner"
        }
      ],
      "Default": "CloseNoAffectedVehicles"
    },
    "CloseNoAffectedVehicles": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${CloseRecallCaseFunctionArn}",
        "Payload": {
          "closeReason": "NO_AFFECTED_VEHICLES",
          "recall.$": "$.validation.Payload.originalRecall"
        }
      },
      "ResultPath": "$.closure",
      "End": true
    },
    "NotifyOwner": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${NotifyOwnerFunctionArn}",
        "Payload": {
          "originalRecall.$": "$.validation.Payload.originalRecall",
          "vehicles.$": "$.vehicles.Payload"
        }
      },
      "ResultPath": "$.notification",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "NotificationError"
        }
      ],
      "Next": "OrderAndInspect"
    },
    "NotificationError": {
      "Type": "Fail",
      "Error": "OwnerNotificationFailed",
      "Cause": "Unable to dispatch owner notifications"
    },
    "OrderAndInspect": {
      "Type": "Parallel",
      "Comment": "Order replacement parts and schedule inspection concurrently.",
      "Branches": [
        {
          "StartAt": "OrderReplacementParts",
          "States": {
            "OrderReplacementParts": {
              "Type": "Task",
              "Resource": "arn:aws:states:::lambda:invoke",
              "Parameters": {
                "FunctionName": "${OrderReplacementPartsFunctionArn}",
                "Payload": {
                  "originalRecall.$": "$.validation.Payload.originalRecall",
                  "vehicles.$": "$.vehicles.Payload"
                }
              },
              "End": true
            }
          }
        },
        {
          "StartAt": "ScheduleInspection",
          "States": {
            "ScheduleInspection": {
              "Type": "Task",
              "Resource": "arn:aws:states:::lambda:invoke",
              "Parameters": {
                "FunctionName": "${ScheduleInspectionFunctionArn}",
                "Payload": {
                  "originalRecall.$": "$.validation.Payload.originalRecall",
                  "vehicles.$": "$.vehicles.Payload"
                }
              },
              "End": true
            }
          }
        }
      ],
      "ResultPath": "$.remediation",
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "RemediationError"
        }
      ],
      "Next": "RecordCompliance"
    },
    "RemediationError": {
      "Type": "Fail",
      "Error": "RemediationFailed",
      "Cause": "Parts ordering or inspection scheduling failed"
    },
    "RecordCompliance": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${RecordComplianceFunctionArn}",
        "Payload": {
          "originalRecall.$": "$.validation.Payload.originalRecall",
          "vehicles.$": "$.vehicles.Payload",
          "parts.$": "$.remediation[0]",
          "inspection.$": "$.remediation[1]"
        }
      },
      "ResultPath": "$.compliance",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "ResultPath": "$.error",
          "Next": "ComplianceError"
        }
      ],
      "Next": "CloseRecallCase"
    },
    "ComplianceError": {
      "Type": "Fail",
      "Error": "ComplianceRecordingFailed",
      "Cause": "Unable to file regulatory compliance record"
    },
    "CloseRecallCase": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "${CloseRecallCaseFunctionArn}",
        "Payload": {
          "closeReason": "RECALL_REMEDIATED",
          "recall.$": "$.validation.Payload.originalRecall",
          "compliance.$": "$.compliance"
        }
      },
      "ResultPath": "$.closure",
      "Next": "RecallComplete"
    },
    "RecallComplete": {
      "Type": "Succeed"
    }
  }
}
JSON
Expand
100%

Automotive teams can use patterns like this to build reliable, compliant, and scalable automation for payment systems and can test and refine these flows locally with Thrubit to reduce cloud cost and speed up iteration.