This code snippet was extracted from an AWS Step Functions example.
It can ben found in the AWS Console for the Step Functions service.
Follow the instructions on this documentation page
Date: 2019-10-16
{ | |
"Comment" : "An example of the Amazon States Language for reading messages from a DynamoDB table and sending them to SQS", | |
"StartAt": "Seed the DynamoDB Table", | |
"TimeoutSeconds": 3600, | |
"States": { | |
"Seed the DynamoDB Table": { | |
"Type": "Task", | |
"Resource": "<SEEDING_LAMBDA_FUNCTION_ARN>", | |
"ResultPath": "$.List", | |
"Next": "For Loop Condition" | |
}, | |
"For Loop Condition": { | |
"Type": "Choice", | |
"Choices": [ | |
{ | |
"Not": { | |
"Variable": "$.List[0]", | |
"StringEquals": "DONE" | |
}, | |
"Next": "Read Next Message from DynamoDB" | |
} | |
], | |
"Default": "Succeed" | |
}, | |
"Read Next Message from DynamoDB": { | |
"Type": "Task", | |
"Resource": "arn:<PARTITION>:states:::dynamodb:getItem", | |
"Parameters": { | |
"TableName": "<DYNAMO_DB_TABLE_NAME>", | |
"Key": { | |
"MessageId": {"S.$": "$.List[0]"} | |
} | |
}, | |
"ResultPath": "$.DynamoDB", | |
"Next": "Send Message to SQS" | |
}, | |
"Send Message to SQS": { | |
"Type": "Task", | |
"Resource": "arn:<PARTITION>:states:::sqs:sendMessage", | |
"Parameters": { | |
"MessageBody.$": "$.DynamoDB.Item.Message.S", | |
"QueueUrl": "<SQS_QUEUE_URL>" | |
}, | |
"ResultPath": "$.SQS", | |
"Next": "Pop Element from List" | |
}, | |
"Pop Element from List": { | |
"Type": "Pass", | |
"Parameters": { | |
"List.$": "$.List[1:]" | |
}, | |
"Next": "For Loop Condition" | |
}, | |
"Succeed": { | |
"Type": "Succeed" | |
} | |
} | |
} |
This code snippet was extracted from an AWS Step Functions example.
It can ben found in the AWS Console for the Step Functions service.
Follow the instructions on this documentation page
Date: 2019-10-16