Reputation: 45
Good morning Regarding our process of uploading a video file to the bucket. We want your suggestion on who should notify the Pub/Sub subscriber that the file was uploaded. We can notification to that bucket that linked to a topic and on each successful upload the bucket will publish the method, Or we can use the callback or promise returned from the upload method to publish the message to that topic.
Upvotes: 1
Views: 525
Reputation: 38399
I suggest using the built-in Pub/Sub feature rather than building it yourself via a callback. Asides from being less work, GCS guarantees that it will ALWAYS publish at least one message for each successful upload.
The downside of building it yourself is that if for some reason your callback code fails to execute or a network error occurs, you might end up in a state where the GCS object exists but the message was never enqueued onto the topic.
Upvotes: 1