After a publisher flushes a batch of messages the batch is (obviously) not received immediately by the service. While the batch remains pending it potentially consumes memory resources in the client (and/or the service).
Some applications may have constraints on the number of bytes and/or messages they can tolerate in this pending state, and may prefer to block or reject messages.
[[["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 a reference for the \u003ccode\u003eMaxPendingMessagesOption\u003c/code\u003e within the Google Cloud Pub/Sub C++ library, detailing its functionality and usage across different versions.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version available is 2.37.0-rc, with a comprehensive list of previous releases from 2.36.0 down to 2.11.0, allowing users to select documentation relevant to their specific version.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eMaxPendingMessagesOption\u003c/code\u003e controls the maximum number of messages that can be pending (not yet acknowledged by the service) after a publisher flushes a batch, which is crucial for managing memory usage and preventing resource overload.\u003c/p\u003e\n"],["\u003cp\u003eThis option is critical for applications with strict constraints on memory or message buffering, providing a mechanism to block or reject messages when pending limits are reached.\u003c/p\u003e\n"],["\u003cp\u003eThe data type for \u003ccode\u003eMaxPendingMessagesOption\u003c/code\u003e is essentially a size type, \u003ccode\u003estd::size_t\u003c/code\u003e, meaning it represents the capacity to hold the size of any object.\u003c/p\u003e\n"]]],[],null,[]]