diff --git a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java
index 886945e0504e..6f7139bf4270 100644
--- a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java
+++ b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java
@@ -33,6 +33,7 @@
package com.google.cloud.pubsub.spi.v1;
+import com.google.api.gax.core.PageAccessor;
import com.google.api.gax.grpc.ApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.protobuf.Empty;
@@ -59,6 +60,60 @@
* Service Description: The service that an application uses to manipulate topics, and to send
* messages to a topic.
*
+ *
This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ *
+ *
+ * try (PublisherApi publisherApi = PublisherApi.defaultInstance()) {
+ * // make calls here
+ * String name = "";
+ * Topic callResult = createTopic(name);
+ * }
+ *
+ *
+ *
+ * Note: close() needs to be called on the publisherApi object to clean up resources such
+ * as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's methods:
+ *
+ *
+ * - A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available
+ * as parameters, and not every API method will have a flattened method entry point.
+ *
- A "request object" method. This type of method only takes one parameter, a request
+ * object, which must be constructed before the call. Not every API method will have a request
+ * object method.
+ *
- A "callable" method. This type of method takes no parameters and returns an immutable
+ * ApiCallable object, which can be used to initiate calls to the service.
+ *
+ *
+ * See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist
+ * with these names, this class includes a format method for each type of name, and additionally
+ * a parse method to extract the individual identifiers contained within names that are
+ * returned.
+ *
+ *
This class can be customized by passing in a custom instance of PublisherSettings to
+ * create(). For example:
+ *
+ *
+ *
+ *
+ * ConnectionSettings defaultConnectionSettings =
+ * PublisherSettings.defaultInstance().toBuilder().getConnectionSettings();
+ * ConnectionSettings updatedConnectionSettings =
+ * defaultConnectionSettings.toBuilder().provideCredentialsWith(myCredentials).build();
+ * PublisherSettings publisherSettings = PublisherSettings.defaultInstance().toBuilder().
+ * provideChannelWith(updatedConnectionSettings)
+ * .build();
+ * PublisherApi publisherApi = PublisherApi.create(publisherSettings);
+ *
+ *
+ *
*
*
*/
@@ -71,11 +126,11 @@ public class PublisherApi implements AutoCloseable {
private final ApiCallable publishCallable;
private final ApiCallable getTopicCallable;
private final ApiCallable listTopicsCallable;
- private final ApiCallable> listTopicsIterableCallable;
+ private final ApiCallable> listTopicsPagedCallable;
private final ApiCallable
listTopicSubscriptionsCallable;
- private final ApiCallable>
- listTopicSubscriptionsIterableCallable;
+ private final ApiCallable>
+ listTopicSubscriptionsPagedCallable;
private final ApiCallable deleteTopicCallable;
private static final PathTemplate PROJECT_PATH_TEMPLATE =
@@ -179,12 +234,12 @@ protected PublisherApi(PublisherSettings settings) throws IOException {
}
this.getTopicCallable = ApiCallable.create(settings.getTopicSettings(), settings);
this.listTopicsCallable = ApiCallable.create(settings.listTopicsSettings(), settings);
- this.listTopicsIterableCallable =
- ApiCallable.createIterable(settings.listTopicsSettings(), settings);
+ this.listTopicsPagedCallable =
+ ApiCallable.createPagedVariant(settings.listTopicsSettings(), settings);
this.listTopicSubscriptionsCallable =
ApiCallable.create(settings.listTopicSubscriptionsSettings(), settings);
- this.listTopicSubscriptionsIterableCallable =
- ApiCallable.createIterable(settings.listTopicSubscriptionsSettings(), settings);
+ this.listTopicSubscriptionsPagedCallable =
+ ApiCallable.createPagedVariant(settings.listTopicSubscriptionsSettings(), settings);
this.deleteTopicCallable = ApiCallable.create(settings.deleteTopicSettings(), settings);
if (settings.shouldAutoCloseChannel()) {
@@ -213,7 +268,7 @@ public void close() throws IOException {
* underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
* signs (`%`). It must be between 3 and 255 characters in length, and it
* must not start with `"goog"`.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Topic createTopic(String name) {
Topic request = Topic.newBuilder().setName(name).build();
@@ -229,7 +284,7 @@ public final Topic createTopic(String name) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private Topic createTopic(Topic request) {
return createTopicCallable().call(request);
@@ -241,7 +296,7 @@ private Topic createTopic(Topic request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable createTopicCallable() {
return createTopicCallable;
@@ -260,7 +315,7 @@ public final ApiCallable createTopicCallable() {
*
* @param topic The messages in the request will be published on this topic.
* @param messages The messages to publish.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final PublishResponse publish(String topic, List messages) {
PublishRequest request =
@@ -279,7 +334,7 @@ public final PublishResponse publish(String topic, List messages)
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public PublishResponse publish(PublishRequest request) {
return publishCallable().call(request);
@@ -293,7 +348,7 @@ public PublishResponse publish(PublishRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable publishCallable() {
return publishCallable;
@@ -309,7 +364,7 @@ public final ApiCallable publishCallable() {
*
*
* @param topic The name of the topic to get.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Topic getTopic(String topic) {
GetTopicRequest request = GetTopicRequest.newBuilder().setTopic(topic).build();
@@ -325,7 +380,7 @@ public final Topic getTopic(String topic) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private Topic getTopic(GetTopicRequest request) {
return getTopicCallable().call(request);
@@ -337,7 +392,7 @@ private Topic getTopic(GetTopicRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable getTopicCallable() {
return getTopicCallable;
@@ -353,9 +408,9 @@ public final ApiCallable getTopicCallable() {
*
*
* @param project The name of the cloud project that topics belong to.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listTopics(String project) {
+ public final PageAccessor listTopics(String project) {
ListTopicsRequest request = ListTopicsRequest.newBuilder().setProject(project).build();
return listTopics(request);
}
@@ -368,10 +423,10 @@ public final Iterable listTopics(String project) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listTopics(ListTopicsRequest request) {
- return listTopicsIterableCallable().call(request);
+ public final PageAccessor listTopics(ListTopicsRequest request) {
+ return listTopicsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -380,10 +435,10 @@ public final Iterable listTopics(ListTopicsRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final ApiCallable> listTopicsIterableCallable() {
- return listTopicsIterableCallable;
+ public final ApiCallable> listTopicsPagedCallable() {
+ return listTopicsPagedCallable;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -392,7 +447,7 @@ public final ApiCallable> listTopicsIterableC
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable listTopicsCallable() {
return listTopicsCallable;
@@ -408,9 +463,9 @@ public final ApiCallable listTopicsCallab
*
*
* @param topic The name of the topic that subscriptions are attached to.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listTopicSubscriptions(String topic) {
+ public final PageAccessor listTopicSubscriptions(String topic) {
ListTopicSubscriptionsRequest request =
ListTopicSubscriptionsRequest.newBuilder().setTopic(topic).build();
return listTopicSubscriptions(request);
@@ -424,10 +479,10 @@ public final Iterable listTopicSubscriptions(String topic) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listTopicSubscriptions(ListTopicSubscriptionsRequest request) {
- return listTopicSubscriptionsIterableCallable().call(request);
+ public final PageAccessor listTopicSubscriptions(ListTopicSubscriptionsRequest request) {
+ return listTopicSubscriptionsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -436,11 +491,11 @@ public final Iterable listTopicSubscriptions(ListTopicSubscriptionsReque
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final ApiCallable>
- listTopicSubscriptionsIterableCallable() {
- return listTopicSubscriptionsIterableCallable;
+ public final ApiCallable>
+ listTopicSubscriptionsPagedCallable() {
+ return listTopicSubscriptionsPagedCallable;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -449,7 +504,7 @@ public final Iterable listTopicSubscriptions(ListTopicSubscriptionsReque
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable
listTopicSubscriptionsCallable() {
@@ -470,7 +525,7 @@ public final Iterable listTopicSubscriptions(ListTopicSubscriptionsReque
*
*
* @param topic Name of the topic to delete.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void deleteTopic(String topic) {
DeleteTopicRequest request = DeleteTopicRequest.newBuilder().setTopic(topic).build();
@@ -490,7 +545,7 @@ public final void deleteTopic(String topic) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private void deleteTopic(DeleteTopicRequest request) {
deleteTopicCallable().call(request);
@@ -506,7 +561,7 @@ private void deleteTopic(DeleteTopicRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable deleteTopicCallable() {
return deleteTopicCallable;
diff --git a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java
index 72d24404d87a..230adc5ec35c 100644
--- a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java
+++ b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java
@@ -73,6 +73,32 @@
// Manually-added imports: add custom (non-generated) imports after this point.
// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing.
+/**
+ * Settings class to configure an instance of {@link PublisherApi}.
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ *
+ * - The default service address (pubsub-experimental.googleapis.com) and default port (443)
+ * are used.
+ *
- Credentials are acquired automatically through Application Default Credentials.
+ *
- Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders.
+ * When build() is called, the tree of builders is called to create the complete settings
+ * object. For example, to set the total timeout of CreateTopic to 30 seconds:
+ *
+ *
+ *
+ * PublisherSettings.Builder publisherSettingsBuilder =
+ * PublisherSettings.defaultInstance().toBuilder();
+ * publisherSettingsBuilder.CreateTopicSettings().getRetrySettingsBuilder()
+ * .setTotalTimeout(Duration.standardSeconds(30));
+ * PublisherSettings publisherSettings = publisherSettingsBuilder.build();
+ *
+ *
+ */
@javax.annotation.Generated("by GAPIC")
public class PublisherSettings extends ServiceApiSettings {
@@ -113,41 +139,68 @@ public class PublisherSettings extends ServiceApiSettings {
private final SimpleCallSettings deleteTopicSettings;
+ /**
+ * Returns the object with the settings used for calls to createTopic.
+ */
public SimpleCallSettings createTopicSettings() {
return createTopicSettings;
}
+ /**
+ * Returns the object with the settings used for calls to publish.
+ */
public BundlingCallSettings publishSettings() {
return publishSettings;
}
+ /**
+ * Returns the object with the settings used for calls to getTopic.
+ */
public SimpleCallSettings getTopicSettings() {
return getTopicSettings;
}
+ /**
+ * Returns the object with the settings used for calls to listTopics.
+ */
public PageStreamingCallSettings
listTopicsSettings() {
return listTopicsSettings;
}
+ /**
+ * Returns the object with the settings used for calls to listTopicSubscriptions.
+ */
public PageStreamingCallSettings<
ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>
listTopicSubscriptionsSettings() {
return listTopicSubscriptionsSettings;
}
+ /**
+ * Returns the object with the settings used for calls to deleteTopic.
+ */
public SimpleCallSettings deleteTopicSettings() {
return deleteTopicSettings;
}
+ /**
+ * Returns an instance of this class with recommended defaults.
+ */
public static PublisherSettings defaultInstance() throws IOException {
return newBuilder().build();
}
+ /**
+ * Returns a new builder for this class.
+ */
public static Builder newBuilder() {
return new Builder();
}
+ /**
+ * Returns a builder containing all the values of this settings class.
+ */
public Builder toBuilder() {
return new Builder(this);
}
@@ -286,6 +339,9 @@ public long countBytes(PublishRequest request) {
}
};
+ /**
+ * Builder for PublisherSettings.
+ */
public static class Builder extends ServiceApiSettings.Builder {
private final ImmutableList methodSettingsBuilders;
@@ -332,7 +388,7 @@ public static class Builder extends ServiceApiSettings.Builder {
private Builder() {
super(
- ConnectionSettings.builder()
+ ConnectionSettings.newBuilder()
.setServiceAddress(DEFAULT_SERVICE_ADDRESS)
.setPort(DEFAULT_SERVICE_PORT)
.provideCredentialsWith(DEFAULT_SERVICE_SCOPES)
@@ -440,34 +496,57 @@ public Builder setClientLibHeader(String name, String version) {
return this;
}
+ /**
+ * Applies the given settings to all of the API methods in this service. Only
+ * values that are non-null will be applied, so this method is not capable
+ * of un-setting any values.
+ */
public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
return this;
}
+ /**
+ * Returns the builder for the settings used for calls to createTopic.
+ */
public SimpleCallSettings.Builder createTopicSettings() {
return createTopicSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to publish.
+ */
public BundlingCallSettings.Builder publishSettings() {
return publishSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to getTopic.
+ */
public SimpleCallSettings.Builder getTopicSettings() {
return getTopicSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to listTopics.
+ */
public PageStreamingCallSettings.Builder
listTopicsSettings() {
return listTopicsSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to listTopicSubscriptions.
+ */
public PageStreamingCallSettings.Builder<
ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>
listTopicSubscriptionsSettings() {
return listTopicSubscriptionsSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to deleteTopic.
+ */
public SimpleCallSettings.Builder deleteTopicSettings() {
return deleteTopicSettings;
}
diff --git a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
index 2bfafd62ef0e..322154991e5b 100644
--- a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
+++ b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
@@ -33,6 +33,7 @@
package com.google.cloud.pubsub.spi.v1;
+import com.google.api.gax.core.PageAccessor;
import com.google.api.gax.grpc.ApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.protobuf.Empty;
@@ -60,6 +61,63 @@
* Service Description: The service that an application uses to manipulate subscriptions and to
* consume messages from a subscription via the `Pull` method.
*
+ * This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ *
+ *
+ * try (SubscriberApi subscriberApi = SubscriberApi.defaultInstance()) {
+ * // make calls here
+ * String name = "";
+ * String topic = "";
+ * PushConfig pushConfig = PushConfig.newBuilder().build();
+ * int ackDeadlineSeconds = 0;
+ * Subscription callResult = createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ * }
+ *
+ *
+ *
+ * Note: close() needs to be called on the subscriberApi object to clean up resources such
+ * as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's methods:
+ *
+ *
+ * - A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available
+ * as parameters, and not every API method will have a flattened method entry point.
+ *
- A "request object" method. This type of method only takes one parameter, a request
+ * object, which must be constructed before the call. Not every API method will have a request
+ * object method.
+ *
- A "callable" method. This type of method takes no parameters and returns an immutable
+ * ApiCallable object, which can be used to initiate calls to the service.
+ *
+ *
+ * See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist
+ * with these names, this class includes a format method for each type of name, and additionally
+ * a parse method to extract the individual identifiers contained within names that are
+ * returned.
+ *
+ *
This class can be customized by passing in a custom instance of SubscriberSettings to
+ * create(). For example:
+ *
+ *
+ *
+ *
+ * ConnectionSettings defaultConnectionSettings =
+ * SubscriberSettings.defaultInstance().toBuilder().getConnectionSettings();
+ * ConnectionSettings updatedConnectionSettings =
+ * defaultConnectionSettings.toBuilder().provideCredentialsWith(myCredentials).build();
+ * SubscriberSettings subscriberSettings = SubscriberSettings.defaultInstance().toBuilder().
+ * provideChannelWith(updatedConnectionSettings)
+ * .build();
+ * SubscriberApi subscriberApi = SubscriberApi.create(subscriberSettings);
+ *
+ *
+ *
*
*
*/
@@ -72,8 +130,8 @@ public class SubscriberApi implements AutoCloseable {
private final ApiCallable getSubscriptionCallable;
private final ApiCallable
listSubscriptionsCallable;
- private final ApiCallable>
- listSubscriptionsIterableCallable;
+ private final ApiCallable>
+ listSubscriptionsPagedCallable;
private final ApiCallable deleteSubscriptionCallable;
private final ApiCallable modifyAckDeadlineCallable;
private final ApiCallable acknowledgeCallable;
@@ -179,8 +237,8 @@ protected SubscriberApi(SubscriberSettings settings) throws IOException {
this.getSubscriptionCallable = ApiCallable.create(settings.getSubscriptionSettings(), settings);
this.listSubscriptionsCallable =
ApiCallable.create(settings.listSubscriptionsSettings(), settings);
- this.listSubscriptionsIterableCallable =
- ApiCallable.createIterable(settings.listSubscriptionsSettings(), settings);
+ this.listSubscriptionsPagedCallable =
+ ApiCallable.createPagedVariant(settings.listSubscriptionsSettings(), settings);
this.deleteSubscriptionCallable =
ApiCallable.create(settings.deleteSubscriptionSettings(), settings);
this.modifyAckDeadlineCallable =
@@ -243,7 +301,7 @@ public void close() throws IOException {
* system will eventually redeliver the message.
*
* If this parameter is not set, the default value of 10 seconds is used.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Subscription createSubscription(
String name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) {
@@ -271,7 +329,7 @@ public final Subscription createSubscription(
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public Subscription createSubscription(Subscription request) {
return createSubscriptionCallable().call(request);
@@ -288,7 +346,7 @@ public Subscription createSubscription(Subscription request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable createSubscriptionCallable() {
return createSubscriptionCallable;
@@ -307,7 +365,7 @@ public final ApiCallable createSubscriptionCallable(
*
*
* @param subscription The name of the subscription to get.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Subscription getSubscription(String subscription) {
GetSubscriptionRequest request =
@@ -327,7 +385,7 @@ public final Subscription getSubscription(String subscription) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private Subscription getSubscription(GetSubscriptionRequest request) {
return getSubscriptionCallable().call(request);
@@ -342,7 +400,7 @@ private Subscription getSubscription(GetSubscriptionRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable getSubscriptionCallable() {
return getSubscriptionCallable;
@@ -361,9 +419,9 @@ public final ApiCallable getSubscriptionCa
*
*
* @param project The name of the cloud project that subscriptions belong to.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listSubscriptions(String project) {
+ public final PageAccessor listSubscriptions(String project) {
ListSubscriptionsRequest request =
ListSubscriptionsRequest.newBuilder().setProject(project).build();
return listSubscriptions(request);
@@ -380,10 +438,10 @@ public final Iterable listSubscriptions(String project) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listSubscriptions(ListSubscriptionsRequest request) {
- return listSubscriptionsIterableCallable().call(request);
+ public final PageAccessor listSubscriptions(ListSubscriptionsRequest request) {
+ return listSubscriptionsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -395,11 +453,11 @@ public final Iterable listSubscriptions(ListSubscriptionsRequest r
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final ApiCallable>
- listSubscriptionsIterableCallable() {
- return listSubscriptionsIterableCallable;
+ public final ApiCallable>
+ listSubscriptionsPagedCallable() {
+ return listSubscriptionsPagedCallable;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -411,7 +469,7 @@ public final Iterable listSubscriptions(ListSubscriptionsRequest r
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable
listSubscriptionsCallable() {
@@ -432,7 +490,7 @@ public final Iterable listSubscriptions(ListSubscriptionsRequest r
*
*
* @param subscription The subscription to delete.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void deleteSubscription(String subscription) {
DeleteSubscriptionRequest request =
@@ -453,7 +511,7 @@ public final void deleteSubscription(String subscription) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private void deleteSubscription(DeleteSubscriptionRequest request) {
deleteSubscriptionCallable().call(request);
@@ -469,7 +527,7 @@ private void deleteSubscription(DeleteSubscriptionRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable deleteSubscriptionCallable() {
return deleteSubscriptionCallable;
@@ -494,7 +552,7 @@ public final ApiCallable deleteSubscriptionCal
* ack deadline will expire 10 seconds after the `ModifyAckDeadline` call
* was made. Specifying zero may immediately make the message available for
* another pull request.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void modifyAckDeadline(
String subscription, List ackIds, int ackDeadlineSeconds) {
@@ -519,7 +577,7 @@ public final void modifyAckDeadline(
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public void modifyAckDeadline(ModifyAckDeadlineRequest request) {
modifyAckDeadlineCallable().call(request);
@@ -534,7 +592,7 @@ public void modifyAckDeadline(ModifyAckDeadlineRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable modifyAckDeadlineCallable() {
return modifyAckDeadlineCallable;
@@ -558,7 +616,7 @@ public final ApiCallable modifyAckDeadlineCalla
* @param subscription The subscription whose message is being acknowledged.
* @param ackIds The acknowledgment ID for the messages being acknowledged that was returned
* by the Pub/Sub system in the `Pull` response. Must not be empty.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void acknowledge(String subscription, List ackIds) {
AcknowledgeRequest request =
@@ -581,7 +639,7 @@ public final void acknowledge(String subscription, List ackIds) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public void acknowledge(AcknowledgeRequest request) {
acknowledgeCallable().call(request);
@@ -599,7 +657,7 @@ public void acknowledge(AcknowledgeRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable acknowledgeCallable() {
return acknowledgeCallable;
@@ -624,7 +682,7 @@ public final ApiCallable acknowledgeCallable() {
* than returning no messages.
* @param maxMessages The maximum number of messages returned for this request. The Pub/Sub
* system may return fewer than the number specified.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final PullResponse pull(String subscription, boolean returnImmediately, int maxMessages) {
PullRequest request =
@@ -648,7 +706,7 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public PullResponse pull(PullRequest request) {
return pullCallable().call(request);
@@ -663,7 +721,7 @@ public PullResponse pull(PullRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable pullCallable() {
return pullCallable;
@@ -690,7 +748,7 @@ public final ApiCallable pullCallable() {
* stop pushing messages from the given subscription and allow
* messages to be pulled and acknowledged - effectively pausing
* the subscription if `Pull` is not called.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void modifyPushConfig(String subscription, PushConfig pushConfig) {
ModifyPushConfigRequest request =
@@ -715,7 +773,7 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public void modifyPushConfig(ModifyPushConfigRequest request) {
modifyPushConfigCallable().call(request);
@@ -732,7 +790,7 @@ public void modifyPushConfig(ModifyPushConfigRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable modifyPushConfigCallable() {
return modifyPushConfigCallable;
diff --git a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java
index a46c956ae29d..39fdadccea2a 100644
--- a/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java
+++ b/gcloud-java-pubsub/baseline/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java
@@ -66,6 +66,32 @@
// Manually-added imports: add custom (non-generated) imports after this point.
// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing.
+/**
+ * Settings class to configure an instance of {@link SubscriberApi}.
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ *
+ * - The default service address (pubsub-experimental.googleapis.com) and default port (443)
+ * are used.
+ *
- Credentials are acquired automatically through Application Default Credentials.
+ *
- Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders.
+ * When build() is called, the tree of builders is called to create the complete settings
+ * object. For example, to set the total timeout of CreateSubscription to 30 seconds:
+ *
+ *
+ *
+ * SubscriberSettings.Builder subscriberSettingsBuilder =
+ * SubscriberSettings.defaultInstance().toBuilder();
+ * subscriberSettingsBuilder.CreateSubscriptionSettings().getRetrySettingsBuilder()
+ * .setTotalTimeout(Duration.standardSeconds(30));
+ * SubscriberSettings subscriberSettings = subscriberSettingsBuilder.build();
+ *
+ *
+ */
@javax.annotation.Generated("by GAPIC")
public class SubscriberSettings extends ServiceApiSettings {
@@ -106,48 +132,81 @@ public class SubscriberSettings extends ServiceApiSettings {
private final SimpleCallSettings pullSettings;
private final SimpleCallSettings modifyPushConfigSettings;
+ /**
+ * Returns the object with the settings used for calls to createSubscription.
+ */
public SimpleCallSettings createSubscriptionSettings() {
return createSubscriptionSettings;
}
+ /**
+ * Returns the object with the settings used for calls to getSubscription.
+ */
public SimpleCallSettings getSubscriptionSettings() {
return getSubscriptionSettings;
}
+ /**
+ * Returns the object with the settings used for calls to listSubscriptions.
+ */
public PageStreamingCallSettings<
ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription>
listSubscriptionsSettings() {
return listSubscriptionsSettings;
}
+ /**
+ * Returns the object with the settings used for calls to deleteSubscription.
+ */
public SimpleCallSettings deleteSubscriptionSettings() {
return deleteSubscriptionSettings;
}
+ /**
+ * Returns the object with the settings used for calls to modifyAckDeadline.
+ */
public SimpleCallSettings modifyAckDeadlineSettings() {
return modifyAckDeadlineSettings;
}
+ /**
+ * Returns the object with the settings used for calls to acknowledge.
+ */
public SimpleCallSettings acknowledgeSettings() {
return acknowledgeSettings;
}
+ /**
+ * Returns the object with the settings used for calls to pull.
+ */
public SimpleCallSettings pullSettings() {
return pullSettings;
}
+ /**
+ * Returns the object with the settings used for calls to modifyPushConfig.
+ */
public SimpleCallSettings modifyPushConfigSettings() {
return modifyPushConfigSettings;
}
+ /**
+ * Returns an instance of this class with recommended defaults.
+ */
public static SubscriberSettings defaultInstance() throws IOException {
return newBuilder().build();
}
+ /**
+ * Returns a new builder for this class.
+ */
public static Builder newBuilder() {
return new Builder();
}
+ /**
+ * Returns a builder containing all the values of this settings class.
+ */
public Builder toBuilder() {
return new Builder(this);
}
@@ -202,6 +261,9 @@ public Iterable extractResources(ListSubscriptionsResponse payload
}
};
+ /**
+ * Builder for SubscriberSettings.
+ */
public static class Builder extends ServiceApiSettings.Builder {
private final ImmutableList methodSettingsBuilders;
@@ -250,7 +312,7 @@ public static class Builder extends ServiceApiSettings.Builder {
private Builder() {
super(
- ConnectionSettings.builder()
+ ConnectionSettings.newBuilder()
.setServiceAddress(DEFAULT_SERVICE_ADDRESS)
.setPort(DEFAULT_SERVICE_PORT)
.provideCredentialsWith(DEFAULT_SERVICE_SCOPES)
@@ -363,43 +425,72 @@ public Builder setClientLibHeader(String name, String version) {
return this;
}
+ /**
+ * Applies the given settings to all of the API methods in this service. Only
+ * values that are non-null will be applied, so this method is not capable
+ * of un-setting any values.
+ */
public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
return this;
}
+ /**
+ * Returns the builder for the settings used for calls to createSubscription.
+ */
public SimpleCallSettings.Builder createSubscriptionSettings() {
return createSubscriptionSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to getSubscription.
+ */
public SimpleCallSettings.Builder
getSubscriptionSettings() {
return getSubscriptionSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to listSubscriptions.
+ */
public PageStreamingCallSettings.Builder<
ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription>
listSubscriptionsSettings() {
return listSubscriptionsSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to deleteSubscription.
+ */
public SimpleCallSettings.Builder
deleteSubscriptionSettings() {
return deleteSubscriptionSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to modifyAckDeadline.
+ */
public SimpleCallSettings.Builder modifyAckDeadlineSettings() {
return modifyAckDeadlineSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to acknowledge.
+ */
public SimpleCallSettings.Builder acknowledgeSettings() {
return acknowledgeSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to pull.
+ */
public SimpleCallSettings.Builder pullSettings() {
return pullSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to modifyPushConfig.
+ */
public SimpleCallSettings.Builder modifyPushConfigSettings() {
return modifyPushConfigSettings;
}
diff --git a/gcloud-java-pubsub/pom.xml b/gcloud-java-pubsub/pom.xml
index cae94315abf9..4a7485450433 100644
--- a/gcloud-java-pubsub/pom.xml
+++ b/gcloud-java-pubsub/pom.xml
@@ -19,7 +19,7 @@
com.google.api
gax
- 0.0.9
+ 0.0.11
com.google.api.grpc
diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java
index 886945e0504e..6f7139bf4270 100644
--- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java
+++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherApi.java
@@ -33,6 +33,7 @@
package com.google.cloud.pubsub.spi.v1;
+import com.google.api.gax.core.PageAccessor;
import com.google.api.gax.grpc.ApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.protobuf.Empty;
@@ -59,6 +60,60 @@
* Service Description: The service that an application uses to manipulate topics, and to send
* messages to a topic.
*
+ * This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ *
+ *
+ * try (PublisherApi publisherApi = PublisherApi.defaultInstance()) {
+ * // make calls here
+ * String name = "";
+ * Topic callResult = createTopic(name);
+ * }
+ *
+ *
+ *
+ * Note: close() needs to be called on the publisherApi object to clean up resources such
+ * as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's methods:
+ *
+ *
+ * - A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available
+ * as parameters, and not every API method will have a flattened method entry point.
+ *
- A "request object" method. This type of method only takes one parameter, a request
+ * object, which must be constructed before the call. Not every API method will have a request
+ * object method.
+ *
- A "callable" method. This type of method takes no parameters and returns an immutable
+ * ApiCallable object, which can be used to initiate calls to the service.
+ *
+ *
+ * See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist
+ * with these names, this class includes a format method for each type of name, and additionally
+ * a parse method to extract the individual identifiers contained within names that are
+ * returned.
+ *
+ *
This class can be customized by passing in a custom instance of PublisherSettings to
+ * create(). For example:
+ *
+ *
+ *
+ *
+ * ConnectionSettings defaultConnectionSettings =
+ * PublisherSettings.defaultInstance().toBuilder().getConnectionSettings();
+ * ConnectionSettings updatedConnectionSettings =
+ * defaultConnectionSettings.toBuilder().provideCredentialsWith(myCredentials).build();
+ * PublisherSettings publisherSettings = PublisherSettings.defaultInstance().toBuilder().
+ * provideChannelWith(updatedConnectionSettings)
+ * .build();
+ * PublisherApi publisherApi = PublisherApi.create(publisherSettings);
+ *
+ *
+ *
*
*
*/
@@ -71,11 +126,11 @@ public class PublisherApi implements AutoCloseable {
private final ApiCallable publishCallable;
private final ApiCallable getTopicCallable;
private final ApiCallable listTopicsCallable;
- private final ApiCallable> listTopicsIterableCallable;
+ private final ApiCallable> listTopicsPagedCallable;
private final ApiCallable
listTopicSubscriptionsCallable;
- private final ApiCallable>
- listTopicSubscriptionsIterableCallable;
+ private final ApiCallable>
+ listTopicSubscriptionsPagedCallable;
private final ApiCallable deleteTopicCallable;
private static final PathTemplate PROJECT_PATH_TEMPLATE =
@@ -179,12 +234,12 @@ protected PublisherApi(PublisherSettings settings) throws IOException {
}
this.getTopicCallable = ApiCallable.create(settings.getTopicSettings(), settings);
this.listTopicsCallable = ApiCallable.create(settings.listTopicsSettings(), settings);
- this.listTopicsIterableCallable =
- ApiCallable.createIterable(settings.listTopicsSettings(), settings);
+ this.listTopicsPagedCallable =
+ ApiCallable.createPagedVariant(settings.listTopicsSettings(), settings);
this.listTopicSubscriptionsCallable =
ApiCallable.create(settings.listTopicSubscriptionsSettings(), settings);
- this.listTopicSubscriptionsIterableCallable =
- ApiCallable.createIterable(settings.listTopicSubscriptionsSettings(), settings);
+ this.listTopicSubscriptionsPagedCallable =
+ ApiCallable.createPagedVariant(settings.listTopicSubscriptionsSettings(), settings);
this.deleteTopicCallable = ApiCallable.create(settings.deleteTopicSettings(), settings);
if (settings.shouldAutoCloseChannel()) {
@@ -213,7 +268,7 @@ public void close() throws IOException {
* underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
* signs (`%`). It must be between 3 and 255 characters in length, and it
* must not start with `"goog"`.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Topic createTopic(String name) {
Topic request = Topic.newBuilder().setName(name).build();
@@ -229,7 +284,7 @@ public final Topic createTopic(String name) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private Topic createTopic(Topic request) {
return createTopicCallable().call(request);
@@ -241,7 +296,7 @@ private Topic createTopic(Topic request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable createTopicCallable() {
return createTopicCallable;
@@ -260,7 +315,7 @@ public final ApiCallable createTopicCallable() {
*
* @param topic The messages in the request will be published on this topic.
* @param messages The messages to publish.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final PublishResponse publish(String topic, List messages) {
PublishRequest request =
@@ -279,7 +334,7 @@ public final PublishResponse publish(String topic, List messages)
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public PublishResponse publish(PublishRequest request) {
return publishCallable().call(request);
@@ -293,7 +348,7 @@ public PublishResponse publish(PublishRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable publishCallable() {
return publishCallable;
@@ -309,7 +364,7 @@ public final ApiCallable publishCallable() {
*
*
* @param topic The name of the topic to get.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Topic getTopic(String topic) {
GetTopicRequest request = GetTopicRequest.newBuilder().setTopic(topic).build();
@@ -325,7 +380,7 @@ public final Topic getTopic(String topic) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private Topic getTopic(GetTopicRequest request) {
return getTopicCallable().call(request);
@@ -337,7 +392,7 @@ private Topic getTopic(GetTopicRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable getTopicCallable() {
return getTopicCallable;
@@ -353,9 +408,9 @@ public final ApiCallable getTopicCallable() {
*
*
* @param project The name of the cloud project that topics belong to.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listTopics(String project) {
+ public final PageAccessor listTopics(String project) {
ListTopicsRequest request = ListTopicsRequest.newBuilder().setProject(project).build();
return listTopics(request);
}
@@ -368,10 +423,10 @@ public final Iterable listTopics(String project) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listTopics(ListTopicsRequest request) {
- return listTopicsIterableCallable().call(request);
+ public final PageAccessor listTopics(ListTopicsRequest request) {
+ return listTopicsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -380,10 +435,10 @@ public final Iterable listTopics(ListTopicsRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final ApiCallable> listTopicsIterableCallable() {
- return listTopicsIterableCallable;
+ public final ApiCallable> listTopicsPagedCallable() {
+ return listTopicsPagedCallable;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -392,7 +447,7 @@ public final ApiCallable> listTopicsIterableC
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable listTopicsCallable() {
return listTopicsCallable;
@@ -408,9 +463,9 @@ public final ApiCallable listTopicsCallab
*
*
* @param topic The name of the topic that subscriptions are attached to.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listTopicSubscriptions(String topic) {
+ public final PageAccessor listTopicSubscriptions(String topic) {
ListTopicSubscriptionsRequest request =
ListTopicSubscriptionsRequest.newBuilder().setTopic(topic).build();
return listTopicSubscriptions(request);
@@ -424,10 +479,10 @@ public final Iterable listTopicSubscriptions(String topic) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listTopicSubscriptions(ListTopicSubscriptionsRequest request) {
- return listTopicSubscriptionsIterableCallable().call(request);
+ public final PageAccessor listTopicSubscriptions(ListTopicSubscriptionsRequest request) {
+ return listTopicSubscriptionsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -436,11 +491,11 @@ public final Iterable listTopicSubscriptions(ListTopicSubscriptionsReque
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final ApiCallable>
- listTopicSubscriptionsIterableCallable() {
- return listTopicSubscriptionsIterableCallable;
+ public final ApiCallable>
+ listTopicSubscriptionsPagedCallable() {
+ return listTopicSubscriptionsPagedCallable;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -449,7 +504,7 @@ public final Iterable listTopicSubscriptions(ListTopicSubscriptionsReque
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable
listTopicSubscriptionsCallable() {
@@ -470,7 +525,7 @@ public final Iterable listTopicSubscriptions(ListTopicSubscriptionsReque
*
*
* @param topic Name of the topic to delete.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void deleteTopic(String topic) {
DeleteTopicRequest request = DeleteTopicRequest.newBuilder().setTopic(topic).build();
@@ -490,7 +545,7 @@ public final void deleteTopic(String topic) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private void deleteTopic(DeleteTopicRequest request) {
deleteTopicCallable().call(request);
@@ -506,7 +561,7 @@ private void deleteTopic(DeleteTopicRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable deleteTopicCallable() {
return deleteTopicCallable;
diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java
index 72d24404d87a..230adc5ec35c 100644
--- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java
+++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/PublisherSettings.java
@@ -73,6 +73,32 @@
// Manually-added imports: add custom (non-generated) imports after this point.
// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing.
+/**
+ * Settings class to configure an instance of {@link PublisherApi}.
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ *
+ * - The default service address (pubsub-experimental.googleapis.com) and default port (443)
+ * are used.
+ *
- Credentials are acquired automatically through Application Default Credentials.
+ *
- Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders.
+ * When build() is called, the tree of builders is called to create the complete settings
+ * object. For example, to set the total timeout of CreateTopic to 30 seconds:
+ *
+ *
+ *
+ * PublisherSettings.Builder publisherSettingsBuilder =
+ * PublisherSettings.defaultInstance().toBuilder();
+ * publisherSettingsBuilder.CreateTopicSettings().getRetrySettingsBuilder()
+ * .setTotalTimeout(Duration.standardSeconds(30));
+ * PublisherSettings publisherSettings = publisherSettingsBuilder.build();
+ *
+ *
+ */
@javax.annotation.Generated("by GAPIC")
public class PublisherSettings extends ServiceApiSettings {
@@ -113,41 +139,68 @@ public class PublisherSettings extends ServiceApiSettings {
private final SimpleCallSettings deleteTopicSettings;
+ /**
+ * Returns the object with the settings used for calls to createTopic.
+ */
public SimpleCallSettings createTopicSettings() {
return createTopicSettings;
}
+ /**
+ * Returns the object with the settings used for calls to publish.
+ */
public BundlingCallSettings publishSettings() {
return publishSettings;
}
+ /**
+ * Returns the object with the settings used for calls to getTopic.
+ */
public SimpleCallSettings getTopicSettings() {
return getTopicSettings;
}
+ /**
+ * Returns the object with the settings used for calls to listTopics.
+ */
public PageStreamingCallSettings
listTopicsSettings() {
return listTopicsSettings;
}
+ /**
+ * Returns the object with the settings used for calls to listTopicSubscriptions.
+ */
public PageStreamingCallSettings<
ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>
listTopicSubscriptionsSettings() {
return listTopicSubscriptionsSettings;
}
+ /**
+ * Returns the object with the settings used for calls to deleteTopic.
+ */
public SimpleCallSettings deleteTopicSettings() {
return deleteTopicSettings;
}
+ /**
+ * Returns an instance of this class with recommended defaults.
+ */
public static PublisherSettings defaultInstance() throws IOException {
return newBuilder().build();
}
+ /**
+ * Returns a new builder for this class.
+ */
public static Builder newBuilder() {
return new Builder();
}
+ /**
+ * Returns a builder containing all the values of this settings class.
+ */
public Builder toBuilder() {
return new Builder(this);
}
@@ -286,6 +339,9 @@ public long countBytes(PublishRequest request) {
}
};
+ /**
+ * Builder for PublisherSettings.
+ */
public static class Builder extends ServiceApiSettings.Builder {
private final ImmutableList methodSettingsBuilders;
@@ -332,7 +388,7 @@ public static class Builder extends ServiceApiSettings.Builder {
private Builder() {
super(
- ConnectionSettings.builder()
+ ConnectionSettings.newBuilder()
.setServiceAddress(DEFAULT_SERVICE_ADDRESS)
.setPort(DEFAULT_SERVICE_PORT)
.provideCredentialsWith(DEFAULT_SERVICE_SCOPES)
@@ -440,34 +496,57 @@ public Builder setClientLibHeader(String name, String version) {
return this;
}
+ /**
+ * Applies the given settings to all of the API methods in this service. Only
+ * values that are non-null will be applied, so this method is not capable
+ * of un-setting any values.
+ */
public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
return this;
}
+ /**
+ * Returns the builder for the settings used for calls to createTopic.
+ */
public SimpleCallSettings.Builder createTopicSettings() {
return createTopicSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to publish.
+ */
public BundlingCallSettings.Builder publishSettings() {
return publishSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to getTopic.
+ */
public SimpleCallSettings.Builder getTopicSettings() {
return getTopicSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to listTopics.
+ */
public PageStreamingCallSettings.Builder
listTopicsSettings() {
return listTopicsSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to listTopicSubscriptions.
+ */
public PageStreamingCallSettings.Builder<
ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse, String>
listTopicSubscriptionsSettings() {
return listTopicSubscriptionsSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to deleteTopic.
+ */
public SimpleCallSettings.Builder deleteTopicSettings() {
return deleteTopicSettings;
}
diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
index 2bfafd62ef0e..322154991e5b 100644
--- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
+++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberApi.java
@@ -33,6 +33,7 @@
package com.google.cloud.pubsub.spi.v1;
+import com.google.api.gax.core.PageAccessor;
import com.google.api.gax.grpc.ApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.protobuf.Empty;
@@ -60,6 +61,63 @@
* Service Description: The service that an application uses to manipulate subscriptions and to
* consume messages from a subscription via the `Pull` method.
*
+ * This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ *
+ *
+ * try (SubscriberApi subscriberApi = SubscriberApi.defaultInstance()) {
+ * // make calls here
+ * String name = "";
+ * String topic = "";
+ * PushConfig pushConfig = PushConfig.newBuilder().build();
+ * int ackDeadlineSeconds = 0;
+ * Subscription callResult = createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ * }
+ *
+ *
+ *
+ * Note: close() needs to be called on the subscriberApi object to clean up resources such
+ * as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's methods:
+ *
+ *
+ * - A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available
+ * as parameters, and not every API method will have a flattened method entry point.
+ *
- A "request object" method. This type of method only takes one parameter, a request
+ * object, which must be constructed before the call. Not every API method will have a request
+ * object method.
+ *
- A "callable" method. This type of method takes no parameters and returns an immutable
+ * ApiCallable object, which can be used to initiate calls to the service.
+ *
+ *
+ * See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist
+ * with these names, this class includes a format method for each type of name, and additionally
+ * a parse method to extract the individual identifiers contained within names that are
+ * returned.
+ *
+ *
This class can be customized by passing in a custom instance of SubscriberSettings to
+ * create(). For example:
+ *
+ *
+ *
+ *
+ * ConnectionSettings defaultConnectionSettings =
+ * SubscriberSettings.defaultInstance().toBuilder().getConnectionSettings();
+ * ConnectionSettings updatedConnectionSettings =
+ * defaultConnectionSettings.toBuilder().provideCredentialsWith(myCredentials).build();
+ * SubscriberSettings subscriberSettings = SubscriberSettings.defaultInstance().toBuilder().
+ * provideChannelWith(updatedConnectionSettings)
+ * .build();
+ * SubscriberApi subscriberApi = SubscriberApi.create(subscriberSettings);
+ *
+ *
+ *
*
*
*/
@@ -72,8 +130,8 @@ public class SubscriberApi implements AutoCloseable {
private final ApiCallable getSubscriptionCallable;
private final ApiCallable
listSubscriptionsCallable;
- private final ApiCallable>
- listSubscriptionsIterableCallable;
+ private final ApiCallable>
+ listSubscriptionsPagedCallable;
private final ApiCallable deleteSubscriptionCallable;
private final ApiCallable modifyAckDeadlineCallable;
private final ApiCallable acknowledgeCallable;
@@ -179,8 +237,8 @@ protected SubscriberApi(SubscriberSettings settings) throws IOException {
this.getSubscriptionCallable = ApiCallable.create(settings.getSubscriptionSettings(), settings);
this.listSubscriptionsCallable =
ApiCallable.create(settings.listSubscriptionsSettings(), settings);
- this.listSubscriptionsIterableCallable =
- ApiCallable.createIterable(settings.listSubscriptionsSettings(), settings);
+ this.listSubscriptionsPagedCallable =
+ ApiCallable.createPagedVariant(settings.listSubscriptionsSettings(), settings);
this.deleteSubscriptionCallable =
ApiCallable.create(settings.deleteSubscriptionSettings(), settings);
this.modifyAckDeadlineCallable =
@@ -243,7 +301,7 @@ public void close() throws IOException {
* system will eventually redeliver the message.
*
* If this parameter is not set, the default value of 10 seconds is used.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Subscription createSubscription(
String name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) {
@@ -271,7 +329,7 @@ public final Subscription createSubscription(
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public Subscription createSubscription(Subscription request) {
return createSubscriptionCallable().call(request);
@@ -288,7 +346,7 @@ public Subscription createSubscription(Subscription request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable createSubscriptionCallable() {
return createSubscriptionCallable;
@@ -307,7 +365,7 @@ public final ApiCallable createSubscriptionCallable(
*
*
* @param subscription The name of the subscription to get.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final Subscription getSubscription(String subscription) {
GetSubscriptionRequest request =
@@ -327,7 +385,7 @@ public final Subscription getSubscription(String subscription) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private Subscription getSubscription(GetSubscriptionRequest request) {
return getSubscriptionCallable().call(request);
@@ -342,7 +400,7 @@ private Subscription getSubscription(GetSubscriptionRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable getSubscriptionCallable() {
return getSubscriptionCallable;
@@ -361,9 +419,9 @@ public final ApiCallable getSubscriptionCa
*
*
* @param project The name of the cloud project that subscriptions belong to.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listSubscriptions(String project) {
+ public final PageAccessor listSubscriptions(String project) {
ListSubscriptionsRequest request =
ListSubscriptionsRequest.newBuilder().setProject(project).build();
return listSubscriptions(request);
@@ -380,10 +438,10 @@ public final Iterable listSubscriptions(String project) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final Iterable listSubscriptions(ListSubscriptionsRequest request) {
- return listSubscriptionsIterableCallable().call(request);
+ public final PageAccessor listSubscriptions(ListSubscriptionsRequest request) {
+ return listSubscriptionsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -395,11 +453,11 @@ public final Iterable listSubscriptions(ListSubscriptionsRequest r
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
- public final ApiCallable>
- listSubscriptionsIterableCallable() {
- return listSubscriptionsIterableCallable;
+ public final ApiCallable>
+ listSubscriptionsPagedCallable() {
+ return listSubscriptionsPagedCallable;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
@@ -411,7 +469,7 @@ public final Iterable listSubscriptions(ListSubscriptionsRequest r
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable
listSubscriptionsCallable() {
@@ -432,7 +490,7 @@ public final Iterable listSubscriptions(ListSubscriptionsRequest r
*
*
* @param subscription The subscription to delete.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void deleteSubscription(String subscription) {
DeleteSubscriptionRequest request =
@@ -453,7 +511,7 @@ public final void deleteSubscription(String subscription) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
private void deleteSubscription(DeleteSubscriptionRequest request) {
deleteSubscriptionCallable().call(request);
@@ -469,7 +527,7 @@ private void deleteSubscription(DeleteSubscriptionRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable deleteSubscriptionCallable() {
return deleteSubscriptionCallable;
@@ -494,7 +552,7 @@ public final ApiCallable deleteSubscriptionCal
* ack deadline will expire 10 seconds after the `ModifyAckDeadline` call
* was made. Specifying zero may immediately make the message available for
* another pull request.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void modifyAckDeadline(
String subscription, List ackIds, int ackDeadlineSeconds) {
@@ -519,7 +577,7 @@ public final void modifyAckDeadline(
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public void modifyAckDeadline(ModifyAckDeadlineRequest request) {
modifyAckDeadlineCallable().call(request);
@@ -534,7 +592,7 @@ public void modifyAckDeadline(ModifyAckDeadlineRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable modifyAckDeadlineCallable() {
return modifyAckDeadlineCallable;
@@ -558,7 +616,7 @@ public final ApiCallable modifyAckDeadlineCalla
* @param subscription The subscription whose message is being acknowledged.
* @param ackIds The acknowledgment ID for the messages being acknowledged that was returned
* by the Pub/Sub system in the `Pull` response. Must not be empty.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void acknowledge(String subscription, List ackIds) {
AcknowledgeRequest request =
@@ -581,7 +639,7 @@ public final void acknowledge(String subscription, List ackIds) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public void acknowledge(AcknowledgeRequest request) {
acknowledgeCallable().call(request);
@@ -599,7 +657,7 @@ public void acknowledge(AcknowledgeRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable acknowledgeCallable() {
return acknowledgeCallable;
@@ -624,7 +682,7 @@ public final ApiCallable acknowledgeCallable() {
* than returning no messages.
* @param maxMessages The maximum number of messages returned for this request. The Pub/Sub
* system may return fewer than the number specified.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final PullResponse pull(String subscription, boolean returnImmediately, int maxMessages) {
PullRequest request =
@@ -648,7 +706,7 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public PullResponse pull(PullRequest request) {
return pullCallable().call(request);
@@ -663,7 +721,7 @@ public PullResponse pull(PullRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable pullCallable() {
return pullCallable;
@@ -690,7 +748,7 @@ public final ApiCallable pullCallable() {
* stop pushing messages from the given subscription and allow
* messages to be pulled and acknowledged - effectively pausing
* the subscription if `Pull` is not called.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void modifyPushConfig(String subscription, PushConfig pushConfig) {
ModifyPushConfigRequest request =
@@ -715,7 +773,7 @@ public final void modifyPushConfig(String subscription, PushConfig pushConfig) {
*
*
* @param request The request object containing all of the parameters for the API call.
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public void modifyPushConfig(ModifyPushConfigRequest request) {
modifyPushConfigCallable().call(request);
@@ -732,7 +790,7 @@ public void modifyPushConfig(ModifyPushConfigRequest request) {
*
*
*
- * @throws ApiException if the remote call fails
+ * @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final ApiCallable modifyPushConfigCallable() {
return modifyPushConfigCallable;
diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java
index a46c956ae29d..39fdadccea2a 100644
--- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java
+++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/SubscriberSettings.java
@@ -66,6 +66,32 @@
// Manually-added imports: add custom (non-generated) imports after this point.
// AUTO-GENERATED DOCUMENTATION AND CLASS - see instructions at the top of the file for editing.
+/**
+ * Settings class to configure an instance of {@link SubscriberApi}.
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ *
+ * - The default service address (pubsub-experimental.googleapis.com) and default port (443)
+ * are used.
+ *
- Credentials are acquired automatically through Application Default Credentials.
+ *
- Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders.
+ * When build() is called, the tree of builders is called to create the complete settings
+ * object. For example, to set the total timeout of CreateSubscription to 30 seconds:
+ *
+ *
+ *
+ * SubscriberSettings.Builder subscriberSettingsBuilder =
+ * SubscriberSettings.defaultInstance().toBuilder();
+ * subscriberSettingsBuilder.CreateSubscriptionSettings().getRetrySettingsBuilder()
+ * .setTotalTimeout(Duration.standardSeconds(30));
+ * SubscriberSettings subscriberSettings = subscriberSettingsBuilder.build();
+ *
+ *
+ */
@javax.annotation.Generated("by GAPIC")
public class SubscriberSettings extends ServiceApiSettings {
@@ -106,48 +132,81 @@ public class SubscriberSettings extends ServiceApiSettings {
private final SimpleCallSettings pullSettings;
private final SimpleCallSettings modifyPushConfigSettings;
+ /**
+ * Returns the object with the settings used for calls to createSubscription.
+ */
public SimpleCallSettings createSubscriptionSettings() {
return createSubscriptionSettings;
}
+ /**
+ * Returns the object with the settings used for calls to getSubscription.
+ */
public SimpleCallSettings getSubscriptionSettings() {
return getSubscriptionSettings;
}
+ /**
+ * Returns the object with the settings used for calls to listSubscriptions.
+ */
public PageStreamingCallSettings<
ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription>
listSubscriptionsSettings() {
return listSubscriptionsSettings;
}
+ /**
+ * Returns the object with the settings used for calls to deleteSubscription.
+ */
public SimpleCallSettings deleteSubscriptionSettings() {
return deleteSubscriptionSettings;
}
+ /**
+ * Returns the object with the settings used for calls to modifyAckDeadline.
+ */
public SimpleCallSettings modifyAckDeadlineSettings() {
return modifyAckDeadlineSettings;
}
+ /**
+ * Returns the object with the settings used for calls to acknowledge.
+ */
public SimpleCallSettings acknowledgeSettings() {
return acknowledgeSettings;
}
+ /**
+ * Returns the object with the settings used for calls to pull.
+ */
public SimpleCallSettings pullSettings() {
return pullSettings;
}
+ /**
+ * Returns the object with the settings used for calls to modifyPushConfig.
+ */
public SimpleCallSettings modifyPushConfigSettings() {
return modifyPushConfigSettings;
}
+ /**
+ * Returns an instance of this class with recommended defaults.
+ */
public static SubscriberSettings defaultInstance() throws IOException {
return newBuilder().build();
}
+ /**
+ * Returns a new builder for this class.
+ */
public static Builder newBuilder() {
return new Builder();
}
+ /**
+ * Returns a builder containing all the values of this settings class.
+ */
public Builder toBuilder() {
return new Builder(this);
}
@@ -202,6 +261,9 @@ public Iterable extractResources(ListSubscriptionsResponse payload
}
};
+ /**
+ * Builder for SubscriberSettings.
+ */
public static class Builder extends ServiceApiSettings.Builder {
private final ImmutableList methodSettingsBuilders;
@@ -250,7 +312,7 @@ public static class Builder extends ServiceApiSettings.Builder {
private Builder() {
super(
- ConnectionSettings.builder()
+ ConnectionSettings.newBuilder()
.setServiceAddress(DEFAULT_SERVICE_ADDRESS)
.setPort(DEFAULT_SERVICE_PORT)
.provideCredentialsWith(DEFAULT_SERVICE_SCOPES)
@@ -363,43 +425,72 @@ public Builder setClientLibHeader(String name, String version) {
return this;
}
+ /**
+ * Applies the given settings to all of the API methods in this service. Only
+ * values that are non-null will be applied, so this method is not capable
+ * of un-setting any values.
+ */
public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
return this;
}
+ /**
+ * Returns the builder for the settings used for calls to createSubscription.
+ */
public SimpleCallSettings.Builder createSubscriptionSettings() {
return createSubscriptionSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to getSubscription.
+ */
public SimpleCallSettings.Builder
getSubscriptionSettings() {
return getSubscriptionSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to listSubscriptions.
+ */
public PageStreamingCallSettings.Builder<
ListSubscriptionsRequest, ListSubscriptionsResponse, Subscription>
listSubscriptionsSettings() {
return listSubscriptionsSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to deleteSubscription.
+ */
public SimpleCallSettings.Builder
deleteSubscriptionSettings() {
return deleteSubscriptionSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to modifyAckDeadline.
+ */
public SimpleCallSettings.Builder modifyAckDeadlineSettings() {
return modifyAckDeadlineSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to acknowledge.
+ */
public SimpleCallSettings.Builder acknowledgeSettings() {
return acknowledgeSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to pull.
+ */
public SimpleCallSettings.Builder pullSettings() {
return pullSettings;
}
+ /**
+ * Returns the builder for the settings used for calls to modifyPushConfig.
+ */
public SimpleCallSettings.Builder modifyPushConfigSettings() {
return modifyPushConfigSettings;
}