PROFESSIONAL-DATA-ENGINEER · Question #249
You are updating the code for a subscriber to a Pub/Sub feed. You are concerned that upon deployment the subscriber may erroneously acknowledge messages, leading to message loss. Your subscriber is…
The correct answer is B. Create a Pub/Sub snapshot before deploying new subscriber code. Creating a Pub/Sub snapshot before deploying captures the state of all unacknowledged messages at that point in time, allowing you to use a Seek operation to roll back to that snapshot if the new subscriber code mistakenly acknowledges messages - effectively replaying those…
Question
Options
- ASet up the Pub/Sub emulator on your local machine.
- BCreate a Pub/Sub snapshot before deploying new subscriber code.
- CUse Cloud Build for your deployment. If an error occurs after deployment, use a Seek operation to locate a timestamp logged by Cloud Build at the start of the
- DEnable dead-lettering on the Pub/Sub topic to capture messages that aren't successfully acknowledged.
How the community answered
(47 responses)- A2% (1)
- B85% (40)
- C4% (2)
- D9% (4)
Explanation
Creating a Pub/Sub snapshot before deploying captures the state of all unacknowledged messages at that point in time, allowing you to use a Seek operation to roll back to that snapshot if the new subscriber code mistakenly acknowledges messages - effectively replaying those messages from the pre-deployment state.
Why the distractors fail:
- A - The Pub/Sub emulator is a local development/testing tool; it has no bearing on recovering messages in a production deployment.
- C - Cloud Build timestamps are useful for Seek, but only if you combine them with a snapshot or know the exact pre-deployment timestamp; without a snapshot, a timestamp-based Seek only works if message retention is enabled, which the question states it is not.
- D - Dead-lettering captures messages that fail acknowledgment (exceed delivery attempts), not messages that are erroneously acknowledged - once a message is acked, it's gone without a snapshot.
Memory tip: Think of a Pub/Sub snapshot like a save point in a video game - take it before you do something risky, so you can always Seek back to that checkpoint if things go wrong.
Topics
Community Discussion
No community discussion yet for this question.