api网关从步进功能获取输出结果? [英] Api gateway get output results from step function?

查看:78
本文介绍了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
}

但是,除了上面的响应之外,我还希望我的step函数输出是由结束状态给出的,如下所示.

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

{
   "name":"Hellow World"
}

如何实现?

推荐答案

AWS Step函数是异步的,不会立即返回其结果. API网关方法是同步的,最大超时为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天全站免登陆