Google Cloud Pub/Sub C++ Client  1.32.1
A C++ Client Library for Google Cloud Pub/Sub
Public Types | List of all members
google::cloud::pubsub::v1::MaxOutstandingMessagesOption Struct Reference

The maximum number of outstanding messages per streaming pull. More...

#include <google/cloud/pubsub/options.h>

Public Types

using Type = std::int64_t
 

Detailed Description

The maximum number of outstanding messages per streaming pull.

The Cloud Pub/Sub C++ client library uses streaming pull requests to receive messages from the service. The service will stop delivering messages if this many messages or more have neither been acknowledged nor rejected.

If a negative or 0 value is supplied, the number of messages will be unlimited.

Example
namespace pubsub = ::google::cloud::pubsub;
using ::google::cloud::future;
using ::google::cloud::Options;
using ::google::cloud::StatusOr;
auto sample = [](std::string project_id, std::string subscription_id) {
// Change the flow control watermarks, by default the client library uses
// 0 and 1,000 for the message count watermarks, and 0 and 10MiB for the
// size watermarks. Recall that the library stops requesting messages if
// any of the high watermarks are reached, and the library resumes
// requesting messages when *both* low watermarks are reached.
auto constexpr kMiB = 1024 * 1024L;
pubsub::Subscription(std::move(project_id), std::move(subscription_id)),
Options{}
.set<pubsub::MaxOutstandingBytesOption>(8 * kMiB)));
auto session = subscriber.Subscribe(
std::move(h).ack();
std::cout << "Received message " << m << "\n";
PleaseIgnoreThisSimplifiesTestingTheSamples();
});
return std::make_pair(subscriber, std::move(session));
};
Defines the interface to acknowledge and reject messages.
Definition: ack_handler.h:48
The C++ representation for a Cloud Pub/Sub messages.
Definition: message.h:78
Receive messages from the Cloud Pub/Sub service.
Definition: subscriber.h:89
future< Status > Subscribe(Callable &&cb)
Creates a new session to receive messages from subscription.
Definition: subscriber.h:129
Objects of this class identify a Cloud Pub/Sub subscription.
Definition: subscription.h:37
std::shared_ptr< SubscriberConnection > MakeSubscriberConnection(Subscription subscription, std::initializer_list< pubsub_internal::NonConstructible >)
Creates a new SubscriberConnection object to work with Subscriber.
Contains all the Cloud Pubsub C++ client types and functions.
Definition: ack_handler.cc:20
The maximum number of outstanding messages per streaming pull.
Definition: options.h:225

Definition at line 225 of file options.h.

Member Typedef Documentation

◆ Type

Definition at line 226 of file options.h.