如何为单个请求调用两个端点

时间:2019-08-27 06:59:43

标签: amazon-web-services routing aws-lambda aws-api-gateway

我们在AWS Api Gateway POST https://publicendpoint/app/users中发布了一个现有端点,该端点指向内部端点https://microservice1/app/users

在后端数据库迁移过程中,每当调用https://publicendpoint/app/users时,我们都需要调用两个端点

https://microservice1-olddb/app/users

https://microservice1-newdb/app/users

该怎么做?

尝试使用lambda创建API网关触发器。 但是用lambda触发器无法实现这种情况。

1 个答案:

答案 0 :(得分:3)

API网关不执行任何业务流程,因此您不能将其指向两个端点。即使这样做,您将如何处理一项服务失败,哪种服务优先于给出的响应等。

最简单的答案可能是使用Lambda作为业务流程层。那就是Lambda上的Point API Gateway,后者又调用了两个端点。

相关问题