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\u003eThe latest available version is 2.37.0-rc, with links provided for older versions, down to 2.11.0, of the C++ Pub/Sub library documentation.\u003c/p\u003e\n"],["\u003cp\u003eThis documentation focuses on \u003ccode\u003eMessageOrderingOption\u003c/code\u003e within the Google Cloud Pub/Sub C++ library.\u003c/p\u003e\n"],["\u003cp\u003eMessage ordering is a feature that ensures messages are received in the order they were sent, but it is disabled by default due to potential throughput limitations.\u003c/p\u003e\n"],["\u003cp\u003eEnabling message ordering requires the client library to wait for successful delivery of each batch of messages, however the same channel or network path is not guaranteed for every batch.\u003c/p\u003e\n"],["\u003cp\u003eThe documentation also includes a link to the \u003ccode\u003ePublisher\u003c/code\u003e class for additional information about message ordering.\u003c/p\u003e\n"]]],[],null,[]]