user16498174
user16498174

Reputation:

How can i use Pub / Sub Notifications for Cloud Storage

I need to use Pub / Sub Notifications for Cloud Storage, on firebase i have storage files, i need to do any process those process i storage in another fields on firebase as well, sometimes the process failed so i need to use Pub / Sub Notifications for Cloud Storage to publish OBJECT_FINALIZE

to implement https://cloud.google.com/storage/docs/pubsub-notifications, i need to create the topic, the suscription of the action by user.

where can i create the topic?, i am so confused with the documentation

Upvotes: 0

Views: 2366

Answers (1)

CaioT
CaioT

Reputation: 2211

Once you run the command to create the GCS notification, if the topic-name does not exist it will automatically create it for you. So your first step is to create a GCS notification, passing a topic name and the event type on OBJECT_FINALIZE as parameters.

Example:

gsutil notification create -t <TOPIC_NAME> -f json -e OBJECT_FINALIZE gs://BUCKET_NAME

Note the parameters:

-t = Topic name

-e = Event type (Object finalize)

Once this part is done, your next step is to create a subscription to view the notifications sent to PubSub. The subscription is attached to the topic created above.

In this documentation, it explains how to create a subscription and also a Node.JS example with a push delivery: https://cloud.google.com/pubsub/docs/admin#pubsub_create_push_subscription-nodejs

Upvotes: 1

Related Questions