Skip to content

Commit 319529a

Browse files
committed
Updated surface and tests
Regenerated surface using edited proto Removed blank line from comments in generator snip Updated DefaultPubSubRpc with provideChannelWith
1 parent 773f3f9 commit 319529a

File tree

5 files changed

+88
-57
lines changed

5 files changed

+88
-57
lines changed

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

+6-7
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
* <code>
6969
* try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
7070
* String name = "";
71-
*
7271
* Topic callResult = publisherApi.createTopic(name);
7372
* }
7473
* </code>
@@ -324,7 +323,7 @@ public final ApiCallable<Topic, Topic> createTopicCallable() {
324323

325324
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
326325
/**
327-
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
326+
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
328327
* does not exist. The message payload must not be empty; it must contain
329328
* either a non-empty data field, or at least one attribute.
330329
*
@@ -344,7 +343,7 @@ public final PublishResponse publish(String topic, List<PubsubMessage> messages)
344343

345344
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
346345
/**
347-
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
346+
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
348347
* does not exist. The message payload must not be empty; it must contain
349348
* either a non-empty data field, or at least one attribute.
350349
*
@@ -360,7 +359,7 @@ public PublishResponse publish(PublishRequest request) {
360359

361360
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
362361
/**
363-
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
362+
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
364363
* does not exist. The message payload must not be empty; it must contain
365364
* either a non-empty data field, or at least one attribute.
366365
*
@@ -527,7 +526,7 @@ public final PageAccessor<String> listTopicSubscriptions(ListTopicSubscriptionsR
527526

528527
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
529528
/**
530-
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
529+
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
531530
* does not exist. After a topic is deleted, a new topic may be created with
532531
* the same name; this is an entirely new topic with none of the old
533532
* configuration or subscriptions. Existing subscriptions to this topic are
@@ -547,7 +546,7 @@ public final void deleteTopic(String topic) {
547546

548547
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
549548
/**
550-
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
549+
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
551550
* does not exist. After a topic is deleted, a new topic may be created with
552551
* the same name; this is an entirely new topic with none of the old
553552
* configuration or subscriptions. Existing subscriptions to this topic are
@@ -565,7 +564,7 @@ private void deleteTopic(DeleteTopicRequest request) {
565564

566565
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
567566
/**
568-
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
567+
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
569568
* does not exist. After a topic is deleted, a new topic may be created with
570569
* the same name; this is an entirely new topic with none of the old
571570
* configuration or subscriptions. Existing subscriptions to this topic are

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

+34-17
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
* String topic = "";
7373
* PushConfig pushConfig = PushConfig.newBuilder().build();
7474
* int ackDeadlineSeconds = 0;
75-
*
7675
* Subscription callResult = subscriberApi.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
7776
* }
7877
* </code>
@@ -316,8 +315,8 @@ public void close() throws IOException {
316315
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
317316
/**
318317
* Creates a subscription to a given topic for a given subscriber.
319-
* If the subscription already exists, returns `ALREADY_EXISTS`.
320-
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
318+
* If the subscription already exists, generates `ALREADY_EXISTS`.
319+
* If the corresponding topic doesn't exist, generates `NOT_FOUND`.
321320
*
322321
* If the name is not provided in the request, the server will assign a random
323322
* name for this subscription on the same project as the topic.
@@ -332,8 +331,6 @@ public void close() throws IOException {
332331
* plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
333332
* in length, and it must not start with `"goog"`.
334333
* @param topic The name of the topic from which this subscription is receiving messages.
335-
* The value of this field will be `_deleted-topic_` if the topic has been
336-
* deleted.
337334
* @param pushConfig If push delivery is used with this subscription, this field is
338335
* used to configure it. An empty `pushConfig` signifies that the subscriber
339336
* will pull and ack messages using API methods.
@@ -373,8 +370,8 @@ public final Subscription createSubscription(
373370
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
374371
/**
375372
* Creates a subscription to a given topic for a given subscriber.
376-
* If the subscription already exists, returns `ALREADY_EXISTS`.
377-
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
373+
* If the subscription already exists, generates `ALREADY_EXISTS`.
374+
* If the corresponding topic doesn't exist, generates `NOT_FOUND`.
378375
*
379376
* If the name is not provided in the request, the server will assign a random
380377
* name for this subscription on the same project as the topic.
@@ -392,8 +389,8 @@ public Subscription createSubscription(Subscription request) {
392389
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
393390
/**
394391
* Creates a subscription to a given topic for a given subscriber.
395-
* If the subscription already exists, returns `ALREADY_EXISTS`.
396-
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
392+
* If the subscription already exists, generates `ALREADY_EXISTS`.
393+
* If the corresponding topic doesn't exist, generates `NOT_FOUND`.
397394
*
398395
* If the name is not provided in the request, the server will assign a random
399396
* name for this subscription on the same project as the topic.
@@ -411,6 +408,9 @@ public final ApiCallable<Subscription, Subscription> createSubscriptionCallable(
411408
/**
412409
* Gets the configuration details of a subscription.
413410
*
411+
* If the topic of a subscription has been deleted, the subscription itself is
412+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
413+
*
414414
* <!-- manual edit -->
415415
* <!-- end manual edit -->
416416
*
@@ -428,6 +428,9 @@ public final Subscription getSubscription(String subscription) {
428428
/**
429429
* Gets the configuration details of a subscription.
430430
*
431+
* If the topic of a subscription has been deleted, the subscription itself is
432+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
433+
*
431434
* <!-- manual edit -->
432435
* <!-- end manual edit -->
433436
*
@@ -442,6 +445,9 @@ private Subscription getSubscription(GetSubscriptionRequest request) {
442445
/**
443446
* Gets the configuration details of a subscription.
444447
*
448+
* If the topic of a subscription has been deleted, the subscription itself is
449+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
450+
*
445451
* <!-- manual edit -->
446452
* <!-- end manual edit -->
447453
*/
@@ -455,6 +461,9 @@ public final ApiCallable<GetSubscriptionRequest, Subscription> getSubscriptionCa
455461
/**
456462
* Lists matching subscriptions.
457463
*
464+
* If the topic of a subscription has been deleted, the subscription itself is
465+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
466+
*
458467
* <!-- manual edit -->
459468
* <!-- end manual edit -->
460469
*
@@ -471,6 +480,9 @@ public final PageAccessor<Subscription> listSubscriptions(String project) {
471480
/**
472481
* Lists matching subscriptions.
473482
*
483+
* If the topic of a subscription has been deleted, the subscription itself is
484+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
485+
*
474486
* <!-- manual edit -->
475487
* <!-- end manual edit -->
476488
*
@@ -485,6 +497,9 @@ public final PageAccessor<Subscription> listSubscriptions(ListSubscriptionsReque
485497
/**
486498
* Lists matching subscriptions.
487499
*
500+
* If the topic of a subscription has been deleted, the subscription itself is
501+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
502+
*
488503
* <!-- manual edit -->
489504
* <!-- end manual edit -->
490505
*/
@@ -497,6 +512,9 @@ public final PageAccessor<Subscription> listSubscriptions(ListSubscriptionsReque
497512
/**
498513
* Lists matching subscriptions.
499514
*
515+
* If the topic of a subscription has been deleted, the subscription itself is
516+
* not deleted, but the value of the `topic` field is set to `_deleted-topic_`.
517+
*
500518
* <!-- manual edit -->
501519
* <!-- end manual edit -->
502520
*/
@@ -510,7 +528,7 @@ public final PageAccessor<Subscription> listSubscriptions(ListSubscriptionsReque
510528
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
511529
/**
512530
* Deletes an existing subscription. All pending messages in the subscription
513-
* are immediately dropped. Calls to `Pull` after deletion will return
531+
* are immediately dropped. Calls to `Pull` after deletion will generate
514532
* `NOT_FOUND`. After a subscription is deleted, a new one may be created with
515533
* the same name, but the new one has no association with the old
516534
* subscription, or its topic unless the same topic is specified.
@@ -531,7 +549,7 @@ public final void deleteSubscription(String subscription) {
531549
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
532550
/**
533551
* Deletes an existing subscription. All pending messages in the subscription
534-
* are immediately dropped. Calls to `Pull` after deletion will return
552+
* are immediately dropped. Calls to `Pull` after deletion will generate
535553
* `NOT_FOUND`. After a subscription is deleted, a new one may be created with
536554
* the same name, but the new one has no association with the old
537555
* subscription, or its topic unless the same topic is specified.
@@ -549,7 +567,7 @@ private void deleteSubscription(DeleteSubscriptionRequest request) {
549567
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
550568
/**
551569
* Deletes an existing subscription. All pending messages in the subscription
552-
* are immediately dropped. Calls to `Pull` after deletion will return
570+
* are immediately dropped. Calls to `Pull` after deletion will generate
553571
* `NOT_FOUND`. After a subscription is deleted, a new one may be created with
554572
* the same name, but the new one has no association with the old
555573
* subscription, or its topic unless the same topic is specified.
@@ -694,7 +712,7 @@ public final ApiCallable<AcknowledgeRequest, Empty> acknowledgeCallable() {
694712
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
695713
/**
696714
* Pulls messages from the server. Returns an empty list if there are no
697-
* messages available in the backlog. The server may return `UNAVAILABLE` if
715+
* messages available in the backlog. The server may generate `UNAVAILABLE` if
698716
* there are too many concurrent pull requests pending for the given
699717
* subscription.
700718
*
@@ -705,8 +723,7 @@ public final ApiCallable<AcknowledgeRequest, Empty> acknowledgeCallable() {
705723
* @param returnImmediately If this is specified as true the system will respond immediately even if
706724
* it is not able to return a message in the `Pull` response. Otherwise the
707725
* system is allowed to wait until at least one message is available rather
708-
* than returning no messages. The client may cancel the request if it does
709-
* not wish to wait any longer for the response.
726+
* than returning no messages.
710727
* @param maxMessages The maximum number of messages returned for this request. The Pub/Sub
711728
* system may return fewer than the number specified.
712729
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
@@ -725,7 +742,7 @@ public final PullResponse pull(String subscription, boolean returnImmediately, i
725742
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
726743
/**
727744
* Pulls messages from the server. Returns an empty list if there are no
728-
* messages available in the backlog. The server may return `UNAVAILABLE` if
745+
* messages available in the backlog. The server may generate `UNAVAILABLE` if
729746
* there are too many concurrent pull requests pending for the given
730747
* subscription.
731748
*
@@ -742,7 +759,7 @@ public PullResponse pull(PullRequest request) {
742759
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
743760
/**
744761
* Pulls messages from the server. Returns an empty list if there are no
745-
* messages available in the backlog. The server may return `UNAVAILABLE` if
762+
* messages available in the backlog. The server may generate `UNAVAILABLE` if
746763
* there are too many concurrent pull requests pending for the given
747764
* subscription.
748765
*

gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/DefaultPubSubRpc.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.cloud.pubsub.spi;
1818

19-
import com.google.api.gax.core.ConnectionSettings;
2019
import com.google.api.gax.core.RetrySettings;
2120
import com.google.api.gax.grpc.ApiCallSettings;
2221
import com.google.api.gax.grpc.ApiException;
@@ -69,15 +68,15 @@ public DefaultPubSubRpc(PubSubOptions options) throws IOException {
6968
try {
7069
// Provide (and use a common thread-pool).
7170
// This depends on https://github.com/googleapis/gax-java/issues/73
72-
PublisherSettings.Builder pbuilder = PublisherSettings.defaultBuilder();
73-
pbuilder.provideChannelWith(ConnectionSettings.newBuilder()
74-
.provideCredentialsWith(options.authCredentials().credentials()).build());
75-
pbuilder.applyToAllApiMethods(apiCallSettings(options));
71+
PublisherSettings.Builder pbuilder =
72+
PublisherSettings.defaultBuilder()
73+
.provideChannelWith(options.authCredentials().credentials())
74+
.applyToAllApiMethods(apiCallSettings(options));
7675
publisherApi = PublisherApi.create(pbuilder.build());
77-
SubscriberSettings.Builder sBuilder = SubscriberSettings.defaultBuilder();
78-
sBuilder.provideChannelWith(ConnectionSettings.newBuilder()
79-
.provideCredentialsWith(options.authCredentials().credentials()).build());
80-
sBuilder.applyToAllApiMethods(apiCallSettings(options));
76+
SubscriberSettings.Builder sBuilder =
77+
SubscriberSettings.defaultBuilder()
78+
.provideChannelWith(options.authCredentials().credentials())
79+
.applyToAllApiMethods(apiCallSettings(options));
8180
subscriberApi = SubscriberApi.create(sBuilder.build());
8281
} catch (Exception ex) {
8382
throw new IOException(ex);

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

+6-7
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
* <code>
6969
* try (PublisherApi publisherApi = PublisherApi.createWithDefaults()) {
7070
* String name = "";
71-
*
7271
* Topic callResult = publisherApi.createTopic(name);
7372
* }
7473
* </code>
@@ -324,7 +323,7 @@ public final ApiCallable<Topic, Topic> createTopicCallable() {
324323

325324
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
326325
/**
327-
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
326+
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
328327
* does not exist. The message payload must not be empty; it must contain
329328
* either a non-empty data field, or at least one attribute.
330329
*
@@ -344,7 +343,7 @@ public final PublishResponse publish(String topic, List<PubsubMessage> messages)
344343

345344
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
346345
/**
347-
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
346+
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
348347
* does not exist. The message payload must not be empty; it must contain
349348
* either a non-empty data field, or at least one attribute.
350349
*
@@ -360,7 +359,7 @@ public PublishResponse publish(PublishRequest request) {
360359

361360
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
362361
/**
363-
* Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
362+
* Adds one or more messages to the topic. Generates `NOT_FOUND` if the topic
364363
* does not exist. The message payload must not be empty; it must contain
365364
* either a non-empty data field, or at least one attribute.
366365
*
@@ -527,7 +526,7 @@ public final PageAccessor<String> listTopicSubscriptions(ListTopicSubscriptionsR
527526

528527
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
529528
/**
530-
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
529+
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
531530
* does not exist. After a topic is deleted, a new topic may be created with
532531
* the same name; this is an entirely new topic with none of the old
533532
* configuration or subscriptions. Existing subscriptions to this topic are
@@ -547,7 +546,7 @@ public final void deleteTopic(String topic) {
547546

548547
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
549548
/**
550-
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
549+
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
551550
* does not exist. After a topic is deleted, a new topic may be created with
552551
* the same name; this is an entirely new topic with none of the old
553552
* configuration or subscriptions. Existing subscriptions to this topic are
@@ -565,7 +564,7 @@ private void deleteTopic(DeleteTopicRequest request) {
565564

566565
// AUTO-GENERATED DOCUMENTATION AND METHOD - see instructions at the top of the file for editing.
567566
/**
568-
* Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
567+
* Deletes the topic with the given name. Generates `NOT_FOUND` if the topic
569568
* does not exist. After a topic is deleted, a new topic may be created with
570569
* the same name; this is an entirely new topic with none of the old
571570
* configuration or subscriptions. Existing subscriptions to this topic are

0 commit comments

Comments
 (0)