To guarantee messages are received by the service in the same order that the application gives them to a publisher, the client library needs to wait until a batch of messages is successfully delivered before sending the next batch, otherwise batches may arrive out of order as there is no guarantee the same channel or network path is used for each batch.
For applications that do not care about message ordering, this can limit the throughput. Therefore, the behavior is disabled by default.
See Also
the documentation for the Publisher class for details.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-05 UTC."],[[["The page provides documentation for the `MessageOrderingOption` in the Google Cloud Pub/Sub C++ client library, spanning versions from 2.11.0 to 2.37.0-rc, with version 2.37.0-rc being the latest."],["Message ordering, which guarantees messages are received in the order they are sent, is disabled by default in the `Publisher` class to maximize throughput for applications where order does not matter."],["Enabling message ordering requires the client library to wait for the successful delivery of a message batch before sending the next, as there is no inherent guarantee of consistent delivery pathways for each batch."],["The documentation refers users to the [`Publisher`](/cpp/docs/reference/pubsub/2.22.0/classgoogle_1_1cloud_1_1pubsub_1_1Publisher) class for further details regarding message ordering."],["The `MessageOrderingOption` is a type alias for a boolean value that is used to toggle ordering on or off."]]],[]]