Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to receive long running operation results via Google Cloud Pub/Sub API

When long running operations are kicked off in Google Cloud APIs, the service might return an object with an "Operations" shape. The status of the operation can then be polled through this object and the results obtained when complete.

I'd like to avoid having to setup my own polling process for those results and I'm hoping that the Google Cloud Pub/Sub service can be leveraged to help. My hope comes from reading this line in the doc:

(emphasis added)

... 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. ...

Is it possible to use the Google Cloud Pub/Sub API to be notified of a long running operation completion event? And how should I go about doing this?

I am unable to find any further reference or example use of this concept anywhere. Maybe I'm mis-interpreting that documentation line?

Cheers

like image 473
ximus Avatar asked Jun 15 '17 12:06

ximus


1 Answers

Do the long running operations you want to use write the results to a cloud storage bucket? If so you might be able to create a cloud function triggered by events on that bucket according to this page.

like image 162
dizcology Avatar answered Sep 18 '22 16:09

dizcology