Cloud Functions Receiving Events from Pub/Sub
A function can be executed each time a message is written to a Pub/Sub topic. You can use Cloud Console or gcloud commands to deploy functions triggered by a Cloud Pub/Sub event.
Deploying a Cloud Function for Cloud Pub/Sub Events Using Cloud Console
Assume you are using a function similar to one used in the previous Cloud Storage example. This time we’ll call the function pub_sub_function_test.
To create a function using Cloud Console, select the Cloud Function options from the vertical menu in the console. In the Cloud Functions console, you may be prompted to enable the Cloud Functions API if it is not already enabled. After the Cloud Functions API is enabled, you will have the option to create a new function. When creating a function, you will need to specify several parameters, including the cloud function name, memory allocated, event type, and source code. Here is the source code for pub_sub_function_test:
def pub_sub_function_test...