Firebase:我可以在 Firebase 云函数中 "not acknowledge"发布一条 PubSub 消息吗?

标签 firebase google-cloud-functions google-cloud-pubsub

我有一个 Firebase 云函数,它是 triggered通过 PubSub 消息。该函数应该使用消息或等待稍后使用它。

有没有办法从这个函数返回不确认消息 ,所以它会是 re-delivered晚些时候?

例如,我可以返回一个 Message 从云功能? docs似乎表明这是可能的,如果我没看错的话:

Returns non-null functions.CloudFunction containing non-null functions.pubsub.Message A Cloud Function which you can export.

最佳答案

当 PubSub 触发函数(Firebase 或 Cloud Function)时,如果函数正确结束,则消息为确认。但是如果函数崩溃或引发异常(总而言之,异常终止)消息不确认和 立即重新发送 .

这个重试循环会一直执行,直到消息被确认或消息过期(默认和最大 TTL 为 7 天,最小为 10 分钟。您可以在订阅中自定义 messageRetentionDuration)

关于Firebase:我可以在 Firebase 云函数中 "not acknowledge"发布一条 PubSub 消息吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45474862/

相关文章:

node.js - Google Cloud Function 部署错误 : provided function is not a loadable module

google-bigquery - 云数据流 : Generating tables in BigQuery

node.js - "Callback function is not a function"遵循 Google Cloud Scheduler/PubSub 教程时出错

firebase - 如何使用flutter从Firebase上传数据数组

Firebase:如何自动更新多个资源?

ios - 使用 Firebase Swift 检索数据

express - 为什么我的所有 Firebase 云功能都超时?

node.js - 未与 Cloud Functions 和 Firestore 建立连接

angular - 如何让 Angular Universal 为 Firebase Cloud Functions 编译 Typescript

python - 谷歌CP : Where to schedule PubSub subscriber which writes to BigQuery