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.
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
- PubSub+ Event Broker version 10.0.0 or higher
- Access to PubSub+ Broker Manager
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.
- Log into the PubSub+ Broker Manager.
- Launch the connector Click-to-Connect Wizard (refer to Creating a REST Connector with Click-to-Connect).
- Click Google Cloud.
Click Google Cloud Run, then click Authenticate.
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.
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.
Click Connector Setup and then select the client profile for this connector to use.
Click Subscription Setup and enter the name of the topic to which the messages will be published.
Click Create and Enable Connector to finalize the connector creation.
In the PubSub+ Broker Manager Try Me! application, send a message to the topic you configured for the connector:
View the message in the Cloud Run logs.