Connecting to Google Cloud Run Using REST

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

These connectors use REST Delivery Points (RDPs) to trigger Cloud Run 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 Run. This tutorial will show you how to:

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

Prerequisites

Connecting to Cloud Run

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

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.
  4. Click Google Cloud Run, then click Authenticate.

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

    You can get the trigger URL for the Cloud Run app from the Service Details page for your Cloud Run Service in the 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 then select the client profile for this connector to use.

  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 Run logs.