You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
By default, Google Cloud Pub/Sub delivers messages in a best-effort order and guarantees at-least-once delivery, which means messages may arrive out of order and duplicates are possible. For many use cases this is acceptable, but some applications require strict ordering or exactly-once processing. This lesson covers Pub/Sub's ordering and deduplication features and how to use them effectively.
Without ordering, Pub/Sub may deliver messages out of the order they were published. This happens because Pub/Sub distributes messages across multiple servers for scalability. Consider a scenario where you publish three status updates for an order:
Without ordering guarantees, a subscriber might receive "Order shipped" before "Payment processed", leading to incorrect state transitions.
Pub/Sub supports ordered delivery using ordering keys. When you publish messages with the same ordering key, Pub/Sub guarantees that the subscriber receives them in the order they were published.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.