Funqy HTTP Binding with Google Cloud Functions
如果您希望允许 HTTP 客户端在 Google Cloud Functions 上调用您的 Funqy 函数,Quarkus 允许您通过 HTTP 公开多个作为 Google Cloud Function 部署的 Funqy 函数。此方法确实会增加常规 Funqy Google Cloud Function 集成的开销。
If you want to allow HTTP clients to invoke your Funqy functions on Google Cloud Functions, Quarkus allows you to expose multiple Funqy functions through HTTP deployed as one Google Cloud Function. This approach does add overhead over the regular Funqy Google Cloud Function integration. Unresolved directive in funqy-gcp-functions-http.adoc - include::{includes}/extension-status.adoc[]
按照 Google Cloud Functions Http Guide 操作。它逐步介绍在 Google Cloud Functions 上使用多种 HTTP 框架,包括 Funqy。
Follow the Google Cloud Functions Http Guide. It walks through using a variety of HTTP frameworks on Google Cloud Functions, including Funqy.
Funqy HTTP + Google Cloud Functions 绑定程序并不能替代 HTTP 上的 REST。由于 Funqy 需要在许多不同的协议和函数提供程序之间实现可移植性,因此 HTTP 绑定非常简单,你将失去诸如链接和利用缓存控制以及条件 GET 等 HTTP 特性的 REST 功能。你可能想考虑改用 Quarkus 的 JakarTA REST、Spring MVC 或 Vert.x Web Reactive 路由 support。它们也会与 Quarkus 和 Google Cloud Functions 配合使用。
The Funqy HTTP + Google Cloud Functions 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 Google Cloud Functions.
An additional Quickstart
除了生成 Google Cloud Functions HTTP Guide 中讨论的 Google Cloud Functions 项目外,还有一个用于在 Google Cloud Functions 上运行 Funqy HTTP 的快速入门指南。
Beyond generating a Google Cloud Functions project that is covered in the Google Cloud Functions HTTP Guide, there’s also a quickstart for running Funqy HTTP on Google Cloud Functions.
克隆 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-google-cloud-functions-http-quickstart
directory。
The solution is located in the funqy-google-cloud-functions-http-quickstart
directory.
The Code
代码中没有任何特别之处,更重要的是没有任何与 Google Cloud 相关的内容。Funqy 函数可以部署到许多环境,而 Google Cloud Functions 就是其中之一。实际上,Java 代码与 funqy-http-quickstart中的代码完全相同。
There is nothing special about the code and more importantly nothing Google Cloud specific. Funqy functions can be deployed to many environments and Google Cloud Functions is one of them. The Java code is actually the same exact code as the funqy-http-quickstart.
Getting Started
运行此快速入门指南的步骤与 Google Cloud Functions HTTP Guide中定义的步骤完全相同。不同之处在于,你正在从快速入门指南运行,Maven 依赖项稍有不同。
The steps to get this quickstart running are exactly the same as defined in the Google Cloud Functions 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-google-cloud-functions-http</artifactId>
</dependency>
implementation("io.quarkus:quarkus-funqy-http")
implementation("io.quarkus:quarkus-google-cloud-functions-http")