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-14 UTC."],[[["This page provides documentation for the `MessageOrderingOption` in the Google Cloud Pub/Sub C++ client library, with links to different versions ranging from 2.11.0 to the latest release candidate 2.37.0-rc."],["The `MessageOrderingOption` controls whether messages are delivered to the service in the same order they are sent by the application, a feature that can potentially limit throughput if enabled."],["Message ordering is disabled by default because it can impact performance, and is only necessary when applications require messages to be processed in a specific sequence."],["The `Publisher` class documentation provides further details on how to configure and use the message ordering functionality."],["`MessageOrderingOption` is an alias for the `bool` type in the library."]]],[]]