Pub/Sub Made Easy
Using Cloud Pub/Sub with Cloud Run - ep. 9
A ten-episode progression through topics, subscriptions, clients, endpoints, and replay
Ten 2019–2020 episodes follow a message from publication to independent subscription backlogs, delivery, acknowledgement, and replay. Examples compare push and pull consumers and connect them to serverless endpoints.
Google Cloud Tech 9 of 10
In this collection Browse 10 summaries 9 of 10
A Pub/Sub subscriber can run as a containerized HTTP service on Cloud Run. This walkthrough deploys a packaging-service example that rejects unauthenticated requests, then gives a Pub/Sub subscription permission to call it.
Key points
- Cloud Run provides container-level control: The episode contrasts deploying a function with packaging a stateless HTTP service when the application needs more control over language or execution environment 00:00–01:04(opens in a new tab).
- The HTTP response tells Pub/Sub whether to retry: The sample logs a greeting and returns HTTP 204 to acknowledge processing. An HTTP error such as 400 or 500 causes the message to be retried 01:04–03:10(opens in a new tab).
- The historical deployment builds and pushes a container image: It uses
gcloud, the older Container Registry path, and then-current Cloud Run deployment choices 02:07–03:10(opens in a new tab). - The receiving service remains private: A service-account identity receives permission to invoke Cloud Run, and the push subscription combines that identity with the service URL and topic 03:10–05:19(opens in a new tab).
Full video: https://www.youtube.com/watch?v=ZI9ndn2obDk(opens in a new tab)