有没有办法通过AWS API网关向AWS步骤函数发出同步请求?
或者AWS状态机只能用于启动异步作业?
启动异步作业的设置可能包括以下内容:
ApiGatewayMethodStartExecution:
Type: 'AWS::ApiGateway::Method'
Properties:
...
Integration:
Type: AWS
Uri: arn:aws:apigateway:eu-north-1:states:action/StartExecution
RequestTemplates:
application/json: !Sub
- |
....
- StateMachineArn: !Ref AStateMachine
ApiGatewayMethodGetResult:
Type: 'AWS::ApiGateway::Method'
Properties:
...
Integration:
Type: AWS
Uri: arn:aws:apigateway:eu-north-1:states:action/DescribeExecution
RequestTemplates:
application/json: !Sub
- |
....
- StateMachineArn: !Ref AStateMachine
AStateMachine:
Type: 'AWS::StepFunctions::StateMachine'
...
发布于 2020-07-14 20:00:02
不,如果您直接调用step函数,则不会。但是,您可以通过将步骤函数包装在AWS Lambda中来模拟此行为。将终结点配置为Lambda代理。让AWS Lambda触发AWS步骤功能,并让AWS Lambda监控步骤功能以确定其何时完成。完成后,让AWS Lambda返回任何内容,这些内容将被发送到端点的调用者。所有这些机制都需要迅速发生,因为API Gateway上有一个硬性的30秒超时。
我有很多情况下,单步函数是由端点调用触发的。我通常让端点调用Lambda,然后Lambda启动step函数,并在step函数启动后返回。然后,我提供了第二个端点,调用者可以使用它来找出该步骤函数正在执行的任何操作的状态。
发布于 2020-07-14 19:48:13
对于任何集成,AWS API网关将根据quota limits设置~ 30 seconds
超时。
因此,它们只用于启动异步作业。
https://stackoverflow.com/questions/62814210
复制相似问题