Funqy HTTP Binding with Google Cloud Functions

如果您希望允许 HTTP 客户端在 Google Cloud Functions 上调用您的 Funqy 函数,Quarkus 允许您通过 HTTP 公开多个作为 Google Cloud Function 部署的 Funqy 函数。此方法确实会增加常规 Funqy Google Cloud Function 集成的开销。 Unresolved directive in funqy-gcp-functions-http.adoc - include::{includes}/extension-status.adoc[] 按照 Google Cloud Functions Http Guide 操作。它逐步介绍在 Google Cloud Functions 上使用多种 HTTP 框架,包括 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 配合使用。

An additional Quickstart

除了生成 Google Cloud Functions HTTP Guide 中讨论的 Google Cloud Functions 项目外,还有一个用于在 Google Cloud Functions 上运行 Funqy HTTP 的快速入门指南。

克隆 Git 存储库: git clone {quickstarts-clone-url},或下载 {quickstarts-archive-url}[存档]。

该解决方案位于 funqy-google-cloud-functions-http-quickstart directory

The Code

代码中没有任何特别之处,更重要的是没有任何与 Google Cloud 相关的内容。Funqy 函数可以部署到许多环境,而 Google Cloud Functions 就是其中之一。实际上,Java 代码与 funqy-http-quickstart中的代码完全相同。

Getting Started

运行此快速入门指南的步骤与 Google Cloud Functions HTTP Guide中定义的步骤完全相同。不同之处在于,你正在从快速入门指南运行,Maven 依赖项稍有不同。

pom.xml
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-funqy-http</artifactId>
</dependency>
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-google-cloud-functions-http</artifactId>
</dependency>
build.gradle
implementation("io.quarkus:quarkus-funqy-http")
implementation("io.quarkus:quarkus-google-cloud-functions-http")