Api网关从步骤函数中获取输出结果? [英] Api gateway get output results from step function?

查看:23
本文介绍了Api网关从步骤函数中获取输出结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照教程创建和调用 step功能

I followed tutorial on creating and invoking step functions

我在 api 的 GET 请求中得到输出为

I'm getting output in my GET request of api as

 {
  "executionArn": "arn:aws:states:ap-northeast-1:123456789012:execution:HelloWorld:MyExecution",
  "startDate": 1.486772644911E9
}

但是,我想要我的步骤函数输出,而不是上面的响应,它由如下所示的结束状态给出.

But, instead of above response I want my step functions output, which is given by end state as below.

{
   "name":"Hellow World"
}

如何实现这一目标?

推荐答案

更新:您现在可以使用 Express Step Functions 处理同步请求.

Update: You can now use Express Step Functions for synchronous requests.

AWS Step Functions 是异步的,不会立即返回其结果.API Gateway 方法是同步的,最大超时时间为 29 秒.

AWS Step Functions are asynchronous and do not immediately return their results. API Gateway methods are synchronous and have a maximum timeout of 29 seconds.

要从 Step Function 获取函数输出,您必须在 API Gateway 中添加第二个方法,该方法将通过 DescribeExecution 操作调用 Step Function.API 网关客户端必须定期调用此方法(轮询),直到返回的状态不再是正在运行".

To get the function output from a Step Function, you have to add a second method in API Gateway which will call the Step Function with the DescribeExecution action. The API Gateway client will have to call this periodically (poll) until the returned status is no longer "RUNNING".

这是 DescribeExecution 文档

这篇关于Api网关从步骤函数中获取输出结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆