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

How to call two endpoints for a single request

我们在 AWS Api 网关 POST https://publicendpoint/app/users which points to the internal endpoint https://microservice1/app/users 中发布了一个现有端点。

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

https://microservice1-olddb/app/users

https://microservice1-newdb/app/users

怎么做?

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

API 网关不做任何编排,所以你不能把它指向两个端点。即使是这样,您将如何处理一项服务失败,哪个服务优先于给定的响应等。

最简单的答案可能是使用 Lambda 作为编排层。那是点 API Lambda 的网关,后者又调用两个端点。