Skip to content

Commit 3bf78a1

Browse files
committed
Update pubsub client with latest surface changes.
1 parent 564f181 commit 3bf78a1

10 files changed

Lines changed: 1119 additions & 879 deletions

File tree

gcloud-java-pubsub/baseline/src/main/java/com/google/gcloud/pubsub/spi/v1/PublisherApi.java

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
package com.google.gcloud.pubsub.spi.v1;
3535

3636
import com.google.api.gax.grpc.ApiCallable;
37-
import com.google.api.gax.grpc.ApiCallable.BundlableApiCallableInfo;
38-
import com.google.api.gax.grpc.BundlerFactory;
3937
import com.google.api.gax.protobuf.PathTemplate;
4038
import com.google.protobuf.Empty;
4139
import com.google.pubsub.v1.DeleteTopicRequest;
@@ -80,23 +78,9 @@ public class PublisherApi implements AutoCloseable {
8078
listTopicSubscriptionsIterableCallable;
8179
private final ApiCallable<DeleteTopicRequest, Empty> deleteTopicCallable;
8280

83-
/**
84-
* A PathTemplate representing the fully-qualified path to represent
85-
* a project resource.
86-
*
87-
* <!-- manual edit -->
88-
* <!-- end manual edit -->
89-
*/
9081
private static final PathTemplate PROJECT_PATH_TEMPLATE =
9182
PathTemplate.create("projects/{project}");
9283

93-
/**
94-
* A PathTemplate representing the fully-qualified path to represent
95-
* a topic resource.
96-
*
97-
* <!-- manual edit -->
98-
* <!-- end manual edit -->
99-
*/
10084
private static final PathTemplate TOPIC_PATH_TEMPLATE =
10185
PathTemplate.create("projects/{project}/topics/{topic}");
10286

@@ -161,8 +145,8 @@ public static final String parseTopicFromTopicName(String topicName) {
161145
* <!-- manual edit -->
162146
* <!-- end manual edit -->
163147
*/
164-
public static final PublisherApi create() throws IOException {
165-
return create(PublisherSettings.create());
148+
public static final PublisherApi defaultInstance() throws IOException {
149+
return create(PublisherSettings.defaultInstance());
166150
}
167151

168152
/**
@@ -188,22 +172,20 @@ public static final PublisherApi create(PublisherSettings settings) throws IOExc
188172
protected PublisherApi(PublisherSettings settings) throws IOException {
189173
this.channel = settings.getChannel();
190174

191-
this.createTopicCallable = settings.createTopicMethod().build(settings);
192-
BundlableApiCallableInfo<PublishRequest, PublishResponse> bundlablePublish =
193-
settings.publishMethod().buildBundlable(settings);
194-
this.publishCallable = bundlablePublish.getApiCallable();
195-
BundlerFactory<PublishRequest, PublishResponse> publishBundlerFactory =
196-
bundlablePublish.getBundlerFactory();
197-
if (publishBundlerFactory != null) {
198-
this.closeables.add(publishBundlerFactory);
175+
this.createTopicCallable = ApiCallable.create(settings.createTopicSettings(), settings);
176+
this.publishCallable = ApiCallable.create(settings.publishSettings(), settings);
177+
if (settings.publishSettings().getBundlerFactory() != null) {
178+
closeables.add(settings.publishSettings().getBundlerFactory());
199179
}
200-
this.getTopicCallable = settings.getTopicMethod().build(settings);
201-
this.listTopicsCallable = settings.listTopicsMethod().build(settings);
202-
this.listTopicsIterableCallable = settings.listTopicsMethod().buildPageStreaming(settings);
203-
this.listTopicSubscriptionsCallable = settings.listTopicSubscriptionsMethod().build(settings);
180+
this.getTopicCallable = ApiCallable.create(settings.getTopicSettings(), settings);
181+
this.listTopicsCallable = ApiCallable.create(settings.listTopicsSettings(), settings);
182+
this.listTopicsIterableCallable =
183+
ApiCallable.createIterable(settings.listTopicsSettings(), settings);
184+
this.listTopicSubscriptionsCallable =
185+
ApiCallable.create(settings.listTopicSubscriptionsSettings(), settings);
204186
this.listTopicSubscriptionsIterableCallable =
205-
settings.listTopicSubscriptionsMethod().buildPageStreaming(settings);
206-
this.deleteTopicCallable = settings.deleteTopicMethod().build(settings);
187+
ApiCallable.createIterable(settings.listTopicSubscriptionsSettings(), settings);
188+
this.deleteTopicCallable = ApiCallable.create(settings.deleteTopicSettings(), settings);
207189

208190
if (settings.shouldAutoCloseChannel()) {
209191
closeables.add(
@@ -360,6 +342,8 @@ public final ApiCallable<GetTopicRequest, Topic> getTopicCallable() {
360342
*
361343
* <!-- manual edit -->
362344
* <!-- end manual edit -->
345+
*
346+
* @param project The name of the cloud project that topics belong to.
363347
*/
364348
public final Iterable<Topic> listTopics(String project) {
365349
ListTopicsRequest request = ListTopicsRequest.newBuilder().setProject(project).build();
@@ -409,6 +393,8 @@ public final ApiCallable<ListTopicsRequest, ListTopicsResponse> listTopicsCallab
409393
*
410394
* <!-- manual edit -->
411395
* <!-- end manual edit -->
396+
*
397+
* @param topic The name of the topic that subscriptions are attached to.
412398
*/
413399
public final Iterable<String> listTopicSubscriptions(String topic) {
414400
ListTopicSubscriptionsRequest request =

0 commit comments

Comments
 (0)