An e-commerce company has built a stateless container that writes each order message to a Cloud SQL database. The operations team must deploy the image to Cloud Run so that it automatically scales up on traffic from the orders Pub/Sub topic, retries failed messages until they succeed, and processes only one message at a time in each container instance to avoid transaction conflicts. Which deployment strategy meets these requirements while requiring the least custom code and operational overhead?
Run the container in a GKE Deployment and schedule a CronJob that periodically pulls and processes messages from the Pub/Sub topic one at a time.
Deploy the image to Cloud Run with an Eventarc Pub/Sub trigger, set the service's maximum concurrency to 1, and rely on Cloud Run's automatic retry on non-2xx responses.
Deploy the image to Cloud Run, create a pull subscription, and implement a background thread in the container that polls Pub/Sub; keep the default concurrency setting.
Deploy the image as a second-generation Cloud Function triggered by the topic and limit max instances to 1.
Creating a Pub/Sub trigger with Eventarc attaches a push subscription to the topic and delivers each message as an HTTP request to the Cloud Run service. Cloud Run acknowledges the message only when the service returns a 2xx status, giving built-in at-least-once delivery and automatic retries. Setting the service's maximum concurrency to 1 guarantees that a single request is handled per container instance, preventing overlapping database writes. The alternative options either require custom polling logic, constrain the entire service to a single instance, or introduce extra infrastructure and management effort, so they do not satisfy the requirements as efficiently.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is Eventarc and how does it connect Pub/Sub to Cloud Run?
Open an interactive chat with Bash
Why is setting concurrency to 1 important for this deployment?
Open an interactive chat with Bash
How does Cloud Run handle automatic retries and ensure at-least-once message delivery?
Open an interactive chat with Bash
What is Eventarc in GCP?
Open an interactive chat with Bash
Why set maximum concurrency to 1 in Cloud Run?
Open an interactive chat with Bash
How does Cloud Run handle retries for failed messages?
Open an interactive chat with Bash
GCP Associate Cloud Engineer
Planning and implementing a cloud solution
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .