Bird
0
0

If a Cloud Function is deployed with a Pub/Sub trigger, what happens when a message is published to the topic?

medium📝 Predict Output Q5 of 15
GCP - Cloud Functions
If a Cloud Function is deployed with a Pub/Sub trigger, what happens when a message is published to the topic?
AThe message is deleted without processing
BThe message is stored but function is not triggered
CThe function runs only on HTTP requests
DThe Cloud Function is invoked with the message data
Step-by-Step Solution
Solution:
  1. Step 1: Understand Pub/Sub trigger behavior

    When a message is published to a Pub/Sub topic, any Cloud Function subscribed to that topic is triggered with the message.
  2. Step 2: Evaluate options

    Only The Cloud Function is invoked with the message data correctly describes this behavior. Others describe incorrect or unrelated outcomes.
  3. Final Answer:

    The Cloud Function is invoked with the message data -> Option D
  4. Quick Check:

    Pub/Sub trigger invokes function on message publish [OK]
Quick Trick: Pub/Sub messages trigger subscribed Cloud Functions [OK]
Common Mistakes:
  • Thinking function triggers only on HTTP
  • Assuming message is ignored
  • Confusing storage behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes