使用AWS Step Functions中的wait_for_task_token API来代替get_activity_task函数。
具体代码示例:
import boto3
import json
client = boto3.client('stepfunctions')
def lambda_handler(event, context):
response = client.start_execution(
stateMachineArn='arn:aws:states:us-east-1:123456789012:stateMachine:MyStateMachine',
input=json.dumps(event)
)
task_token = response['executionArn']
result = client.wait_for_task_token(
taskToken=task_token
)
# Do something with the result
return 'Success'