如何在API 网关中组合多个API 调用?

How to composite multiple API call in API gateway?

我正在研究如何在我的项目中使用 API 网关。我目前的 API 网关模式想法是创建一层调用多个 API 的复合 API,并通过 API 网关公开复合 API .

在其他地方进行研究,我发现如果使用 API 网关,不建议创建复合 APIs,而是应该在 API 网关中创建复合本身。但是,如果我需要在 API 网关中进行组合,这是否意味着我需要在那里公开一些域逻辑,因为我需要构建一个有意义的请求合同,并且可能需要构建一系列调用 APIs?就个人而言,我觉得这样做不太舒服。

有没有其他方法可以在不暴露一些逻辑的情况下做到这一点?

From what I research, it is not recommended to create composite API if using API gateway but composition should happen in the API gateway itself.

请问您是在哪里找到的声明?

恕我直言,服务组合不是 api 网关的任务。它是 n 集成层的任务(你不需要有一个单独的 esb 产品或服务,在集成层下你可以理解任何实现功能的服务或服务层,例如组合,转换等)

您没有指定任何 api 产品或服务,这取决于产品是否能够执行任何逻辑(有些可以,有些则不能)。即使 api 网关产品能够执行任何逻辑,实际上我也不推荐它(你将不得不与维护、错误和状态处理作斗争,..)

But if I need to do the composition in API gateway, doesn't it means that I need to expose some domain logic there (personally, I don't feel comfortable doing that) because I need to construct a meaningful request contract and possibly sequence of calling APIs?

composition in API gateway 是什么意思?我假设在执行一些逻辑的术语下。然后逻辑对 api 客户端隐藏。

Or could it be layer of composite API sounds better?

确实。

通常尝试将 api 网关视为智能代理(进行授权、节流、面向客户端的 api 存储等),但暴露的后端服务应该已经暴露了