Google Cloud Pub/Sub C++ Client 2.13.0
A C++ Client Library for Google Cloud Pub/Sub
|
Configuration options for a Publisher
.
More...
#include <google/cloud/pubsub/publisher_options.h>
Public Member Functions | |
PublisherOptions () | |
PublisherOptions (Options opts) | |
Initialize the publisher options. More... | |
Publisher batch control | |
It is more efficient (in terms of client CPU and client network usage) to send multiple messages in a single "batch" to the service. The following configuration options can be used to improve throughput: sending larger batches reduces CPU and network overhead. Note that batches are subject to quota limits. | |
std::chrono::microseconds | maximum_hold_time () const |
template<typename Rep , typename Period > | |
PublisherOptions & | set_maximum_hold_time (std::chrono::duration< Rep, Period > v) |
Sets the maximum hold time for the messages. More... | |
std::size_t | maximum_batch_message_count () const |
PublisherOptions & | set_maximum_batch_message_count (std::size_t v) |
Set the maximum number of messages in a batch. More... | |
std::size_t | maximum_batch_bytes () const |
PublisherOptions & | set_maximum_batch_bytes (std::size_t v) |
Set the maximum size for the messages in a batch. More... | |
Publisher message ordering. | |
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. | |
bool | message_ordering () const |
Return true if message ordering is enabled. More... | |
PublisherOptions & | enable_message_ordering () |
Enable message ordering. More... | |
PublisherOptions & | disable_message_ordering () |
Disable message ordering. More... | |
Publisher flow control. | |
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. | |
PublisherOptions & | set_maximum_pending_bytes (std::size_t v) |
Flow control based on pending bytes. More... | |
PublisherOptions & | set_maximum_pending_messages (std::size_t v) |
Flow control based on pending messages. More... | |
std::size_t | maximum_pending_bytes () const |
std::size_t | maximum_pending_messages () const |
bool | full_publisher_ignored () const |
The current action for a full publisher. More... | |
bool | full_publisher_rejects () const |
The current action for a full publisher. More... | |
bool | full_publisher_blocks () const |
The current action for a full publisher. More... | |
PublisherOptions & | set_full_publisher_ignored () |
Ignore full publishers, continue as usual. More... | |
PublisherOptions & | set_full_publisher_rejects () |
Configure the publisher to reject new messages when full. More... | |
PublisherOptions & | set_full_publisher_blocks () |
Configure the publisher to block the caller when full. More... | |
Configuration options for a Publisher
.
These are largely used to control the batching configuration for a publisher. By default a publishers flushes a batch as soon as any of these conditions are met:
Applications developers should consult the Cloud Pub/Sub pricing page when selecting a batching configuration.
google::cloud::Options
and pass the options to MakePublisherConnection()
.google::cloud::pubsub::PublisherOptions::PublisherOptions | ( | ) |
google::cloud::Options{}
instead.
|
explicit |
Initialize the publisher options.
Expected options are any of the types in the PublisherOptionList
GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes
in the environment and unexpected options will be logged.opts | configuration options |
google::cloud::Options{}
instead.
|
inline |
Disable message ordering.
google::cloud::Options{}
and MessageOrderingOption
instead.Publisher
class for details.
|
inline |
Enable message ordering.
google::cloud::Options{}
and MessageOrderingOption
instead.Publisher
class for details.
|
inline |
The current action for a full publisher.
google::cloud::Options{}
and FullPublisherActionOption
instead.
|
inline |
The current action for a full publisher.
google::cloud::Options{}
and FullPublisherActionOption
instead.
|
inline |
The current action for a full publisher.
google::cloud::Options{}
and FullPublisherActionOption
instead.
|
inline |
google::cloud::Options{}
and MaxBatchBytesOption
instead.
|
inline |
google::cloud::Options{}
and MaxBatchMessagesOption
instead.
|
inline |
google::cloud::Options{}
and MaxHoldTimeOption
instead.
|
inline |
google::cloud::Options{}
and MaxPendingBytesOption
instead.
|
inline |
google::cloud::Options{}
and MaxPendingMessagesOption
instead.
|
inline |
Return true
if message ordering is enabled.
google::cloud::Options{}
and MessageOrderingOption
instead.
|
inline |
Configure the publisher to block the caller when full.
google::cloud::Options{}
and FullPublisherActionOption
instead.
|
inline |
Ignore full publishers, continue as usual.
google::cloud::Options{}
and FullPublisherActionOption
instead.
|
inline |
Configure the publisher to reject new messages when full.
google::cloud::Options{}
and FullPublisherActionOption
instead.
|
inline |
Set the maximum size for the messages in a batch.
google::cloud::Options{}
and MaxBatchBytesOption
instead.
|
inline |
Set the maximum number of messages in a batch.
google::cloud::Options{}
and MaxBatchMessagesOption
instead.
|
inline |
Sets the maximum hold time for the messages.
google::cloud::Options{}
and MaxHoldTimeOption
instead.
|
inline |
Flow control based on pending bytes.
google::cloud::Options{}
and MaxPendingBytesOption
instead.
|
inline |
Flow control based on pending messages.
google::cloud::Options{}
and MaxPendingMessagesOption
instead.