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"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["\u003cp\u003eThis webpage provides documentation for the \u003ccode\u003eMessageOrderingOption\u003c/code\u003e in various versions of the Google Cloud Pub/Sub C++ client library, ranging from version 2.11.0 to the latest release candidate 2.37.0-rc.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMessageOrderingOption\u003c/code\u003e controls whether messages are guaranteed to be delivered to the service in the same order they were sent by the publisher, which may impact throughput.\u003c/p\u003e\n"],["\u003cp\u003eMessage ordering is disabled by default, as it can limit throughput for applications that do not require it, by requiring the client library to wait for a batch of messages to be successfully delivered before sending another.\u003c/p\u003e\n"],["\u003cp\u003eDetailed information about message ordering and how to enable it can be found in the documentation for the \u003ccode\u003ePublisher\u003c/code\u003e class, which is linked in the page.\u003c/p\u003e\n"],["\u003cp\u003eThe type alias for \u003ccode\u003eMessageOrderingOption\u003c/code\u003e is \u003ccode\u003ebool\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,[]]