Connecting to Google Cloud Functions Using REST

The Click-to-Connect Wizard in PubSub+ Broker Manager can create REST connectors to Google Cloud services like Cloud Functions.

These connectors use REST Delivery Points (RDPs) to trigger Cloud Functions to handle events from a PubSub+ event broker, making it easy for you to event enable your serverless architecture as part of your event-driven architecture (EDA) journey.

Goals

The goal of this tutorial is to demonstrate how to set up a REST connector in a PubSub+ event broker to send messages from a remote connection on the broker to Google Cloud Functions. This tutorial will show you how to:

  • Configure the event broker to set up RDPs with a REST connector
  • Send messages to Cloud Functions using the Try Me! functionality built into the PubSub+ Broker Manager
  • Review the messages in Google Cloud Functions logs

Prerequisites

Connecting to Cloud Functions

This example shows how to integrate the PubSub+ event broker with Google Cloud Functions.

Before you can integrate the PubSub+ event broker, you must set up a Cloud Function service that will handle messages being sent from the connector.

  1. Log into the PubSub+ Broker Manager.
  2. Launch the connector Click-to-Connect Wizard (refer to Creating a REST Connector with Click-to-Connect).
  3. Click Google Cloud Platform.
  4. Click Cloud Functions, then click Authenticate.

  5. Provide a name for this connector and, in the Google Function URL field, enter the trigger URL for the Cloud Function app that will handle the messages.

    You can get the trigger URL for the Cloud Function app from your Google Cloud Platform portal.

  6. Decide whether you want this RDP connection to allow unauthenticated access.

    If you choose not to allow unauthenticated access, you must provide a Google Key File, which must be in JSON format. You can get this key from your Google Cloud administrator, or, if you have permission to create a service account, you can generate a key for yourself.

  7. Click Connector Setup and review the settings (they are auto-populated based on the Google Function URL that you provided in the previous step).

  8. Click Subscription Setup and enter the name of the topic to which the messages will be published.

  9. Click Create and Enable Connector to finalize the connector creation.

  10. In the PubSub+ Broker Manager Try Me! application, send a message to the topic you configured for the connector:

  11. View the message in the Cloud Functions logs.