我正在尝试使用 Spring Cloud Function for Http Request 实现 Google Cloud Function,但是我找不到任何可以帮助我理解如何处理 Http Request 的示例示例。在 AWS 中,我们有 APIGatewayProxyRequestEvent
和 APIGatewayProxyResponseEvent
,如下所示:
@Bean
public Function<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> processXmlOrder() {
return value -> {
try {
APIGatewayProxyResponseEvent responseEvent = new APIGatewayProxyResponseEvent();
responseEvent.setStatusCode(201);
responseEvent.setBody(objectMapper.writeValueAsString(order));
return responseEvent;
} catch (IOException e) {
......
}
};
}
Documentation example 只解释了如何读取字符串并响应字符串。如果我必须阅读 Http Request 并映射到 Google Http Request 并使用 Google Http Respond 响应怎么办?我们如何使用 Spring Cloud Function for Http Request 在 GCP Cloud Function 中创建类似的函数?
文档中没有解释 GCP Cloud Function 与 Spring Cloud Function 集成的文章。