0
0
GCPcloud~20 mins

Topics and subscriptions in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Pub/Sub Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
Message Delivery Behavior in Pub/Sub

In Google Cloud Pub/Sub, what happens if a subscriber does not acknowledge a message within the acknowledgement deadline?

AThe message is redelivered to the subscriber or another subscriber.
BThe message is moved to a dead-letter topic immediately.
CThe message is deleted and not delivered again.
DThe message is archived automatically without redelivery.
Attempts:
2 left
💡 Hint

Think about what happens when a message is not confirmed as received.

Architecture
intermediate
2:00remaining
Designing Pub/Sub for Multiple Subscribers

You want to send the same messages to multiple independent services using Pub/Sub. Which setup ensures each service receives all messages independently?

ACreate one topic and multiple subscriptions, one per service.
BCreate one subscription and use message filters to route messages.
CCreate multiple topics, one per service, and one subscription per topic.
DCreate one topic and one subscription shared by all services.
Attempts:
2 left
💡 Hint

Remember that each subscription receives its own copy of messages.

security
advanced
2:00remaining
Restricting Publisher Access to a Pub/Sub Topic

You want to allow only a specific service account to publish messages to a Pub/Sub topic. Which IAM role and policy setup achieves this?

AGrant the 'roles/pubsub.subscriber' role to the service account on the topic resource.
BGrant the 'roles/pubsub.publisher' role to the service account on the topic resource.
CGrant the 'roles/pubsub.editor' role to the service account on the project.
DGrant the 'roles/owner' role to the service account on the subscription.
Attempts:
2 left
💡 Hint

Think about the role that allows publishing messages.

Configuration
advanced
2:00remaining
Configuring Dead-Letter Topics for Pub/Sub Subscriptions

Which configuration is required to enable a dead-letter topic for a Pub/Sub subscription?

ACreate a subscription on the dead-letter topic and link it to the original topic.
BEnable message retention on the topic and set a dead-letter policy on the subscription.
CSet the dead-letter topic in the subscription and specify the maximum delivery attempts.
DAssign the 'roles/pubsub.deadletterHandler' role to the subscription.
Attempts:
2 left
💡 Hint

Dead-letter topics require a policy on the subscription with delivery attempt limits.

Best Practice
expert
2:00remaining
Optimizing Pub/Sub Subscription Acknowledgement Deadline

You have a subscriber processing messages that sometimes takes longer than the default acknowledgement deadline. What is the best practice to avoid message redelivery without losing messages?

ADisable acknowledgement to prevent message redelivery.
BIncrease the acknowledgement deadline to the maximum allowed value permanently.
CSet the acknowledgement deadline to the minimum and rely on message redelivery.
DUse the subscriber client to extend the acknowledgement deadline dynamically while processing.
Attempts:
2 left
💡 Hint

Think about how to handle variable processing times safely.