在数据存储区中创建/更新触发云功能 [英] Create/update in datastore triggers Cloud function
问题描述
我在Google数据存储区中有一个数据库.我不知道如何使用云功能,但是我想在创建或更新后触发事件. 不幸的是,文档只是针对以下主题: https://cloud.google .com/appengine/docs/standard/java/datastore/callbacks
I have a database in Google Datastore. I don't know how to use cloud functions, but i want to trigger an event after a creation or an update. Unfortunately the documentation is light on the subject : https://cloud.google.com/appengine/docs/standard/java/datastore/callbacks
我不知道在创建或更新行后如何使用@PostPut触发事件.
I don't know how i could use @PostPut to trigger an event as soon as a line is created or updated.
有人有一个基本示例教程吗?
Does anyone have a tutorial which a basic example ?
谢谢
推荐答案
Dan MacGrath提供了当前可用的触发器:
Dan MacGrath provided an answer to a similar request (callbacks are indeed discussed below. Such solution doesn't exist yet. As a workaround, taking into account the current available triggers:
- HTTP-直接通过HTTP请求调用功能.
- 云存储
- 云发布/订阅
- Firebase(数据库,存储,分析,身份验证)
- Stackdriver Logging-通过创建接收器将日志条目转发到Pub/Sub主题.然后,您可以触发该功能.
我会建议一些解决方案:
I would suggest a couple of solutions:
- 每次创建或更新行以触发链接的Cloud Function时,都将某些内容保存在Cloud Storage的特定存储桶中.之后您可以删除存储桶中的内容.
- 创建具有相同名称的日志,然后将其转发到Pub/Sub ,通过创建一个接收器.
- Saving something in a specific bucket from Cloud Storage every time that a line is created or updated to trigger a linked Cloud Function. You can delete the bucket contents afterwards.
- Create logs with the same name and then forward them to Pub/Sub, by creating a sink.
编辑1
- 云功能的云存储触发器: Google官方文档和在
node.js 6中包含示例代码的教程" rel ="nofollow noreferrer"> Github . - 用于Cloud Functions的Cloud Pub/Sub触发器: Google官方文档并在 Github (与以前相同).
- Cloud Storage triggers for Cloud Functions: Official Google doc and tutorial with a sample code in
node.js 6
in Github. - Cloud Pub/Sub triggers for Cloud Functions: Official Google doc and tutorial with a sample code in
node.js 6
in Github (the same than before).
这篇关于在数据存储区中创建/更新触发云功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!