Complete list of Google Pub/Sub pre-defined topics? - google-cloud-pubsub

I used Google Pub/Sub to receive status changes on a build workflow I have in Google Build. There's a pre-defined topic called cloud-builds where you just name a new topic cloud-builds and Cloud Builds updates will populate the topic.
The Pub/Sub topic to which Cloud Build publishes these build update messages is called cloud-builds.
https://cloud.google.com/build/docs/subscribe-build-notifications
I'm curious if there is a complete list of pre-defined topics for Pub/Sub that automatically pipe from different services.
I looked around the docs for Pub/Sub but couldn't find a complete list.

Sorry, there's no list of topics like this. There are some other services that offer Pub/Sub notifications, for example Google Cloud Storage, but there's no centralized place where they are all documented. You will need to refer to the documentation of the particular service you are interested in.

Related

Is using Google Pub/Sub possible on the frontend (React)

I'm fairly new to things that aren't strictly front end, so after reading the Google pub/sub docs and doing a few searches its not clear to me whether using it with react is possible.
My use case is I (hypothetically) have tens of thousands of people on my webpage at a time that all need to be told at the same time that some external event occurred (the message would be very small).
I know Google Firestore has a listener feature but based on this specification it would not be within the free tier usage anymore. I've seen libraries that allow Google Pub/Sub to be used with IOT devices so I'm confused on why I can't find any resources on using it in the browser.
Creating a Cloud Pub/Sub subscriber in the frontend would be an anti-pattern for several reasons. First of all, the quota limits only allow 10,000 subscriptions per topic. Since you say you have tens of thousands of people on the web page at a time, you would not be able to create enough subscriptions for this case. Additionally, subscriptions created when users come to the website would not be able to get any notifications from before the time the subscription was created; Cloud Pub/Sub only guarantees delivery of messages published after the subscription was successfully created. Finally, you'd have the issue of security and authentication. In order to start a subscriber from the client, you'd need to pass it credentials that it could use. If you use separate credentials for each webpage viewer, then you'd have to create these credentials on the fly and revoke them when the user disappears. If you use the same credentials across all of the subscribers, then one subscriber could intercept the feed of another subscriber.
Overall, Cloud Pub/Sub is designed for the torrents use case: fewer feeds with a lot of data that has to be processed by fewer subscribers. What you are talking about is the trickles use case: a small number of messages that need to be distributed among a large number of subscribers with individual ACLs. Firebase Cloud Messaging is the product designed for this latter case.
While it is true that Cloud Pub/Sub is on the path for Google Cloud IoT, it is used on the publish side: many devices send their events to a topic that can be processed by subscribers. Note that these messages from devices don't come directly into Cloud Pub/Sub; they go through a Cloud IoT server and that server is what publishes the messages to Cloud Pub/Sub. Device authentication is done via Cloud IoT and not via permissions on Cloud Pub/Sub topics. The delivery of messages to IoT devices is not done with Cloud Pub/Sub.

Use Cloud Pub/Sub to trigger sending of email

I'm trying to figure out how to use Cloud Pub/Sub to trigger the sending of an email when a file is added to a storage bucket.
Currently using PHP72 in Google App Engine standard environment. First I created a Topic that creates a message when a file is added to the storage bucket. Then I created a Pull subscription which reads the message. I can view the messages in the GCP console, but what I would like to happen is that I want to be notified by email, preferably with a copy of the file added to the email as an attachment. Is this possible? I tried looking for a solution or tutorial but came up empty.
You can implement the send mail login in a cloud function which will be triggered by Pub/Sub (Node.js,Python,Go).
Using Pub/Sub to trigger a Cloud Function
Instead of using a pull subscription, you should probably use a push subscription with App Engine, combined with one of the third party mail services such as Send Grid or MailJet.
The upload of an object to GCS triggers a message to be sent to the topic, and the push subscription delivers that message to App Engine.
Unfortunately, there aren't any full tutorials asking for exactly what you want, but hopefully this helps. Feel free to request a community tutorial for this by filing an issue on the GCP community toturial repo.

How to secure an app engine app to be available only to Google Cloud Task?

I would like to create a task handler that is supposed to deal with some tasks with retry, etc.
But I want this endpoint to only be triggerable by a specific queue in google task ?
How am I supposed to deal with it ? What is the best practice ?
Best regards
UPDATE: Check Will's comment. This answer might be outdated and no longer work. Before applying it, be sure to test extensively.
According to the Cloud Tasks documentation, requests incoming from Cloud Tasks will have the X-AppEngine-QueueName header.
This header does not appear listed in the GAE docs about requests headers removed, but I just tested it and this header is also removed.
To secure your GAE app to only be called through Cloud Tasks, validate that the X-AppEngine-QueueName header is in one of the approved queues that you want to allow to call your app.

What is a Google Cloud Pub/Sub Snapshot?

I read all the Pub/Sub docs and saw no mention of Snapshots.
But when I read the docs for the Node.js Client Libraries, I find references to Snapshot objects: https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.11.0/pubsub/snapshot
Huh?
It's an invite-only feature that seems to provide some sort of replayability functionality https://cloud.google.com/sdk/gcloud/reference/alpha/pubsub/.

Can I build mailing list software on Google App Engine?

I tried to search if it's legal or GAE will be able to support sending/receiving email just fine with mailing list kind of operation -- but so far I couldn't find anything useful.
Do you know if this is permissible or possible? Or even a good idea?
I'm thinking simple mailing list software for a single owner.
Yes you can build that, and in the GAE documentation is a good chapter about how to do that:
http://code.google.com/intl/de-DE/appengine/docs/java/mail/overview.html
If the fairly high quotas for sending mail:
http://code.google.com/intl/de-DE/appengine/docs/quotas.html#Mail
are not enough, you can ask for an increase. Not sure if that will cost you money.
App Engine does support sending and receiving email (see sending mail in App Engine and receiving mail in App Engine). The App Engine program policy prohibits sending spam emails (see the "Prohibited Actions" section), but as long as you are sending legitimate emails, there should not be a problem.
That said, if this is secondary to your main application (i.e. you just want to provide a mailing list as a support forum, for example), it may be easier to just use Google Groups for that functionality.

Resources