Funqy HTTP Binding with AWS Lambda
如果您希望允许 HTTP 客户端调用 AWS Lambda 上的 Funqy 函数,Quarkus 允许您通过部署为一个 AWS Lambda 而公开多个 Funqy 函数。此方法确实增加了常规 Funqy AWS Lambda 集成上的开销,并且还要求您使用 AWS API Gateway。
If you want to allow HTTP clients to invoke on your Funqy functions on AWS Lambda, Quarkus allows you to expose multiple Funqy functions through HTTP deployed as one AWS Lambda. This approach does add overhead over the regular Funqy AWS Lambda integration and also requires you to use AWS API Gateway. Unresolved directive in funqy-aws-lambda-http.adoc - include::{includes}/extension-status.adoc[]
遵循 AWS Lambda Http Guide 。它指导您在 AWS Lambda 上使用各种 HTTP 框架,包括 Funqy。
Follow the AWS Lambda Http Guide. It walks through using a variety of HTTP frameworks on AWS Lambda, including Funqy.
Funqy HTTP + AWS Lambda 绑定不能替代 HTTP 上的 REST。因为 Funqy 需要跨许多不同的协议和函数提供者进行移植,所以它的 HTTP 绑定非常极简,您将失去 REST 功能,例如链接以及利用缓存控制和条件 GET 等 HTTP 功能的能力。您可能需要考虑使用 Quarkus 的 Jakarta REST、Spring MVC 或 Vert.x Web Reactive 路由 support 代替。它们还可与 Quarkus 和 AWS Lambda 配合使用。
The Funqy HTTP + AWS Lambda binding is not a replacement for REST over HTTP. Because Funqy needs to be portable across a lot of different protocols and function providers its HTTP binding is very minimalistic and you will lose REST features like linking and the ability to leverage HTTP features like cache-control and conditional GETs. You may want to consider using Quarkus’s Jakarta REST, Spring MVC, or Vert.x Web Reactive Route support instead. They also work with Quarkus and AWS Lambda.
An additional Quickstart
除了生成 AWS Lambda Http Guide 中介绍的 AWS 项目外,还有一个快速启动,用于在 AWS Lambda 上运行 Funqy HTTP。
Beyond generating an AWS project that is covered in the AWS Lambda Http Guide, there’s also a quickstart for running Funqy HTTP on AWS Lambda.
克隆 Git 存储库: git clone {quickstarts-clone-url}
,或下载 {quickstarts-archive-url}[存档]。
Clone the Git repository: git clone {quickstarts-clone-url}
, or download an {quickstarts-archive-url}[archive].
解决方案位于 funqy-amazon-lambda-quickstart
directory 中。
The solution is located in the funqy-amazon-lambda-quickstart
directory.
The Code
代码没什么特别的,更重要的是没有什么内容是特定于 AWS 的。Funqy 函数可以部署到许多环境,而 AWS Lambda 就是其中之一。Java 代码实际上与 funqy-http-quickstart 的代码完全相同。
There is nothing special about the code and more importantly nothing AWS specific. Funqy functions can be deployed to many environments and AWS Lambda is one of them. The Java code is actually the same exact code as the funqy-http-quickstart.
Getting Started
使此快速启动运行的步骤与 AWS Lambda HTTP Guide 中定义的步骤完全相同。不同之处在于,您正在从快速启动中运行,并且 maven 依赖项略有不同。
The steps to get this quickstart running are exactly the same as defined in the AWS Lambda HTTP Guide. These differences are that you are running from a quickstart and the maven dependencies are slightly different.
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-funqy-http</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-amazon-lambda-http</artifactId>
</dependency>
implementation("io.quarkus:quarkus-funqy-http")
implementation("io.quarkus:quarkus-amazon-lambda-http")