You have a Google Cloud Pub/Sub topic with message ordering enabled. What happens if you publish messages with the same ordering key but the subscriber acknowledges messages out of order?
Think about how Pub/Sub ensures message order with ordering keys and what happens if acknowledgments are delayed or out of order.
Pub/Sub with ordering keys ensures messages are delivered in order. If a message is not acknowledged, subsequent messages with the same key are not delivered until the earlier message is acknowledged, causing redelivery attempts.
You want to design a system that publishes millions of messages per second to a Google Cloud Pub/Sub topic. Which approach best ensures scalability and reliability?
Consider how batching and asynchronous publishing affect throughput and reliability.
Multiple publisher clients with asynchronous publishing and batching improve throughput and reliability by sending messages in batches and retrying failures automatically.
You want to restrict who can publish messages to a Pub/Sub topic in your project. Which IAM role should you assign to the publisher service account to allow publishing but prevent subscription management?
Think about the principle of least privilege and which role allows only publishing.
The roles/pubsub.publisher role allows publishing messages to topics but does not grant permissions to manage subscriptions or topics.
Google Cloud Pub/Sub may deliver messages more than once. What is the best practice to handle this duplication in your subscriber application?
Consider how to safely process messages that might arrive multiple times.
Pub/Sub guarantees at-least-once delivery, so duplicates can occur. Implementing idempotent processing using unique message IDs ensures safe handling of duplicates.
You publish messages with multiple different ordering keys to a single Pub/Sub topic. How does Pub/Sub guarantee message ordering in this scenario?
Think about how ordering keys isolate message order guarantees.
Pub/Sub guarantees ordering only within each ordering key. Messages with different keys can be delivered in any order relative to each other.