0
0
GCPcloud~20 mins

Message retention and acknowledgment in GCP - Practice Problems & Coding Challenges

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

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

AThe message is redelivered to the subscriber or another subscriber after the acknowledgment deadline expires.
BThe message is immediately deleted from the subscription and not redelivered.
CThe message is moved to a dead-letter topic automatically without redelivery.
DThe message acknowledgment deadline is extended indefinitely until the subscriber acknowledges.
Attempts:
2 left
💡 Hint

Think about what happens when a message is not confirmed as processed in time.

Architecture
intermediate
2:00remaining
Configuring message retention duration

You want to ensure that unacknowledged messages in a Pub/Sub subscription are retained for 7 days before being deleted. Which configuration should you set?

ASet the topic's <code>messageRetentionDuration</code> to 7 days.
BSet the subscription's <code>ackDeadlineSeconds</code> to 7 days.
CSet the topic's <code>ackDeadlineSeconds</code> to 7 days.
DSet the subscription's <code>messageRetentionDuration</code> to 7 days.
Attempts:
2 left
💡 Hint

Retention duration controls how long messages stay in the subscription after delivery.

security
advanced
2:00remaining
Preventing message loss with acknowledgment deadlines

You have a subscriber that processes messages slowly, sometimes taking longer than the default acknowledgment deadline. What is the best practice to prevent message loss or duplicate processing?

AUse the subscriber client to extend the acknowledgment deadline dynamically while processing.
BSet the subscription's message retention duration to zero.
CDisable message acknowledgment to avoid redelivery.
DIncrease the subscription's acknowledgment deadline to a very high value (e.g., 1 hour).
Attempts:
2 left
💡 Hint

Think about how to keep the message invisible to others while processing.

🧠 Conceptual
advanced
2:00remaining
Dead-letter topic behavior in Pub/Sub

What happens to a message in a Pub/Sub subscription configured with a dead-letter topic if the message is not acknowledged after the maximum delivery attempts?

AThe message is redelivered indefinitely until acknowledged.
BThe message is deleted permanently without being sent anywhere else.
CThe message is sent to the dead-letter topic for further inspection or processing.
DThe message is automatically acknowledged to prevent further delivery.
Attempts:
2 left
💡 Hint

Dead-letter topics are used to handle problematic messages.

Best Practice
expert
3:00remaining
Designing a reliable message processing system with Pub/Sub

You are designing a system that must process messages exactly once using Google Cloud Pub/Sub. Which combination of features and practices will best help achieve this?

AAcknowledge messages immediately upon receipt without processing to speed up throughput.
BUse at-least-once delivery with message deduplication logic in the subscriber and enable dead-letter topics for failed messages.
CUse exactly-once delivery mode in Pub/Sub and disable dead-letter topics to prevent message loss.
DSet acknowledgment deadline to zero and disable message retention to avoid duplicates.
Attempts:
2 left
💡 Hint

Consider how to handle duplicates and failures safely.