当在 Google Cloud API 中启动长时间运行的操作时,该服务可能会返回一个具有“Operations”形状的对象。然后可以通过该对象轮询操作的状态,并在完成时获得结果。
我想避免必须为这些结果设置自己的轮询过程,我希望可以利用 Google Cloud Pub/Sub 服务来提供帮助。我的希望来自阅读这一行 in the doc :
(强调)
... the client can use this interface to receive the real response asynchronously by polling the operation resource, or pass the operation resource to another API (such as Google Cloud Pub/Sub API) to receive the response. ...
是否可以使用 Google Cloud Pub/Sub API 来通知长时间运行的操作完成事件?我应该怎么做?
我无法在任何地方找到任何进一步的引用或使用此概念的示例。 也许我误解了该文档行?
干杯
最佳答案
您想使用的长时间运行的操作是否将结果写入云存储桶?如果是这样,您可以根据 this page 创建一个由该存储桶上的事件触发的云函数。 .
关于google-app-engine - 如何通过 Google Cloud Pub/Sub API 接收长时间运行的操作结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44568081/