A service to manipulate subscriptions.
Equality
Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection>
objects compare equal. Objects that compare equal share the same underlying resources.
Performance
Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.
Thread Safety
Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.
Constructors
SubscriptionAdminClient(SubscriptionAdminClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
SubscriptionAdminClient const &
|
SubscriptionAdminClient(SubscriptionAdminClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
SubscriptionAdminClient &&
|
SubscriptionAdminClient(std::shared_ptr< SubscriptionAdminConnection >, Options)
Parameters | |
---|---|
Name | Description |
connection |
std::shared_ptr< SubscriptionAdminConnection >
|
opts |
Options
|
Operators
operator=(SubscriptionAdminClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
SubscriptionAdminClient const &
|
Returns | |
---|---|
Type | Description |
SubscriptionAdminClient & |
operator=(SubscriptionAdminClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
SubscriptionAdminClient &&
|
Returns | |
---|---|
Type | Description |
SubscriptionAdminClient & |
Functions
CreateSubscription(std::string const &, std::string const &, google::pubsub::v1::PushConfig const &, std::int32_t, Options)
Creates a subscription to a given topic.
See the resource name rules. If the subscription already exists, returns ALREADY_EXISTS
. If the corresponding topic doesn't exist, returns NOT_FOUND
.
If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the resource name format. The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the subscription. It must have the format |
topic |
std::string const &
Required. The name of the topic from which this subscription is receiving messages. Format is |
push_config |
google::pubsub::v1::PushConfig const &
Optional. If push delivery is used with this subscription, this field is used to configure it. |
ack_deadline_seconds |
std::int32_t
Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be outstanding. During that time period, the message will not be redelivered (on a best-effort basis). |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::pubsub::v1::Subscription > |
the result of the RPC. The response message type (google.pubsub.v1.Subscription) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
CreateSubscription(google::pubsub::v1::Subscription const &, Options)
Creates a subscription to a given topic.
See the resource name rules. If the subscription already exists, returns ALREADY_EXISTS
. If the corresponding topic doesn't exist, returns NOT_FOUND
.
If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the resource name format. The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.
Parameters | |
---|---|
Name | Description |
request |
google::pubsub::v1::Subscription const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::pubsub::v1::Subscription > |
the result of the RPC. The response message type (google.pubsub.v1.Subscription) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetSubscription(std::string const &, Options)
Gets the configuration details of a subscription.
Parameters | |
---|---|
Name | Description |
subscription |
std::string const &
Required. The name of the subscription to get. Format is |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::pubsub::v1::Subscription > |
the result of the RPC. The response message type (google.pubsub.v1.Subscription) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetSubscription(google::pubsub::v1::GetSubscriptionRequest const &, Options)
Gets the configuration details of a subscription.
Parameters | |
---|---|
Name | Description |
request |
google::pubsub::v1::GetSubscriptionRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::pubsub::v1::Subscription > |
the result of the RPC. The response message type (google.pubsub.v1.Subscription) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UpdateSubscription(google::pubsub::v1::Subscription const &, google::protobuf::FieldMask const &, Options)
Updates an existing subscription by updating the fields specified in the update mask.
Note that certain properties of a subscription, such as its topic, are not modifiable.
Parameters | |
---|---|
Name | Description |
subscription |
google::pubsub::v1::Subscription const &
Required. The updated subscription object. |
update_mask |
google::protobuf::FieldMask const &
Required. Indicates which fields in the provided subscription to update. Must be specified and non-empty. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::pubsub::v1::Subscription > |
the result of the RPC. The response message type (google.pubsub.v1.Subscription) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UpdateSubscription(google::pubsub::v1::UpdateSubscriptionRequest const &, Options)
Updates an existing subscription by updating the fields specified in the update mask.
Note that certain properties of a subscription, such as its topic, are not modifiable.
Parameters | |
---|---|
Name | Description |
request |
google::pubsub::v1::UpdateSubscriptionRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::pubsub::v1::Subscription > |
the result of the RPC. The response message type (google.pubsub.v1.Subscription) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListSubscriptions(std::string const &, Options)
Lists matching subscriptions.
Parameters | |
---|---|
Name | Description |
project |
std::string const &
Required. The name of the project in which to list subscriptions. Format is |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::pubsub::v1::Subscription > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListSubscriptions(google::pubsub::v1::ListSubscriptionsRequest, Options)
Lists matching subscriptions.
Parameters | |
---|---|
Name | Description |
request |
google::pubsub::v1::ListSubscriptionsRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::pubsub::v1::Subscription > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
DeleteSubscription(std::string const &, Options)
Deletes an existing subscription.
All messages retained in the subscription are immediately dropped. Calls to Pull
after deletion will return NOT_FOUND
. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.
Parameters | |
---|---|
Name | Description |
subscription |
std::string const &
Required. The subscription to delete. Format is |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
DeleteSubscription(google::pubsub::v1::DeleteSubscriptionRequest const &, Options)
Deletes an existing subscription.
All messages retained in the subscription are immediately dropped. Calls to Pull
after deletion will return NOT_FOUND
. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.
Parameters | |
---|---|
Name | Description |
request |
google::pubsub::v1::DeleteSubscriptionRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
ModifyPushConfig(std::string const &, google::pubsub::v1::PushConfig const &, Options)
Modifies the PushConfig
for a specified subscription.
This may be used to change a push subscription to a pull one (signified by an empty PushConfig
) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the PushConfig
.
Parameters | |
---|---|
Name | Description |